From 025a806ab4fa4a5f52a1ecd48feca93930da0706 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 25 Dec 2017 11:17:59 -0800 Subject: [PATCH 1/2] GPU: Remove FBO auto-download hack. See #6261. This should be replaced now with block transfer detection, which is faster and doesn't cause crashes. Games that previously required this setting should use block transfer instead. If that doesn't work, it's a bug. --- GPU/Common/FramebufferCommon.cpp | 9 ++++----- GPU/Common/FramebufferCommon.h | 1 - GPU/Common/TextureCacheCommon.cpp | 4 ---- GPU/GLES/FramebufferManagerGLES.cpp | 5 ----- GPU/GLES/GPU_GLES.cpp | 10 ++-------- 5 files changed, 6 insertions(+), 23 deletions(-) diff --git a/GPU/Common/FramebufferCommon.cpp b/GPU/Common/FramebufferCommon.cpp index 639e395b7758..522c704a5f30 100644 --- a/GPU/Common/FramebufferCommon.cpp +++ b/GPU/Common/FramebufferCommon.cpp @@ -162,7 +162,6 @@ bool FramebufferManagerCommon::UpdateSize() { void FramebufferManagerCommon::BeginFrame() { DecimateFBOs(); currentRenderVfb_ = nullptr; - updateVRAM_ = !(g_Config.iRenderingMode == FB_NON_BUFFERED_MODE || g_Config.iRenderingMode == FB_BUFFERED_MODE); } void FramebufferManagerCommon::SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) { @@ -195,7 +194,7 @@ u32 FramebufferManagerCommon::FramebufferByteSize(const VirtualFramebuffer *vfb) } bool FramebufferManagerCommon::ShouldDownloadFramebuffer(const VirtualFramebuffer *vfb) const { - return updateVRAM_ || (PSP_CoreParameter().compat.flags().Force04154000Download && vfb->fb_address == 0x00154000); + return PSP_CoreParameter().compat.flags().Force04154000Download && vfb->fb_address == 0x00154000; } void FramebufferManagerCommon::SetNumExtraFBOs(int num) { @@ -457,7 +456,7 @@ VirtualFramebuffer *FramebufferManagerCommon::DoSetRenderFrameBuffer(const Frame vfbs_.push_back(vfb); currentRenderVfb_ = vfb; - if (useBufferedRendering_ && !updateVRAM_ && !g_Config.bDisableSlowFramebufEffects) { + if (useBufferedRendering_ && !g_Config.bDisableSlowFramebufEffects) { gpu->PerformMemoryUpload(fb_address_mem, byteSize); NotifyStencilUpload(fb_address_mem, byteSize, true); // TODO: Is it worth trying to upload the depth buffer? @@ -1210,7 +1209,7 @@ void FramebufferManagerCommon::ResizeFramebufFBO(VirtualFramebuffer *vfb, int w, } bool FramebufferManagerCommon::NotifyFramebufferCopy(u32 src, u32 dst, int size, bool isMemset, u32 skipDrawReason) { - if (updateVRAM_ || size == 0) { + if (size == 0) { return false; } @@ -1580,7 +1579,7 @@ void FramebufferManagerCommon::OptimizeDownloadRange(VirtualFramebuffer * vfb, i } bool FramebufferManagerCommon::NotifyBlockTransferBefore(u32 dstBasePtr, int dstStride, int dstX, int dstY, u32 srcBasePtr, int srcStride, int srcX, int srcY, int width, int height, int bpp, u32 skipDrawReason) { - if (!useBufferedRendering_ || updateVRAM_) { + if (!useBufferedRendering_) { return false; } diff --git a/GPU/Common/FramebufferCommon.h b/GPU/Common/FramebufferCommon.h index 13b8a840ec1b..719c2f4e4290 100644 --- a/GPU/Common/FramebufferCommon.h +++ b/GPU/Common/FramebufferCommon.h @@ -385,7 +385,6 @@ class FramebufferManagerCommon { u32 framebufRangeEnd_ = 0; bool useBufferedRendering_ = false; - bool updateVRAM_ = false; bool usePostShader_ = false; bool postShaderAtOutputResolution_ = false; bool postShaderIsUpscalingFilter_ = false; diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index 953d64c202d6..6de060910724 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -719,10 +719,6 @@ bool TextureCacheCommon::AttachFramebuffer(TexCacheEntry *entry, u32 address, Vi // If they match exactly, it's non-CLUT and from the top left. if (exactMatch) { - // Apply to non-buffered and buffered mode only. - if (!(g_Config.iRenderingMode == FB_NON_BUFFERED_MODE || g_Config.iRenderingMode == FB_BUFFERED_MODE)) - return false; - DEBUG_LOG(G3D, "Render to texture detected at %08x!", address); if (framebuffer->fb_stride != entry->bufw) { WARN_LOG_REPORT_ONCE(diffStrides1, G3D, "Render to texture with different strides %d != %d", entry->bufw, framebuffer->fb_stride); diff --git a/GPU/GLES/FramebufferManagerGLES.cpp b/GPU/GLES/FramebufferManagerGLES.cpp index c51b454706be..5faef65a64da 100644 --- a/GPU/GLES/FramebufferManagerGLES.cpp +++ b/GPU/GLES/FramebufferManagerGLES.cpp @@ -1037,11 +1037,6 @@ void FramebufferManagerGLES::PackDepthbuffer(VirtualFramebuffer *vfb, int x, int void FramebufferManagerGLES::EndFrame() { CHECK_GL_ERROR_IF_DEBUG(); - // We flush to memory last requested framebuffer, if any. - // Only do this in the read-framebuffer modes. - if (updateVRAM_) - PackFramebufferAsync_(nullptr); - // Let's explicitly invalidate any temp FBOs used during this frame. if (gl_extensions.GLES3 && glInvalidateFramebuffer != nullptr) { for (auto temp : tempFBOs_) { diff --git a/GPU/GLES/GPU_GLES.cpp b/GPU/GLES/GPU_GLES.cpp index a1854df7a558..8142419e9767 100644 --- a/GPU/GLES/GPU_GLES.cpp +++ b/GPU/GLES/GPU_GLES.cpp @@ -255,17 +255,11 @@ void GPU_GLES::CheckGPUFeatures() { bool useCPU = false; if (!gl_extensions.IsGLES) { - // Urrgh, we don't even define FB_READFBOMEMORY_CPU on mobile -#ifndef USING_GLES2 - useCPU = g_Config.iRenderingMode == FB_READFBOMEMORY_CPU; -#endif // Some cards or drivers seem to always dither when downloading a framebuffer to 16-bit. // This causes glitches in games that expect the exact values. // It has not been experienced on NVIDIA cards, so those are left using the GPU (which is faster.) - if (g_Config.iRenderingMode == FB_BUFFERED_MODE) { - if (gl_extensions.gpuVendor != GPU_VENDOR_NVIDIA || gl_extensions.ver[0] < 3) { - useCPU = true; - } + if (gl_extensions.gpuVendor != GPU_VENDOR_NVIDIA || !gl_extensions.VersionGEThan(3, 0)) { + useCPU = true; } } else { useCPU = true; From ebce6da223d75abaeab392123ed9ab9274491b1e Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 25 Dec 2017 11:20:26 -0800 Subject: [PATCH 2/2] UI: Remove auto-download options. See previous commit removing actual functionality. --- Core/Config.cpp | 3 +++ Core/Config.h | 2 +- Core/Reporting.cpp | 2 -- GPU/Common/FramebufferCommon.h | 9 --------- Qt/mainwindow.cpp | 1 - UI/GameSettingsScreen.cpp | 10 ++-------- Windows/MainWindowMenu.cpp | 27 +-------------------------- Windows/ppsspp.rc | 6 ++---- Windows/resource.h | 2 -- 9 files changed, 9 insertions(+), 53 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index 7b62504554ff..1f3240ce93ff 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -980,6 +980,9 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) { if (iAnisotropyLevel > 4) { iAnisotropyLevel = 4; } + if (iRenderingMode != FB_NON_BUFFERED_MODE && iRenderingMode != FB_BUFFERED_MODE) { + g_Config.iRenderingMode = FB_BUFFERED_MODE; + } // Check for an old dpad setting IniFile::Section *control = iniFile.GetOrCreateSection("Control"); diff --git a/Core/Config.h b/Core/Config.h index 09171057e1cf..85b01bef64ad 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -161,7 +161,7 @@ struct Config { bool bHardwareTransform; // only used in the GLES backend bool bSoftwareSkinning; // may speed up some games - int iRenderingMode; // 0 = non-buffered rendering 1 = buffered rendering 2 = Read Framebuffer to memory (CPU) 3 = Read Framebuffer to memory (GPU) + int iRenderingMode; // 0 = non-buffered rendering 1 = buffered rendering int iTexFiltering; // 1 = off , 2 = nearest , 3 = linear , 4 = linear(CG) int iBufFilter; // 1 = linear, 2 = nearest int iSmallDisplayZoomType; // Used to fit display into screen 0 = stretch, 1 = partial stretch, 2 = auto scaling, 3 = manual scaling. diff --git a/Core/Reporting.cpp b/Core/Reporting.cpp index 7b9e40af036b..02503301d822 100644 --- a/Core/Reporting.cpp +++ b/Core/Reporting.cpp @@ -453,8 +453,6 @@ namespace Reporting bool IsSupported() { // Disabled when using certain hacks, because they make for poor reports. - if (g_Config.iRenderingMode >= 2) // FBO_READFBOMEMORY_MIN - return false; if (g_Config.bTimerHack) return false; if (CheatsInEffect()) diff --git a/GPU/Common/FramebufferCommon.h b/GPU/Common/FramebufferCommon.h index 719c2f4e4290..78005a1126ca 100644 --- a/GPU/Common/FramebufferCommon.h +++ b/GPU/Common/FramebufferCommon.h @@ -40,15 +40,6 @@ enum { enum { FB_NON_BUFFERED_MODE = 0, FB_BUFFERED_MODE = 1, - - // Hm, it's unfortunate that GPU has ended up as two separate values in GL and GLES. -#ifndef USING_GLES2 - FB_READFBOMEMORY_CPU = 2, - FB_READFBOMEMORY_GPU = 3, -#else - FB_READFBOMEMORY_GPU = 2, -#endif - FBO_READFBOMEMORY_MIN = 2 }; namespace Draw { diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 5e4fc65535e5..7e0b481f9b83 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -551,7 +551,6 @@ void MainWindow::createMenus() anisotropicGroup = new MenuActionGroup(this, anisotropicMenu, SLOT(anisotropicGroup_triggered(QAction *)), QStringList() << "Off" << "2x" << "4x" << "8x" << "16x", QList() << 0 << 1 << 2 << 3 << 4); - // TODO: Check for newer buffer render options videoMenu->add(new MenuAction(this, SLOT(bufferRenderAct()), QT_TR_NOOP("&Buffered Rendering"), Qt::Key_F5)) ->addEventChecked(&g_Config.iRenderingMode); videoMenu->add(new MenuAction(this, SLOT(linearAct()), QT_TR_NOOP("&Linear Filtering"))) diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index e2409223f6a6..3a5ec4a80cce 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -199,21 +199,15 @@ void GameSettingsScreen::CreateViews() { renderingBackendChoice->HideChoice(3); } - static const char *renderingMode[] = { "Non-Buffered Rendering", "Buffered Rendering", "Read Framebuffers To Memory (CPU)", "Read Framebuffers To Memory (GPU)"}; + static const char *renderingMode[] = { "Non-Buffered Rendering", "Buffered Rendering"}; PopupMultiChoice *renderingModeChoice = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iRenderingMode, gr->T("Mode"), renderingMode, 0, ARRAY_SIZE(renderingMode), gr->GetName(), screenManager())); renderingModeChoice->OnChoice.Add([=](EventParams &e) { switch (g_Config.iRenderingMode) { case FB_NON_BUFFERED_MODE: - settingInfo_->Show(gr->T("RenderingMode NonBuffered Tip", "Faster, but nothing may draw in some games"), e.v); + settingInfo_->Show(gr->T("RenderingMode NonBuffered Tip", "Faster, but graphics may be missing in some games"), e.v); break; case FB_BUFFERED_MODE: break; -#ifndef USING_GLES2 - case FB_READFBOMEMORY_CPU: -#endif - case FB_READFBOMEMORY_GPU: - settingInfo_->Show(gr->T("RenderingMode ReadFromMemory Tip", "Causes crashes in many games, not recommended"), e.v); - break; } return UI::EVENT_CONTINUE; }); diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index 805d102720c1..3cb690884667 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -322,8 +322,6 @@ namespace MainWindow { TranslateSubMenu(menu, "Rendering Mode", MENU_OPTIONS, SUBMENU_RENDERING_MODE); TranslateMenuItem(menu, ID_OPTIONS_NONBUFFEREDRENDERING); TranslateMenuItem(menu, ID_OPTIONS_BUFFEREDRENDERING); - TranslateMenuItem(menu, ID_OPTIONS_READFBOTOMEMORYCPU); - TranslateMenuItem(menu, ID_OPTIONS_READFBOTOMEMORYGPU); TranslateSubMenu(menu, "Frame Skipping", MENU_OPTIONS, SUBMENU_FRAME_SKIPPING, L"\tF7"); TranslateMenuItem(menu, ID_OPTIONS_FRAMESKIP_AUTO); TranslateMenuItem(menu, ID_OPTIONS_FRAMESKIP_0); @@ -506,15 +504,9 @@ namespace MainWindow { } static void setRenderingMode(int mode) { - if (mode >= FB_NON_BUFFERED_MODE) - g_Config.iRenderingMode = mode; - else { - if (++g_Config.iRenderingMode > FB_READFBOMEMORY_GPU) - g_Config.iRenderingMode = FB_NON_BUFFERED_MODE; - } - I18NCategory *gr = GetI18NCategory("Graphics"); + g_Config.iRenderingMode = mode; switch (g_Config.iRenderingMode) { case FB_NON_BUFFERED_MODE: osm.Show(gr->T("Non-Buffered Rendering")); @@ -524,14 +516,6 @@ namespace MainWindow { case FB_BUFFERED_MODE: osm.Show(gr->T("Buffered Rendering")); break; - - case FB_READFBOMEMORY_CPU: - osm.Show(gr->T("Read Framebuffers To Memory (CPU)")); - break; - - case FB_READFBOMEMORY_GPU: - osm.Show(gr->T("Read Framebuffers To Memory (GPU)")); - break; } NativeMessageReceived("gpu_resized", ""); @@ -804,8 +788,6 @@ namespace MainWindow { case ID_OPTIONS_NONBUFFEREDRENDERING: setRenderingMode(FB_NON_BUFFERED_MODE); break; case ID_OPTIONS_BUFFEREDRENDERING: setRenderingMode(FB_BUFFERED_MODE); break; - case ID_OPTIONS_READFBOTOMEMORYCPU: setRenderingMode(FB_READFBOMEMORY_CPU); break; - case ID_OPTIONS_READFBOTOMEMORYGPU: setRenderingMode(FB_READFBOMEMORY_GPU); break; case ID_DEBUG_SHOWDEBUGSTATISTICS: g_Config.bShowDebugStats = !g_Config.bShowDebugStats; @@ -1217,14 +1199,7 @@ namespace MainWindow { static const int renderingmode[] = { ID_OPTIONS_NONBUFFEREDRENDERING, ID_OPTIONS_BUFFEREDRENDERING, - ID_OPTIONS_READFBOTOMEMORYCPU, - ID_OPTIONS_READFBOTOMEMORYGPU, }; - if (g_Config.iRenderingMode < FB_NON_BUFFERED_MODE) - g_Config.iRenderingMode = FB_NON_BUFFERED_MODE; - - else if (g_Config.iRenderingMode > FB_READFBOMEMORY_GPU) - g_Config.iRenderingMode = FB_READFBOMEMORY_GPU; for (int i = 0; i < ARRAY_SIZE(renderingmode); i++) { CheckMenuItem(menu, renderingmode[i], MF_BYCOMMAND | ((i == g_Config.iRenderingMode) ? MF_CHECKED : MF_UNCHECKED)); diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index 867613bd9dc7..cd334bcc7fff 100644 --- a/Windows/ppsspp.rc +++ b/Windows/ppsspp.rc @@ -504,10 +504,8 @@ BEGIN POPUP "Rendering Mode" BEGIN - MENUITEM "Non-Buffered Rendering", ID_OPTIONS_NONBUFFEREDRENDERING - MENUITEM "Buffered Rendering", ID_OPTIONS_BUFFEREDRENDERING - MENUITEM "Read Framebuffers To Memory (CPU)", ID_OPTIONS_READFBOTOMEMORYCPU - MENUITEM "Read Framebuffers To Memory (GPU)", ID_OPTIONS_READFBOTOMEMORYGPU + MENUITEM "Non-Buffered Rendering", ID_OPTIONS_NONBUFFEREDRENDERING + MENUITEM "Buffered Rendering", ID_OPTIONS_BUFFEREDRENDERING END POPUP "Frame Skipping" BEGIN diff --git a/Windows/resource.h b/Windows/resource.h index ba90e1ac7938..887038bd473f 100644 --- a/Windows/resource.h +++ b/Windows/resource.h @@ -241,8 +241,6 @@ #define ID_DISASM_THREAD_KILL 40073 #define ID_FILE_SAVESTATE_NEXT_SLOT 40074 #define ID_FILE_SAVESTATE_NEXT_SLOT_HC 40075 -#define ID_OPTIONS_READFBOTOMEMORYGPU 40076 -#define ID_OPTIONS_READFBOTOMEMORYCPU 40077 #define ID_OPTIONS_NONBUFFEREDRENDERING 40078 #define ID_OPTIONS_FRAMESKIP_0 40079 #define ID_OPTIONS_FRAMESKIP_1 40080