Merge remote-tracking branch 'origin/release/2024.08-DeltaFPS' into develop

master
Brad Linden 2024-09-04 12:51:24 -07:00
commit 49abe2c8bc
14 changed files with 104 additions and 38 deletions

View File

@ -1038,6 +1038,7 @@ void LLGLManager::initWGL()
GLH_EXT_NAME(wglGetGPUIDsAMD) = (PFNWGLGETGPUIDSAMDPROC)GLH_EXT_GET_PROC_ADDRESS("wglGetGPUIDsAMD");
GLH_EXT_NAME(wglGetGPUInfoAMD) = (PFNWGLGETGPUINFOAMDPROC)GLH_EXT_GET_PROC_ADDRESS("wglGetGPUInfoAMD");
}
mHasNVXGpuMemoryInfo = ExtensionExists("GL_NVX_gpu_memory_info", gGLHExts.mSysExts);
if (ExtensionExists("WGL_EXT_swap_control", gGLHExts.mSysExts))
{
@ -1205,6 +1206,17 @@ bool LLGLManager::initGL()
LL_WARNS("RenderInit") << "VRAM Detected (AMDAssociations):" << mVRAM << LL_ENDL;
}
}
else if (mHasNVXGpuMemoryInfo)
{
GLint mem_kb = 0;
glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &mem_kb);
mVRAM = mem_kb / 1024;
if (mVRAM != 0)
{
LL_WARNS("RenderInit") << "VRAM Detected (NVXGpuMemoryInfo):" << mVRAM << LL_ENDL;
}
}
#endif
#if LL_WINDOWS

View File

@ -97,6 +97,7 @@ public:
// Vendor-specific extensions
bool mHasAMDAssociations = false;
bool mHasNVXGpuMemoryInfo = false;
bool mIsAMD;
bool mIsNVIDIA;

View File

@ -7183,6 +7183,17 @@
<key>Value</key>
<integer>1</integer>
</map>
<key>RenderCanUseTerrainBakeShaders</key>
<map>
<key>Comment</key>
<string>Hardware has support for Terrain Bake shaders</string>
<key>Persist</key>
<integer>0</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>RenderClass1MemoryBandwidth</key>
<map>
<key>Comment</key>

View File

