Workaround qualcomm driver bug
It seems it doesn't like modifying inout variables in place - so instead use a temporary for ocol0/ocol1 and only write them once at the end of the shader
This commit is contained in:
parent
29a9ed043b
commit
8d68adcaf3
|
@ -890,7 +890,7 @@ void ProgramShaderCache::CreateHeader()
|
||||||
{
|
{
|
||||||
case ES_FB_FETCH_TYPE::FB_FETCH_EXT:
|
case ES_FB_FETCH_TYPE::FB_FETCH_EXT:
|
||||||
framebuffer_fetch_string = "#extension GL_EXT_shader_framebuffer_fetch: enable\n"
|
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";
|
"#define FRAGMENT_INOUT inout";
|
||||||
break;
|
break;
|
||||||
case ES_FB_FETCH_TYPE::FB_FETCH_ARM:
|
case ES_FB_FETCH_TYPE::FB_FETCH_ARM:
|
||||||
|
|
|
@ -556,13 +556,17 @@ ShaderCode GeneratePixelShaderCode(APIType ApiType, const ShaderHostConfig& host
|
||||||
}
|
}
|
||||||
else if (use_shader_blend)
|
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))
|
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
|
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
|
else
|
||||||
|
@ -609,6 +613,8 @@ ShaderCode GeneratePixelShaderCode(APIType ApiType, const ShaderHostConfig& host
|
||||||
{
|
{
|
||||||
// Store off a copy of the initial fb value for blending
|
// Store off a copy of the initial fb value for blending
|
||||||
out.Write("\tfloat4 initial_ocol0 = FB_FETCH_VALUE;\n");
|
out.Write("\tfloat4 initial_ocol0 = FB_FETCH_VALUE;\n");
|
||||||
|
out.Write("\tfloat4 ocol0;\n");
|
||||||
|
out.Write("\tfloat4 ocol1;\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // D3D
|
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("\tfloat4 blend_result = ocol0;\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
out.Write("\tocol0 = blend_result;\n");
|
out.Write("\treal_ocol0 = blend_result;\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue