Viewer#779 Show bias memory estimate in texture console

meow-7.2.2
Andrey Kleshchev 2024-02-14 21:39:13 +02:00 committed by Andrey Kleshchev
parent a2971d84d5
commit a02459dea6
3 changed files with 14 additions and 3 deletions

View File

@ -529,11 +529,12 @@ void LLGLTexMemBar::draw()
U32 texFetchLatMed = U32(recording.getMean(LLTextureFetch::sTexFetchLatency).value() * 1000.0f);
U32 texFetchLatMax = U32(recording.getMax(LLTextureFetch::sTexFetchLatency).value() * 1000.0f);
text = llformat("GL Free: %d MB Sys Free: %d MB FBO: %d MB Bias: %.2f Cache: %.1f/%.1f MB",
text = llformat("GL Free: %d MB Sys Free: %d MB FBO: %d MB Bias: %.2f(%d MB) Cache: %.1f/%.1f MB",
gViewerWindow->getWindow()->getAvailableVRAMMegabytes(),
LLMemory::getAvailableMemKB()/1024,
LLRenderTarget::sBytesAllocated/(1024*1024),
discard_bias,
(S32)LLViewerTexture::sFreeVRAMMegabytes,
cache_usage,
cache_max_usage);
//, cache_entries, cache_max_entries

View File

@ -100,6 +100,9 @@ U32 LLViewerTexture::sMaxSmallImageSize = MAX_CACHED_RAW_IMAGE_AREA;
bool LLViewerTexture::sFreezeImageUpdates = false;
F32 LLViewerTexture::sCurrentTime = 0.0f;
constexpr F32 MIN_VRAM_BUDGET = 768.f;
F32 LLViewerTexture::sFreeVRAMMegabytes = MIN_VRAM_BUDGET;
LLViewerTexture::EDebugTexels LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_OFF;
const F64 log_2 = log(2.0);
@ -509,7 +512,10 @@ void LLViewerTexture::getGPUMemoryForTextures(S32Megabytes &gpu, S32Megabytes &p
timer.reset();
{
gpu_res = (S32Megabytes)gViewerWindow->getWindow()->getAvailableVRAMMegabytes();
// For purposes of texture memory need to check both, actual free
// memory and estimated free texture memory from bias calculations
U32 free_memory = llmin(gViewerWindow->getWindow()->getAvailableVRAMMegabytes(), (U32)sFreeVRAMMegabytes);
gpu_res = (S32Megabytes)free_memory;
//check main memory, only works for windows and macos.
LLMemory::updateMemoryInfo();
@ -546,7 +552,8 @@ void LLViewerTexture::updateClass()
F32 budget = max_vram_budget == 0 ? gGLManager.mVRAM : max_vram_budget;
// try to leave half a GB for everyone else, but keep at least 768MB for ourselves
F32 target = llmax(budget - 512.f, 768.f);
F32 target = llmax(budget - 512.f, MIN_VRAM_BUDGET);
sFreeVRAMMegabytes = target - used;
F32 over_pct = llmax((used-target) / target, 0.f);
sDesiredDiscardBias = llmax(sDesiredDiscardBias, 1.f + over_pct);

View File

@ -228,6 +228,9 @@ public:
static bool sFreezeImageUpdates;
static F32 sCurrentTime ;
// estimated free memory for textures, by bias calculation
static F32 sFreeVRAMMegabytes;
enum EDebugTexels
{
DEBUG_TEXELS_OFF,