@ -99,10 +99,13 @@ void calcHalfVectors(vec3 lv, vec3 n, vec3 v,
{
l = normalize(lv);
h = normalize(l + v);
nh = clamp(dot(n, h), 0.0, 1.0);
nl = clamp(dot(n, l), 0.0, 1.0);
nv = clamp(dot(n, v), 0.0, 1.0);
vh = clamp(dot(v, h), 0.0, 1.0);
// lower bound to avoid divide by zero
float eps = 0.000001;
nh = clamp(dot(n, h), eps, 1.0);
nl = clamp(dot(n, l), eps, 1.0);
nv = clamp(dot(n, v), eps, 1.0);
vh = clamp(dot(v, h), eps, 1.0);
lightDist = length(lv);
}

View File

@ -208,7 +208,7 @@ RenderFlexTimeFactor 1 1.0
RenderGlowResolutionPow 1 9
RenderMaxPartCount 1 4096
RenderLocalLightCount 1 1024
RenderTransparentWater 1 1
RenderTransparentWater 1 0
RenderTerrainDetail 1 1
RenderTerrainLODFactor 1 2.0
RenderTerrainPBRDetail 1 0

View File

@ -135,7 +135,7 @@ RenderTerrainDetail 1 1
RenderTerrainLODFactor 1 1.0
RenderTerrainPBRDetail 1 -1
RenderTerrainPBRPlanarSampleCount 1 1
RenderTransparentWater 1 1
RenderTransparentWater 1 0
RenderTreeLODFactor 1 0.5
RenderVolumeLODFactor 1 1.125
RenderDeferredSSAO 1 0
@ -172,7 +172,7 @@ RenderTerrainDetail 1 1
RenderTerrainLODFactor 1 2.0
RenderTerrainPBRDetail 1 0
RenderTerrainPBRPlanarSampleCount 1 1
RenderTransparentWater 1 1
RenderTransparentWater 1 0
RenderTreeLODFactor 1 0.5
RenderVolumeLODFactor 1 1.25
RenderDeferredSSAO 1 0
@ -209,7 +209,7 @@ RenderTerrainDetail 1 1
RenderTerrainLODFactor 1 2.0
RenderTerrainPBRDetail 1 0
RenderTerrainPBRPlanarSampleCount 1 1
RenderTransparentWater 1 1
RenderTransparentWater 1 0
RenderTreeLODFactor 1 0.5
RenderVolumeLODFactor 1 1.375
RenderDeferredSSAO 1 0

View File

@ -747,7 +747,9 @@ bool LLAppViewer::init()
// inits from settings.xml and from strings.xml
if (!initConfiguration())
{
LL_ERRS("InitInfo") << "initConfiguration() failed." << LL_ENDL;
LL_WARNS("InitInfo") << "initConfiguration() failed." << LL_ENDL;
// quit immediately
return false;
}
LL_INFOS("InitInfo") << "Configuration initialized." << LL_ENDL ;
@ -914,7 +916,9 @@ bool LLAppViewer::init()
if (!initHardwareTest())
{
// Early out from user choice.
LL_ERRS("InitInfo") << "initHardwareTest() failed." << LL_ENDL;
LL_WARNS("InitInfo") << "initHardwareTest() failed." << LL_ENDL;
// quit immediately
return false;
}
LL_INFOS("InitInfo") << "Hardware test initialization done." << LL_ENDL ;
@ -930,7 +934,9 @@ bool LLAppViewer::init()
{
std::string msg = LLTrans::getString("MBUnableToAccessFile");
OSMessageBox(msg.c_str(), LLStringUtil::null, OSMB_OK);
LL_ERRS("InitInfo") << "Failed to init cache" << LL_ENDL;
LL_WARNS("InitInfo") << "Failed to init cache" << LL_ENDL;
// quit immediately
return false;
}
LL_INFOS("InitInfo") << "Cache initialization is done." << LL_ENDL ;
@ -963,7 +969,9 @@ bool LLAppViewer::init()
if (!gGLManager.mHasRequirements)
{
// Already handled with a MBVideoDrvErr
LL_ERRS("InitInfo") << "gGLManager.mHasRequirements is false." << LL_ENDL;
LL_WARNS("InitInfo") << "gGLManager.mHasRequirements is false." << LL_ENDL;
// quit immediately
return false;
}
// Without SSE2 support we will crash almost immediately, warn here.
@ -973,7 +981,9 @@ bool LLAppViewer::init()
// all hell breaks lose.
std::string msg = LLNotifications::instance().getGlobalString("UnsupportedCPUSSE2");
OSMessageBox(msg.c_str(), LLStringUtil::null, OSMB_OK);
LL_ERRS("InitInfo") << "SSE2 is not supported" << LL_ENDL;
LL_WARNS("InitInfo") << "SSE2 is not supported" << LL_ENDL;
// quit immediately
return false;
}
// alert the user if they are using unsupported hardware
@ -3969,7 +3979,6 @@ void LLAppViewer::forceQuit()
LLApp::setQuitting();
}
//TODO: remove
void LLAppViewer::fastQuit(S32 error_code)
{
// finish pending transfers

View File

@ -1075,6 +1075,9 @@ F32 gpu_benchmark()
return -1.f;
}
LLImageGL::setManualImage(GL_TEXTURE_2D, 0, GL_RGBA, res,res,GL_RGBA, GL_UNSIGNED_BYTE, pixels);
// disable mipmaps and use point filtering to cause cache misses
gGL.getTexUnit(0)->setHasMipMaps(false);
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
if (alloc_timer.getElapsedTimeF32() > time_limit)
{
@ -1191,7 +1194,8 @@ F32 gpu_benchmark()
F32 seconds = ms/1000.f;
F64 samples_drawn = (F64)gBenchmarkProgram.mSamplesDrawn;
F32 samples_sec = (F32)((samples_drawn/1000000000.0)/seconds);
F64 gpixels_drawn = samples_drawn / 1000000000.0;
F32 samples_sec = (F32)(gpixels_drawn/seconds);
gbps = samples_sec*4; // 4 bytes per sample
LL_INFOS("Benchmark") << "Memory bandwidth is " << llformat("%.3f", gbps) << " GB/sec according to ARB_timer_query, total time " << seconds << " seconds" << LL_ENDL;

View File

@ -3446,6 +3446,12 @@ bool enable_gltf_upload()
return enable_gltf_save_as();
}
bool enable_terrain_local_paintmap()
{
static LLCachedControl<bool> can_use_shaders(gSavedSettings, "RenderCanUseTerrainBakeShaders", true);
return can_use_shaders;
}
class LLSelfRemoveAllAttachments : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
@ -10223,6 +10229,7 @@ void initialize_menus()
enable.add("EnableGLTF", boost::bind(&enable_gltf));
enable.add("EnableGLTFSaveAs", boost::bind(&enable_gltf_save_as));
enable.add("EnableGLTFUpload", boost::bind(&enable_gltf_upload));
enable.add("EnableTerrainLocalPaintMap", std::bind(&enable_terrain_local_paintmap));
view_listener_t::addMenu(new LLFloaterVisible(), "FloaterVisible");
view_listener_t::addMenu(new LLShowSidetrayPanel(), "ShowSidetrayPanel");

