GAL: Round the incoming mode parameter in fragment shader

This fixes some letters being randomly boxes and some circles
being randomly triangles on the Mali T760.
This commit is contained in:
Urja Rannikko 2020-07-17 19:26:30 +00:00 committed by Seth Hillbrand
parent 65ceeebc71
commit aa7ab46a06
1 changed files with 8 additions and 4 deletions

View File

@ -354,19 +354,23 @@ float median( vec3 v )
void main() void main()
{ {
if( shaderParams[0] == SHADER_LINE_A ) // VS to FS pipeline does math that means we can't rely on the mode
// parameter being bit-exact without rounding it first.
float mode = floor( shaderParams[0] + 0.5 );
if( mode == SHADER_LINE_A )
{ {
drawLine( gl_TexCoord[0].st ); drawLine( gl_TexCoord[0].st );
} }
else if( shaderParams[0] == SHADER_FILLED_CIRCLE ) else if( mode == SHADER_FILLED_CIRCLE )
{ {
filledCircle( circleCoords ); filledCircle( circleCoords );
} }
else if( shaderParams[0] == SHADER_STROKED_CIRCLE ) else if( mode == SHADER_STROKED_CIRCLE )
{ {
strokedCircle( circleCoords, shaderParams[2], shaderParams[3] ); strokedCircle( circleCoords, shaderParams[2], shaderParams[3] );
} }
else if( shaderParams[0] == SHADER_FONT ) else if( mode == SHADER_FONT )
{ {
vec2 tex = shaderParams.yz; vec2 tex = shaderParams.yz;