From 93fb0e1e1cb73b12189c96db52c53f19696ab1da Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 11 Feb 2018 15:36:49 +1000 Subject: [PATCH] TextureCache: Add an option to disable EFB copies to VRAM The option is named DisableCopyToVRAM under the Hacks section in GFX.ini. It is intentionally not exposed to the GUI, as users should not need to use it under normal circumstances. The main use is debugging issues in the EFB-to-RAM shaders. --- Source/Core/Core/Config/GraphicsSettings.cpp | 2 ++ Source/Core/Core/Config/GraphicsSettings.h | 1 + Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp | 3 ++- Source/Core/VideoCommon/TextureCacheBase.cpp | 12 ++++-------- Source/Core/VideoCommon/VideoConfig.cpp | 1 + Source/Core/VideoCommon/VideoConfig.h | 1 + 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Source/Core/Core/Config/GraphicsSettings.cpp b/Source/Core/Core/Config/GraphicsSettings.cpp index 8811d36bad..5f8d4c102a 100644 --- a/Source/Core/Core/Config/GraphicsSettings.cpp +++ b/Source/Core/Core/Config/GraphicsSettings.cpp @@ -132,6 +132,8 @@ const ConfigInfo GFX_HACK_SKIP_EFB_COPY_TO_RAM{{System::GFX, "Hacks", "EFB true}; const ConfigInfo GFX_HACK_SKIP_XFB_COPY_TO_RAM{{System::GFX, "Hacks", "XFBToTextureEnable"}, true}; +const ConfigInfo GFX_HACK_DISABLE_COPY_TO_VRAM{{System::GFX, "Hacks", "DisableCopyToVRAM"}, + false}; const ConfigInfo GFX_HACK_IMMEDIATE_XFB{{System::GFX, "Hacks", "ImmediateXFBEnable"}, false}; const ConfigInfo GFX_HACK_COPY_EFB_SCALED{{System::GFX, "Hacks", "EFBScaledCopy"}, true}; const ConfigInfo GFX_HACK_EFB_EMULATE_FORMAT_CHANGES{ diff --git a/Source/Core/Core/Config/GraphicsSettings.h b/Source/Core/Core/Config/GraphicsSettings.h index 82cadfdb81..70613bee00 100644 --- a/Source/Core/Core/Config/GraphicsSettings.h +++ b/Source/Core/Core/Config/GraphicsSettings.h @@ -100,6 +100,7 @@ extern const ConfigInfo GFX_HACK_BBOX_PREFER_STENCIL_IMPLEMENTATION; extern const ConfigInfo GFX_HACK_FORCE_PROGRESSIVE; extern const ConfigInfo GFX_HACK_SKIP_EFB_COPY_TO_RAM; extern const ConfigInfo GFX_HACK_SKIP_XFB_COPY_TO_RAM; +extern const ConfigInfo GFX_HACK_DISABLE_COPY_TO_VRAM; extern const ConfigInfo GFX_HACK_IMMEDIATE_XFB; extern const ConfigInfo GFX_HACK_COPY_EFB_SCALED; extern const ConfigInfo GFX_HACK_EFB_EMULATE_FORMAT_CHANGES; diff --git a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp index fdee06283f..fc3d64e5ba 100644 --- a/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp +++ b/Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp @@ -72,7 +72,8 @@ bool IsSettingSaveable(const Config::ConfigLocation& config_location) Config::GFX_HACK_EFB_ACCESS_ENABLE.location, Config::GFX_HACK_BBOX_ENABLE.location, Config::GFX_HACK_BBOX_PREFER_STENCIL_IMPLEMENTATION.location, Config::GFX_HACK_FORCE_PROGRESSIVE.location, Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM.location, - Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM.location, Config::GFX_HACK_IMMEDIATE_XFB.location, + Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM.location, + Config::GFX_HACK_DISABLE_COPY_TO_VRAM.location, Config::GFX_HACK_IMMEDIATE_XFB.location, Config::GFX_HACK_COPY_EFB_SCALED.location, Config::GFX_HACK_EFB_EMULATE_FORMAT_CHANGES.location, Config::GFX_HACK_VERTEX_ROUDING.location, diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index b1925886e9..191d0a2009 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -1557,16 +1557,12 @@ void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, EFBCopyFormat dstF // // Disadvantage of all methods: Calling this function requires the GPU to perform a pipeline flush // which stalls any further CPU processing. - // - // For historical reasons, Dolphin doesn't actually implement "pure" EFB to RAM emulation, but - // only EFB to texture and hybrid EFB copies. - - bool is_xfb_copy = !is_depth_copy && !isIntensity && dstFormat == EFBCopyFormat::XFB; - - bool copy_to_vram = g_ActiveConfig.backend_info.bSupportsCopyToVram; + const bool is_xfb_copy = !is_depth_copy && !isIntensity && dstFormat == EFBCopyFormat::XFB; + bool copy_to_vram = + g_ActiveConfig.backend_info.bSupportsCopyToVram && !g_ActiveConfig.bDisableCopyToVRAM; bool copy_to_ram = !(is_xfb_copy ? g_ActiveConfig.bSkipXFBCopyToRam : g_ActiveConfig.bSkipEFBCopyToRam) || - !g_ActiveConfig.backend_info.bSupportsCopyToVram; + !copy_to_vram; u8* dst = Memory::GetPointer(dstAddr); if (dst == nullptr) diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index 9a54fedcc9..2a4811eece 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -136,6 +136,7 @@ void VideoConfig::Refresh() bForceProgressive = Config::Get(Config::GFX_HACK_FORCE_PROGRESSIVE); bSkipEFBCopyToRam = Config::Get(Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM); bSkipXFBCopyToRam = Config::Get(Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM); + bDisableCopyToVRAM = Config::Get(Config::GFX_HACK_DISABLE_COPY_TO_VRAM); bImmediateXFB = Config::Get(Config::GFX_HACK_IMMEDIATE_XFB); bCopyEFBScaled = Config::Get(Config::GFX_HACK_COPY_EFB_SCALED); bEFBEmulateFormatChanges = Config::Get(Config::GFX_HACK_EFB_EMULATE_FORMAT_CHANGES); diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h index 0fad4efc72..fb05408303 100644 --- a/Source/Core/VideoCommon/VideoConfig.h +++ b/Source/Core/VideoCommon/VideoConfig.h @@ -118,6 +118,7 @@ struct VideoConfig final bool bEFBEmulateFormatChanges; bool bSkipEFBCopyToRam; bool bSkipXFBCopyToRam; + bool bDisableCopyToVRAM; bool bImmediateXFB; bool bCopyEFBScaled; int iSafeTextureCache_ColorSamples;