View File

@ -3156,7 +3156,14 @@ bool LLViewerShaderMgr::loadShadersInterface()
const U32 value_range = (1 << bit_depth) - 1;
shader->addPermutation("TERRAIN_PAINT_PRECISION", llformat("%d", value_range));
success = success && shader->createShader();
llassert(success);
//llassert(success);
if (!success)
{
LL_WARNS() << "Failed to create shader '" << shader->mName << "', disabling!" << LL_ENDL;
gSavedSettings.setBOOL("RenderCanUseTerrainBakeShaders", false);
// continue as if this shader never happened
success = true;
}
}
if (success)

View File

@ -541,6 +541,9 @@ void send_viewer_stats(bool include_preferences)
agent["run_time"] = run_time;
}
// report time the viewer has spent in the foreground
agent["foreground_time"] = gForegroundTime.getElapsedTimeF32();
// send fps only for time app spends in foreground
agent["fps"] = (F32)gForegroundFrameCount / gForegroundTime.getElapsedTimeF32();
agent["version"] = LLVersionInfo::instance().getChannelAndVersion();

View File

@ -511,12 +511,33 @@ void LLViewerTexture::updateClass()
F32 over_pct = (used - target) / target;
bool is_low = over_pct > 0.f;
bool is_sys_low = isSystemMemoryLow();
bool is_low = is_sys_low || over_pct > 0.f;
if (isSystemMemoryLow())
static bool was_low = false;
static bool was_sys_low = false;
if (is_low && !was_low)
{
is_low = true;
// System RAM is low -> ramp up discard bias over time to free memory
// slam to 1.5 bias the moment we hit low memory (discards off screen textures immediately)
sDesiredDiscardBias = llmax(sDesiredDiscardBias, 1.5f);
if (is_sys_low)
{ // if we're low on system memory, emergency purge off screen textures to avoid a death spiral
LL_WARNS() << "Low system memory detected, emergency downrezzing off screen textures" << LL_ENDL;
for (auto& image : gTextureList)
{
gTextureList.updateImageDecodePriority(image, false /*will modify gTextureList otherwise!*/);
}
}
}
was_low = is_low;
was_sys_low = is_sys_low;
if (is_low)
{
// ramp up discard bias over time to free memory
if (sEvaluationTimer.getElapsedTimeF32() > MEMORY_CHECK_WAIT_TIME)
{
static LLCachedControl<F32> low_mem_min_discard_increment(gSavedSettings, "RenderLowMemMinDiscardIncrement", .1f);
@ -526,29 +547,16 @@ void LLViewerTexture::updateClass()
}
else
{
sDesiredDiscardBias = llmax(sDesiredDiscardBias, 1.f + over_pct);
// don't execute above until the slam to 1.5 has a chance to take effect
sEvaluationTimer.reset();
// lower discard bias over time when free memory is available
if (sDesiredDiscardBias > 1.f && over_pct < 0.f)
{
sDesiredDiscardBias -= gFrameIntervalSeconds * 0.01f;
}
}
static bool was_low = false;
if (is_low && !was_low)
{
LL_WARNS() << "Low system memory detected, emergency downrezzing off screen textures" << LL_ENDL;
sDesiredDiscardBias = llmax(sDesiredDiscardBias, 1.5f);
for (auto& image : gTextureList)
{
gTextureList.updateImageDecodePriority(image, false /*will modify gTextureList otherwise!*/);
}
}
was_low = is_low;
// set to max discard bias if the window has been backgrounded for a while
static bool was_backgrounded = false;
static LLFrameTimer backgrounded_timer;

View File

@ -964,7 +964,7 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag
// this is an alternative to decaying mMaxVirtualSize over time
// that keeps textures from continously downrezzing and uprezzing in the background
if (LLViewerTexture::sDesiredDiscardBias > 2.f ||
if (LLViewerTexture::sDesiredDiscardBias > 1.5f ||
(!on_screen && LLViewerTexture::sDesiredDiscardBias > 1.f))
{
imagep->mMaxVirtualSize = 0.f;

View File

@ -3672,9 +3672,10 @@ function="World.EnvPreset"
<menu_item_separator/>
<menu_item_call
enabled="true"
label="Create Local Paintmap"
name="Create Local Paintmap">
<menu_item_call.on_enable
function="EnableTerrainLocalPaintMap"/>
<menu_item_call.on_click
function="Advanced.TerrainCreateLocalPaintMap" />
</menu_item_call>