Permalink
Browse files

Merge pull request #10447 from unknownbrackets/update-vram

Remove "read framebuffers to memory" FBO auto-download
  • Loading branch information...
hrydgard committed Dec 25, 2017
2 parents 4b04a6d + ebce6da commit ffa48cb4fc0c7b477778cca5629087cbabac59c3
View
@@ -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");
View
@@ -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.
View
@@ -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())
@@ -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;
}
@@ -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 {
@@ -385,7 +376,6 @@ class FramebufferManagerCommon {
u32 framebufRangeEnd_ = 0;
bool useBufferedRendering_ = false;
bool updateVRAM_ = false;
bool usePostShader_ = false;
bool postShaderAtOutputResolution_ = false;
bool postShaderIsUpscalingFilter_ = false;
@@ -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);
@@ -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_) {
View
@@ -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;
View
@@ -551,7 +551,6 @@ void MainWindow::createMenus()
anisotropicGroup = new MenuActionGroup(this, anisotropicMenu, SLOT(anisotropicGroup_triggered(QAction *)),
QStringList() << "Off" << "2x" << "4x" << "8x" << "16x",
QList<int>() << 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")))
View
@@ -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;
});
View
@@ -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));
View
@@ -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
View
@@ -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

0 comments on commit ffa48cb

Please sign in to comment.