From 82c27182a8a15903a0082890e6b188435ec957b4 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 24 Jun 2017 18:18:53 +1000 Subject: ShaderGen: Remove host state from shader uids --- Source/Core/VideoCommon/VideoConfig.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'Source/Core/VideoCommon/VideoConfig.cpp') diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index 7dc68abb72..d53e903cee 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -187,3 +187,19 @@ bool VideoConfig::IsVSync() { return bVSync && !Core::GetIsThrottlerTempDisabled(); } + +bool VideoConfig::IsStereoEnabled() const +{ + return iStereoMode > 0; +} + +bool VideoConfig::IsMSAAEnabled() const +{ + return iMultisamples > 1; +} + +bool VideoConfig::IsSSAAEnabled() const +{ + return iMultisamples > 1 && bSSAA && backend_info.bSupportsSSAA; +} + -- cgit v1.2.3 From d1381f5021815c36d2fdd98087b6522c995428cc Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 24 Jun 2017 18:55:08 +1000 Subject: VideoConfig: Add host config union Contains all host state that can affect shadergen. --- Source/Core/VideoCommon/VideoConfig.cpp | 58 +++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'Source/Core/VideoCommon/VideoConfig.cpp') diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index d53e903cee..78784c5c9c 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -5,6 +5,7 @@ #include #include "Common/CommonTypes.h" +#include "Common/StringUtil.h" #include "Core/Config/GraphicsSettings.h" #include "Core/Core.h" #include "Core/Movie.h" @@ -203,3 +204,60 @@ bool VideoConfig::IsSSAAEnabled() const return iMultisamples > 1 && bSSAA && backend_info.bSupportsSSAA; } +union HostConfigBits +{ + u32 bits; + + struct + { + u32 msaa : 1; + u32 ssaa : 1; + u32 stereo : 1; + u32 wireframe : 1; + u32 per_pixel_lighting : 1; + u32 vertex_rounding : 1; + u32 fast_depth_calc : 1; + u32 bounding_box : 1; + u32 backend_dual_source_blend : 1; + u32 backend_geometry_shaders : 1; + u32 backend_early_z : 1; + u32 backend_bbox : 1; + u32 backend_gs_instancing : 1; + u32 backend_clip_control : 1; + u32 backend_ssaa : 1; + u32 backend_atomics : 1; + u32 backend_depth_clamp : 1; + u32 backend_reversed_depth_range : 1; + u32 pad : 14; + }; +}; + +u32 VideoConfig::GetHostConfigBits() const +{ + HostConfigBits bits = {}; + bits.msaa = IsMSAAEnabled(); + bits.ssaa = IsSSAAEnabled(); + bits.stereo = IsStereoEnabled(); + bits.wireframe = bWireFrame; + bits.per_pixel_lighting = bEnablePixelLighting; + bits.vertex_rounding = UseVertexRounding(); + bits.fast_depth_calc = bFastDepthCalc; + bits.bounding_box = bBBoxEnable; + bits.backend_dual_source_blend = backend_info.bSupportsDualSourceBlend; + bits.backend_geometry_shaders = backend_info.bSupportsGeometryShaders; + bits.backend_early_z = backend_info.bSupportsEarlyZ; + bits.backend_bbox = backend_info.bSupportsBBox; + bits.backend_gs_instancing = backend_info.bSupportsGSInstancing; + bits.backend_clip_control = backend_info.bSupportsClipControl; + bits.backend_ssaa = backend_info.bSupportsSSAA; + bits.backend_atomics = backend_info.bSupportsFragmentStoresAndAtomics; + bits.backend_depth_clamp = backend_info.bSupportsDepthClamp; + bits.backend_reversed_depth_range = backend_info.bSupportsReversedDepthRange; + return bits.bits; +} + +std::string VideoConfig::GetHostConfigFilename() const +{ + u32 bits = GetHostConfigBits(); + return StringFromFormat("%08X", bits); +} -- cgit v1.2.3 From d01b0bf60fba2101e45cfac1e5747edcdbab5fc1 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 19 Jul 2017 20:35:17 +1000 Subject: VideoCommon: Move shader cache filename generation to common --- Source/Core/VideoCommon/VideoConfig.cpp | 42 ++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'Source/Core/VideoCommon/VideoConfig.cpp') diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index 78784c5c9c..86cd38bfd8 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -4,9 +4,12 @@ #include +#include "Common/CommonPaths.h" #include "Common/CommonTypes.h" +#include "Common/FileUtil.h" #include "Common/StringUtil.h" #include "Core/Config/GraphicsSettings.h" +#include "Core/ConfigManager.h" #include "Core/Core.h" #include "Core/Movie.h" #include "VideoCommon/OnScreenDisplay.h" @@ -256,8 +259,41 @@ u32 VideoConfig::GetHostConfigBits() const return bits.bits; } -std::string VideoConfig::GetHostConfigFilename() const +std::string VideoConfig::GetDiskCacheFileName(APIType api_type, const char* type, + bool include_gameid, bool include_host_config) const { - u32 bits = GetHostConfigBits(); - return StringFromFormat("%08X", bits); + if (!File::Exists(File::GetUserPath(D_SHADERCACHE_IDX))) + File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX)); + + std::string filename = File::GetUserPath(D_SHADERCACHE_IDX); + switch (api_type) + { + case APIType::D3D: + filename += "D3D"; + break; + case APIType::OpenGL: + filename += "OpenGL"; + break; + case APIType::Vulkan: + filename += "Vulkan"; + break; + } + + filename += '-'; + filename += type; + + if (include_gameid) + { + filename += '-'; + filename += SConfig::GetInstance().GetGameID(); + } + + if (include_host_config) + { + // We're using 18 bits, so 5 hex characters. + filename += StringFromFormat("-%05X", GetHostConfigBits()); + } + + filename += ".cache"; + return filename; } -- cgit v1.2.3 From 3ea9d86faa2544b8c1c235db9456f271baf42fec Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 20 Jul 2017 17:10:02 +1000 Subject: ShaderGen: Pass host config to shader generation functions Also moves the host config checks to common. --- Source/Core/VideoCommon/VideoConfig.cpp | 109 -------------------------------- 1 file changed, 109 deletions(-) (limited to 'Source/Core/VideoCommon/VideoConfig.cpp') diff --git a/Source/Core/VideoCommon/VideoConfig.cpp b/Source/Core/VideoCommon/VideoConfig.cpp index 86cd38bfd8..355d2486b4 100644 --- a/Source/Core/VideoCommon/VideoConfig.cpp +++ b/Source/Core/VideoCommon/VideoConfig.cpp @@ -4,12 +4,9 @@ #include -#include "Common/CommonPaths.h" #include "Common/CommonTypes.h" -#include "Common/FileUtil.h" #include "Common/StringUtil.h" #include "Core/Config/GraphicsSettings.h" -#include "Core/ConfigManager.h" #include "Core/Core.h" #include "Core/Movie.h" #include "VideoCommon/OnScreenDisplay.h" @@ -191,109 +188,3 @@ bool VideoConfig::IsVSync() { return bVSync && !Core::GetIsThrottlerTempDisabled(); } - -bool VideoConfig::IsStereoEnabled() const -{ - return iStereoMode > 0; -} - -bool VideoConfig::IsMSAAEnabled() const -{ - return iMultisamples > 1; -} - -bool VideoConfig::IsSSAAEnabled() const -{ - return iMultisamples > 1 && bSSAA && backend_info.bSupportsSSAA; -} - -union HostConfigBits -{ - u32 bits; - - struct - { - u32 msaa : 1; - u32 ssaa : 1; - u32 stereo : 1; - u32 wireframe : 1; - u32 per_pixel_lighting : 1; - u32 vertex_rounding : 1; - u32 fast_depth_calc : 1; - u32 bounding_box : 1; - u32 backend_dual_source_blend : 1; - u32 backend_geometry_shaders : 1; - u32 backend_early_z : 1; - u32 backend_bbox : 1; - u32 backend_gs_instancing : 1; - u32 backend_clip_control : 1; - u32 backend_ssaa : 1; - u32 backend_atomics : 1; - u32 backend_depth_clamp : 1; - u32 backend_reversed_depth_range : 1; - u32 pad : 14; - }; -}; - -u32 VideoConfig::GetHostConfigBits() const -{ - HostConfigBits bits = {}; - bits.msaa = IsMSAAEnabled(); - bits.ssaa = IsSSAAEnabled(); - bits.stereo = IsStereoEnabled(); - bits.wireframe = bWireFrame; - bits.per_pixel_lighting = bEnablePixelLighting; - bits.vertex_rounding = UseVertexRounding(); - bits.fast_depth_calc = bFastDepthCalc; - bits.bounding_box = bBBoxEnable; - bits.backend_dual_source_blend = backend_info.bSupportsDualSourceBlend; - bits.backend_geometry_shaders = backend_info.bSupportsGeometryShaders; - bits.backend_early_z = backend_info.bSupportsEarlyZ; - bits.backend_bbox = backend_info.bSupportsBBox; - bits.backend_gs_instancing = backend_info.bSupportsGSInstancing; - bits.backend_clip_control = backend_info.bSupportsClipControl; - bits.backend_ssaa = backend_info.bSupportsSSAA; - bits.backend_atomics = backend_info.bSupportsFragmentStoresAndAtomics; - bits.backend_depth_clamp = backend_info.bSupportsDepthClamp; - bits.backend_reversed_depth_range = backend_info.bSupportsReversedDepthRange; - return bits.bits; -} - -std::string VideoConfig::GetDiskCacheFileName(APIType api_type, const char* type, - bool include_gameid, bool include_host_config) const -{ - if (!File::Exists(File::GetUserPath(D_SHADERCACHE_IDX))) - File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX)); - - std::string filename = File::GetUserPath(D_SHADERCACHE_IDX); - switch (api_type) - { - case APIType::D3D: - filename += "D3D"; - break; - case APIType::OpenGL: - filename += "OpenGL"; - break; - case APIType::Vulkan: - filename += "Vulkan"; - break; - } - - filename += '-'; - filename += type; - - if (include_gameid) - { - filename += '-'; - filename += SConfig::GetInstance().GetGameID(); - } - - if (include_host_config) - { - // We're using 18 bits, so 5 hex characters. - filename += StringFromFormat("-%05X", GetHostConfigBits()); - } - - filename += ".cache"; - return filename; -} -- cgit v1.2.3