diff --git a/Common/GPU/OpenGL/GLQueueRunner.cpp b/Common/GPU/OpenGL/GLQueueRunner.cpp index a9fdcdff4b..5a622c881f 100644 --- a/Common/GPU/OpenGL/GLQueueRunner.cpp +++ b/Common/GPU/OpenGL/GLQueueRunner.cpp @@ -433,8 +433,7 @@ void GLQueueRunner::RunInitSteps(const FastVec &steps, bool skipGLC // Calling glGetError() isn't great, but at the end of init, only after creating textures, shouldn't be too bad... GLenum err = glGetError(); if (err == GL_OUT_OF_MEMORY) { - WARN_LOG(Log::G3D, "GL ran out of GPU memory; switching to low memory mode"); - sawOutOfMemory_ = true; + WARN_LOG(Log::G3D, "GL ran out of GPU memory! Bad!"); } else if (err != GL_NO_ERROR) { // We checked the err anyway, might as well log if there is one. std::string errorString = GLEnumToString(err); diff --git a/Common/GPU/OpenGL/GLQueueRunner.h b/Common/GPU/OpenGL/GLQueueRunner.h index 6c36f247df..5cf0059b57 100644 --- a/Common/GPU/OpenGL/GLQueueRunner.h +++ b/Common/GPU/OpenGL/GLQueueRunner.h @@ -367,10 +367,6 @@ public: targetHeight_ = height; } - bool SawOutOfMemory() { - return sawOutOfMemory_; - } - std::string GetGLString(int name) const; private: diff --git a/Common/GPU/OpenGL/GLRenderManager.h b/Common/GPU/OpenGL/GLRenderManager.h index 547f6bd204..15114e3d80 100644 --- a/Common/GPU/OpenGL/GLRenderManager.h +++ b/Common/GPU/OpenGL/GLRenderManager.h @@ -825,10 +825,6 @@ public: void StartThread(); // Currently only used on iOS, since we fully recreate the context on Android - bool SawOutOfMemory() { - return queueRunner_.SawOutOfMemory(); - } - // Only supports a common subset. std::string GetGLString(int name) const { return queueRunner_.GetGLString(name); diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index 702ded9d72..f3f2cacb31 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -879,14 +879,13 @@ void TextureCacheCommon::Decimate(const TexCacheEntry *const exceptThisOne, bool const u32 had = cacheSizeEstimate; ForgetLastTexture(); - int killAgeBase = lowMemoryMode_ ? TEXTURE_KILL_AGE_LOWMEM : TEXTURE_KILL_AGE; for (TexCache::iterator iter = cache_.begin(); iter != cache_.end(); ) { if (iter->second.get() == exceptThisOne) { ++iter; continue; } bool hasClutVariants = (iter->second->status & TexStatus::MANY_CLUT_VARIANTS) != 0; - int killAge = hasClutVariants ? TEXTURE_KILL_AGE_CLUT : killAgeBase; + int killAge = hasClutVariants ? TEXTURE_KILL_AGE_CLUT : TEXTURE_KILL_AGE; if (iter->second->lastFrame + killAge < gpuStats.totals.numFlips) { DeleteTexture(iter++); } else { @@ -907,8 +906,7 @@ void TextureCacheCommon::Decimate(const TexCacheEntry *const exceptThisOne, bool ++iter; continue; } - // In low memory mode, we kill them all since secondary cache is disabled. - if (lowMemoryMode_ || iter->second->lastFrame + TEXTURE_SECOND_KILL_AGE < gpuStats.totals.numFlips) { + if (iter->second->lastFrame + TEXTURE_SECOND_KILL_AGE < gpuStats.totals.numFlips) { ReleaseTexture(iter->second.get(), true); secondCacheSizeEstimate -= iter->second->EstimateTexMemoryUsage(); iter = secondCache_.erase(iter); @@ -2719,7 +2717,7 @@ bool TextureCacheCommon::CheckFullHash(TexCacheEntry *entry, bool &doDelete) { if (!isVideo) { // If it's failed a bunch of times, then the second cache is just wasting time and VRAM. // In that case, skip. - if (entry->numInvalidated > 2 && entry->numInvalidated < 128 && !lowMemoryMode_) { + if (entry->numInvalidated > 2 && entry->numInvalidated < 128) { // We have a new hash: look for that hash in the secondary cache. const u64 secondKey = fullhash | ((u64)entry->cluthash << 32); TexCache::iterator secondIter = secondCache_.find(secondKey); @@ -2864,13 +2862,6 @@ bool TextureCacheCommon::PrepareBuildTexture(BuildTexturePlan &plan, TexCacheEnt plan.scaleFactor = standardScaleFactor_; plan.depth = 1; - // Rachet down scale factor in low-memory mode. - // TODO: I think really we should just turn it off? - if (lowMemoryMode_ && !plan.hardwareScaling) { - // Keep it even, though, just in case of npot troubles. - plan.scaleFactor = plan.scaleFactor > 4 ? 4 : (plan.scaleFactor > 2 ? 2 : 1); - } - if (plan.hardwareScaling) { plan.scaleFactor = shaderScaleFactor_; } @@ -3115,7 +3106,7 @@ void TextureCacheCommon::LoadTextureLevel(TexCacheEntry &entry, uint8_t *data, s } } - if (plan.saveTexture && !lowMemoryMode_) { + if (plan.saveTexture) { ReplacedTextureDecodeInfo replacedInfo; replacedInfo.cachekey = entry.CacheKey(); replacedInfo.hash = entry.fullhash; diff --git a/GPU/Common/TextureCacheCommon.h b/GPU/Common/TextureCacheCommon.h index e0859ebde3..92d0bd47a6 100644 --- a/GPU/Common/TextureCacheCommon.h +++ b/GPU/Common/TextureCacheCommon.h @@ -457,7 +457,6 @@ protected: ShaderManagerCommon *shaderManager_; bool clearCacheNextFrame_ = false; - bool lowMemoryMode_ = false; int decimationCounter_ = 0; int texelsScaledThisFrame_ = 0; diff --git a/GPU/GLES/TextureCacheGLES.cpp b/GPU/GLES/TextureCacheGLES.cpp index eeee95c561..8bb016885c 100644 --- a/GPU/GLES/TextureCacheGLES.cpp +++ b/GPU/GLES/TextureCacheGLES.cpp @@ -130,23 +130,6 @@ static void ConvertColors(void *dstBuf, const void *srcBuf, Draw::DataFormat dst } } -void TextureCacheGLES::StartFrame() { - TextureCacheCommon::StartFrame(); - - GLRenderManager *renderManager = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER); - if (!lowMemoryMode_ && renderManager->SawOutOfMemory()) { - lowMemoryMode_ = true; - decimationCounter_ = 0; - - auto err = GetI18NCategory(I18NCat::ERRORS); - if (standardScaleFactor_ > 1) { - g_OSD.Show(OSDType::MESSAGE_WARNING, err->T("Warning: Video memory FULL, reducing upscaling and switching to slow caching mode"), 2.0f); - } else { - g_OSD.Show(OSDType::MESSAGE_WARNING, err->T("Warning: Video memory FULL, switching to slow caching mode"), 2.0f); - } - } -} - // TODO: This is almost the same as the Common one, just with some extra color conversion. Should merge. void TextureCacheGLES::UpdateCurrentClut(GEPaletteFormat clutFormat, u32 clutBase, bool clutIndexIsSimple) { const u32 clutBaseBytes = clutFormat == GE_CMODE_32BIT_ABGR8888 ? (clutBase * sizeof(u32)) : (clutBase * sizeof(u16)); diff --git a/GPU/GLES/TextureCacheGLES.h b/GPU/GLES/TextureCacheGLES.h index 4960c7f48f..84d1ccc5e7 100644 --- a/GPU/GLES/TextureCacheGLES.h +++ b/GPU/GLES/TextureCacheGLES.h @@ -37,7 +37,6 @@ public: ~TextureCacheGLES(); void Clear(bool delete_them) override; - void StartFrame() override; void SetFramebufferManager(FramebufferManagerGLES *fbManager); void SetDrawEngine(DrawEngineGLES *td) { diff --git a/GPU/Vulkan/TextureCacheVulkan.cpp b/GPU/Vulkan/TextureCacheVulkan.cpp index a69038e77b..b5aa3f4138 100644 --- a/GPU/Vulkan/TextureCacheVulkan.cpp +++ b/GPU/Vulkan/TextureCacheVulkan.cpp @@ -723,16 +723,16 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) { VulkanBarrierBatch barrier; bool allocSuccess = image->CreateDirect(plan.createW, plan.createH, plan.depth, plan.levelsToCreate, actualFmt, imageLayout, usage, &barrier, mapping); barrier.Flush(cmdInit); - if (!allocSuccess && !lowMemoryMode_) { - WARN_LOG(Log::G3D, "Texture cache ran out of GPU memory; switching to low memory mode"); - lowMemoryMode_ = true; + if (!allocSuccess) { + WARN_LOG(Log::G3D, "Texture cache ran out of GPU memory; decimating"); decimationCounter_ = 0; - Decimate(entry, true); + Decimate(entry, true); // note: First parameter is "exceptThisOne". // TODO: We should stall the GPU here and wipe things out of memory. // As is, it will almost definitely fail the second time, but next frame it may recover. auto err = GetI18NCategory(I18NCat::ERRORS); + // TODO: These messages are not really accurate. if (plan.scaleFactor > 1) { g_OSD.Show(OSDType::MESSAGE_WARNING, err->T("Warning: Video memory FULL, reducing upscaling and switching to slow caching mode"), 2.0f); } else { @@ -853,8 +853,7 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) { loadLevel(uploadSize, i == 0 ? plan.baseLevelSrc : i, byteStride, plan.scaleFactor); entry->vkTex->CopyBufferToMipLevel(cmdInit, ©Batch, i, mipWidth, mipHeight, 0, texBuf, bufferOffset, pixelStride); } - // Format might be wrong in lowMemoryMode_, so don't save. - if (plan.saveTexture && !lowMemoryMode_) { + if (plan.saveTexture) { // When hardware texture scaling is enabled, this saves the original. const int w = dataScaled ? mipWidth : mipUnscaledWidth; const int h = dataScaled ? mipHeight : mipUnscaledHeight;