diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp index a5133023af6a..55f269881277 100644 --- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp +++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp @@ -135,6 +135,8 @@ void SHADER::SetProgramBindings(bool is_compute) // So we do support extended blending // So we need to set a few more things here. // Bind our out locations + // Note: on macOS, this can cause graphical issues if ocol1 exists in the fragment shader but + // we're not actually doing dual-source blending. glBindFragDataLocationIndexed(glprogid, 0, 0, "ocol0"); glBindFragDataLocationIndexed(glprogid, 0, 1, "ocol1"); } diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp index 0ccfb09679c6..52e6468b1a12 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/PixelShaderGen.cpp @@ -16,6 +16,7 @@ #include "VideoCommon/DriverDetails.h" #include "VideoCommon/LightingShaderGen.h" #include "VideoCommon/NativeVertexFormat.h" +#include "VideoCommon/RenderState.h" #include "VideoCommon/VertexLoaderManager.h" #include "VideoCommon/VideoCommon.h" #include "VideoCommon/VideoConfig.h" @@ -177,6 +178,11 @@ PixelShaderUid GetPixelShaderUid() uid_data->dither = bpmem.blendmode.dither && uid_data->rgba6_format; uid_data->uint_output = bpmem.blendmode.UseLogicOp(); + BlendingState state{}; + state.Generate(bpmem); + uid_data->blendEnable = state.blendenable; + uid_data->useDualSource = state.usedualsrc; + u32 numStages = uid_data->genMode_numtevstages + 1; const bool forced_early_z = @@ -516,7 +522,7 @@ ShaderCode GeneratePixelShaderCode(APIType ApiType, const ShaderHostConfig& host // Only use dual-source blending when required on drivers that don't support it very well. const bool use_dual_source = - host_config.backend_dual_source_blend && + uid_data->blendEnable && uid_data->useDualSource && host_config.backend_dual_source_blend && (!DriverDetails::HasBug(DriverDetails::BUG_BROKEN_DUAL_SOURCE_BLENDING) || uid_data->useDstAlpha); diff --git a/Source/Core/VideoCommon/PixelShaderGen.h b/Source/Core/VideoCommon/PixelShaderGen.h index b480777c41a0..d98cb107ab12 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.h +++ b/Source/Core/VideoCommon/PixelShaderGen.h @@ -44,7 +44,9 @@ struct pixel_shader_uid_data u32 rgba6_format : 1; u32 dither : 1; u32 uint_output : 1; - u32 pad : 15; + u32 blendEnable : 1; + u32 useDualSource : 1; + u32 pad : 13; u32 texMtxInfo_n_projection : 8; // 8x1 bit u32 tevindref_bi0 : 3;