diff options
| author | TellowKrinkle <tellowkrinkle@gmail.com> | 2022-06-11 21:03:09 -0500 |
|---|---|---|
| committer | TellowKrinkle <tellowkrinkle@gmail.com> | 2022-07-13 21:51:24 -0500 |
| commit | 6ab24e6c176bfd288296bf8284a30b0835fa45c3 (patch) | |
| tree | a35536d212d2cc22777672454e84cc883883c46e /Source/Core/VideoCommon/UberShaderPixel.cpp | |
| parent | 99eef447651d40ed1954ccd5a83557478546face (diff) | |
VideoCommon: Better driver bug handling
Adds a pass to process driver deficiencies between UID caching and use, allowing a full view of the whole pipeline, since some bugs/workarounds involve interactions between blend modes and the pixel shader
Diffstat (limited to 'Source/Core/VideoCommon/UberShaderPixel.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/UberShaderPixel.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/UberShaderPixel.cpp b/Source/Core/VideoCommon/UberShaderPixel.cpp index 024b49ddfa..8b89b045e8 100644 --- a/Source/Core/VideoCommon/UberShaderPixel.cpp +++ b/Source/Core/VideoCommon/UberShaderPixel.cpp @@ -21,12 +21,12 @@ PixelShaderUid GetPixelShaderUid() pixel_ubershader_uid_data* const uid_data = out.GetUidData(); uid_data->num_texgens = xfmem.numTexGen.numTexGens; - uid_data->early_depth = bpmem.UseEarlyDepthTest() && + uid_data->early_depth = bpmem.GetEmulatedZ() == EmulatedZ::Early && (g_ActiveConfig.bFastDepthCalc || bpmem.alpha_test.TestResult() == AlphaTestResult::Undetermined) && !(bpmem.zmode.testenable && bpmem.genMode.zfreeze); uid_data->per_pixel_depth = - (bpmem.ztex2.op != ZTexOp::Disabled && bpmem.UseLateDepthTest()) || + (bpmem.ztex2.op != ZTexOp::Disabled && bpmem.GetEmulatedZ() == EmulatedZ::Late) || (!g_ActiveConfig.bFastDepthCalc && bpmem.zmode.testenable && !uid_data->early_depth) || (bpmem.zmode.testenable && bpmem.genMode.zfreeze); uid_data->uint_output = bpmem.blendmode.UseLogicOp(); @@ -39,6 +39,10 @@ void ClearUnusedPixelShaderUidBits(APIType api_type, const ShaderHostConfig& hos { pixel_ubershader_uid_data* const uid_data = uid->GetUidData(); + // Dual source is always enabled in the shader if this bug is not present + if (!DriverDetails::HasBug(DriverDetails::BUG_BROKEN_DUAL_SOURCE_BLENDING)) + uid_data->no_dual_src = 0; + // OpenGL and Vulkan convert implicitly normalized color outputs to their uint representation. // Therefore, it is not necessary to use a uint output on these backends. We also disable the // uint output when logic op is not supported (i.e. driver/device does not support D3D11.1). @@ -53,8 +57,9 @@ ShaderCode GenPixelShader(APIType api_type, const ShaderHostConfig& host_config, const bool msaa = host_config.msaa; const bool ssaa = host_config.ssaa; const bool stereo = host_config.stereo; - const bool use_dual_source = host_config.backend_dual_source_blend; - const bool use_shader_blend = !use_dual_source && host_config.backend_shader_framebuffer_fetch; + const bool use_dual_source = host_config.backend_dual_source_blend && !uid_data->no_dual_src; + const bool use_shader_blend = !host_config.backend_dual_source_blend && + host_config.backend_shader_framebuffer_fetch; const bool use_shader_logic_op = !host_config.backend_logic_op && host_config.backend_shader_framebuffer_fetch; const bool use_framebuffer_fetch = @@ -1273,7 +1278,11 @@ void EnumeratePixelShaderUids(const std::function<void(const PixelShaderUid&)>& for (u32 uint_output = 0; uint_output < 2; uint_output++) { puid->uint_output = uint_output; - callback(uid); + for (u32 no_dual_src = 0; no_dual_src < 2; no_dual_src++) + { + puid->no_dual_src = no_dual_src; + callback(uid); + } } } } |
