From 82fd984f3e53f430af6f043d3062c883bb308634 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 27 Nov 2016 18:14:57 +1000 Subject: [PATCH] VideoBackends: Add configuration field for GPU texture decoding --- Source/Core/DolphinWX/VideoConfigDiag.cpp | 13 +++++++++++++ Source/Core/VideoBackends/D3D/main.cpp | 1 + Source/Core/VideoBackends/D3D12/main.cpp | 1 + Source/Core/VideoBackends/Null/NullBackend.cpp | 1 + Source/Core/VideoBackends/OGL/main.cpp | 1 + Source/Core/VideoBackends/Software/SWmain.cpp | 1 + Source/Core/VideoBackends/Vulkan/VulkanContext.cpp | 1 + Source/Core/VideoCommon/VideoConfig.cpp | 2 ++ Source/Core/VideoCommon/VideoConfig.h | 6 ++++++ 9 files changed, 27 insertions(+) diff --git a/Source/Core/DolphinWX/VideoConfigDiag.cpp b/Source/Core/DolphinWX/VideoConfigDiag.cpp index fd6db1942c..49a004b73c 100644 --- a/Source/Core/DolphinWX/VideoConfigDiag.cpp +++ b/Source/Core/DolphinWX/VideoConfigDiag.cpp @@ -284,6 +284,10 @@ static wxString true_color_desc = wxTRANSLATE("Forces the game to render the RGB color channels in 24-bit, thereby increasing " "quality by reducing color banding.\nIt has no impact on performance and causes " "few graphical issues.\n\n\nIf unsure, leave this checked."); +static wxString gpu_texture_decoding_desc = + wxTRANSLATE("Enables texture decoding using the GPU instead of the CPU. This may result in " + "performance gains in some scenarios, or systems where the CPU is the bottleneck." + "\n\nIf unsure, leave this unchecked."); #if !defined(__APPLE__) // Search for available resolutions - TODO: Move to Common? @@ -755,6 +759,15 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title) slide_szr->Add(new wxStaticText(page_hacks, wxID_ANY, _("Fast")), 0, wxALIGN_CENTER_VERTICAL); szr_safetex->Add(slide_szr, 1, wxEXPAND | wxLEFT | wxRIGHT, space5); + + if (vconfig.backend_info.bSupportsGPUTextureDecoding) + { + szr_safetex->Add(CreateCheckBox(page_hacks, _("GPU Texture Decoding"), + wxGetTranslation(gpu_texture_decoding_desc), + vconfig.bEnableGPUTextureDecoding), + 1, wxEXPAND | wxLEFT | wxRIGHT, space5); + } + if (slider_pos == -1) { stc_slider->Disable(); diff --git a/Source/Core/VideoBackends/D3D/main.cpp b/Source/Core/VideoBackends/D3D/main.cpp index 71e082c314..bc0af68180 100644 --- a/Source/Core/VideoBackends/D3D/main.cpp +++ b/Source/Core/VideoBackends/D3D/main.cpp @@ -76,6 +76,7 @@ void VideoBackend::InitBackendInfo() g_Config.backend_info.bSupportsReversedDepthRange = false; g_Config.backend_info.bSupportsMultithreading = false; g_Config.backend_info.bSupportsInternalResolutionFrameDumps = false; + g_Config.backend_info.bSupportsGPUTextureDecoding = false; IDXGIFactory* factory; IDXGIAdapter* ad; diff --git a/Source/Core/VideoBackends/D3D12/main.cpp b/Source/Core/VideoBackends/D3D12/main.cpp index d337515268..2c95bff055 100644 --- a/Source/Core/VideoBackends/D3D12/main.cpp +++ b/Source/Core/VideoBackends/D3D12/main.cpp @@ -79,6 +79,7 @@ void VideoBackend::InitBackendInfo() g_Config.backend_info.bSupportsReversedDepthRange = false; g_Config.backend_info.bSupportsMultithreading = false; g_Config.backend_info.bSupportsInternalResolutionFrameDumps = false; + g_Config.backend_info.bSupportsGPUTextureDecoding = false; IDXGIFactory* factory; IDXGIAdapter* ad; diff --git a/Source/Core/VideoBackends/Null/NullBackend.cpp b/Source/Core/VideoBackends/Null/NullBackend.cpp index 38c33c4603..60a6f637ac 100644 --- a/Source/Core/VideoBackends/Null/NullBackend.cpp +++ b/Source/Core/VideoBackends/Null/NullBackend.cpp @@ -44,6 +44,7 @@ void VideoBackend::InitBackendInfo() g_Config.backend_info.bSupportsReversedDepthRange = true; g_Config.backend_info.bSupportsMultithreading = false; g_Config.backend_info.bSupportsInternalResolutionFrameDumps = false; + g_Config.backend_info.bSupportsGPUTextureDecoding = false; // aamodes: We only support 1 sample, so no MSAA g_Config.backend_info.Adapters.clear(); diff --git a/Source/Core/VideoBackends/OGL/main.cpp b/Source/Core/VideoBackends/OGL/main.cpp index 539b43cd51..80cca3babd 100644 --- a/Source/Core/VideoBackends/OGL/main.cpp +++ b/Source/Core/VideoBackends/OGL/main.cpp @@ -108,6 +108,7 @@ void VideoBackend::InitBackendInfo() g_Config.backend_info.bSupportsReversedDepthRange = true; g_Config.backend_info.bSupportsMultithreading = false; g_Config.backend_info.bSupportsInternalResolutionFrameDumps = true; + g_Config.backend_info.bSupportsGPUTextureDecoding = false; // Overwritten in Render.cpp later g_Config.backend_info.bSupportsDualSourceBlend = true; diff --git a/Source/Core/VideoBackends/Software/SWmain.cpp b/Source/Core/VideoBackends/Software/SWmain.cpp index 668ee4b73a..eb70f4059f 100644 --- a/Source/Core/VideoBackends/Software/SWmain.cpp +++ b/Source/Core/VideoBackends/Software/SWmain.cpp @@ -133,6 +133,7 @@ void VideoSoftware::InitBackendInfo() g_Config.backend_info.bSupportsMultithreading = false; g_Config.backend_info.bSupportsComputeShaders = false; g_Config.backend_info.bSupportsInternalResolutionFrameDumps = false; + g_Config.backend_info.bSupportsGPUTextureDecoding = false; // aamodes g_Config.backend_info.AAModes = {1}; diff --git a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp index 7ca0618fee..ae5a6f2bda 100644 --- a/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp +++ b/Source/Core/VideoBackends/Vulkan/VulkanContext.cpp @@ -245,6 +245,7 @@ void VulkanContext::PopulateBackendInfo(VideoConfig* config) config->backend_info.bSupportsDepthClamp = false; // Dependent on features. config->backend_info.bSupportsReversedDepthRange = false; // No support yet due to driver bugs. config->backend_info.bSupportsComputeShaders = false; // No support yet. + config->backend_info.bSupportsGPUTextureDecoding = false; // No support yet. } void VulkanContext::PopulateBackendInfoAdapters(VideoConfig* config, const GPUList& gpu_list) diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index 7579c90c6e..08b814fd28 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -81,6 +81,7 @@ void VideoConfig::Load(const std::string& ini_file) settings->Get("DumpPath", &sDumpPath, ""); settings->Get("BitrateKbps", &iBitrateKbps, 2500); settings->Get("InternalResolutionFrameDumps", &bInternalResolutionFrameDumps, false); + settings->Get("EnableGPUTextureDecoding", &bEnableGPUTextureDecoding, false); settings->Get("EnablePixelLighting", &bEnablePixelLighting, false); settings->Get("FastDepthCalc", &bFastDepthCalc, true); settings->Get("MSAA", &iMultisamples, 1); @@ -305,6 +306,7 @@ void VideoConfig::Save(const std::string& ini_file) settings->Set("DumpPath", sDumpPath); settings->Set("BitrateKbps", iBitrateKbps); settings->Set("InternalResolutionFrameDumps", bInternalResolutionFrameDumps); + settings->Set("EnableGPUTextureDecoding", bEnableGPUTextureDecoding); settings->Set("EnablePixelLighting", bEnablePixelLighting); settings->Set("FastDepthCalc", bFastDepthCalc); settings->Set("MSAA", iMultisamples); diff --git a/Source/Core/VideoCommon/VideoConfig.h b/Source/Core/VideoCommon/VideoConfig.h index aaabef5963..c70cf104c8 100644 --- a/Source/Core/VideoCommon/VideoConfig.h +++ b/Source/Core/VideoCommon/VideoConfig.h @@ -108,6 +108,7 @@ struct VideoConfig final bool bInternalResolutionFrameDumps; bool bFreeLook; bool bBorderlessFullscreen; + bool bEnableGPUTextureDecoding; int iBitrateKbps; // Hacks @@ -196,6 +197,7 @@ struct VideoConfig final bool bSupportsReversedDepthRange; bool bSupportsMultithreading; bool bSupportsInternalResolutionFrameDumps; + bool bSupportsGPUTextureDecoding; } backend_info; // Utility @@ -211,6 +213,10 @@ struct VideoConfig final return false; return backend_info.bSupportsBBox && backend_info.bSupportsFragmentStoresAndAtomics; } + bool UseGPUTextureDecoding() const + { + return backend_info.bSupportsGPUTextureDecoding && bEnableGPUTextureDecoding; + } }; extern VideoConfig g_Config;