diff --git a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp index 54b5c87100..3cca33fe77 100644 --- a/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp +++ b/Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp @@ -890,7 +890,7 @@ void ProgramShaderCache::CreateHeader() { case ES_FB_FETCH_TYPE::FB_FETCH_EXT: framebuffer_fetch_string = "#extension GL_EXT_shader_framebuffer_fetch: enable\n" - "#define FB_FETCH_VALUE ocol0\n" + "#define FB_FETCH_VALUE real_ocol0\n" "#define FRAGMENT_INOUT inout"; break; case ES_FB_FETCH_TYPE::FB_FETCH_ARM: diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp index 1a427b70d0..f8c79af91e 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/PixelShaderGen.cpp @@ -556,13 +556,17 @@ ShaderCode GeneratePixelShaderCode(APIType ApiType, const ShaderHostConfig& host } else if (use_shader_blend) { + // QComm's Adreno driver doesn't seem to like using the framebuffer_fetch value as an + // intermediate value with multiple reads & modifications, so pull out the "real" output value + // and use a temporary for calculations, then set the output value once at the end of the + // shader if (DriverDetails::HasBug(DriverDetails::BUG_BROKEN_FRAGMENT_SHADER_INDEX_DECORATION)) { - out.Write("FRAGMENT_OUTPUT_LOCATION(0) FRAGMENT_INOUT vec4 ocol0;\n"); + out.Write("FRAGMENT_OUTPUT_LOCATION(0) FRAGMENT_INOUT vec4 real_ocol0;\n"); } else { - out.Write("FRAGMENT_OUTPUT_LOCATION_INDEXED(0, 0) FRAGMENT_INOUT vec4 ocol0;\n"); + out.Write("FRAGMENT_OUTPUT_LOCATION_INDEXED(0, 0) FRAGMENT_INOUT vec4 real_ocol0;\n"); } } else @@ -609,6 +613,8 @@ ShaderCode GeneratePixelShaderCode(APIType ApiType, const ShaderHostConfig& host { // Store off a copy of the initial fb value for blending out.Write("\tfloat4 initial_ocol0 = FB_FETCH_VALUE;\n"); + out.Write("\tfloat4 ocol0;\n"); + out.Write("\tfloat4 ocol1;\n"); } } else // D3D @@ -1472,5 +1478,5 @@ static void WriteBlend(ShaderCode& out, const pixel_shader_uid_data* uid_data) out.Write("\tfloat4 blend_result = ocol0;\n"); } - out.Write("\tocol0 = blend_result;\n"); + out.Write("\treal_ocol0 = blend_result;\n"); }