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.

(cherry picked from commit aa7ab46a06)
This commit is contained in:
Urja Rannikko 2020-07-17 19:26:30 +00:00 committed by Seth Hillbrand
parent fd55b7b4ed
commit 709197c294
1 changed files with 8 additions and 4 deletions

View File

@ -361,19 +361,23 @@ float median( vec3 v )
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 );
}
else if( shaderParams[0] == SHADER_FILLED_CIRCLE )
else if( mode == SHADER_FILLED_CIRCLE )
{
filledCircle( circleCoords );
}
else if( shaderParams[0] == SHADER_STROKED_CIRCLE )
else if( mode == SHADER_STROKED_CIRCLE )
{
strokedCircle( circleCoords, shaderParams[2], shaderParams[3] );
}
else if( shaderParams[0] == SHADER_FONT )
else if( mode == SHADER_FONT )
{
vec2 tex = shaderParams.yz;