shaders: minor premultiplication fixes

This commit is contained in:
Vaxry 2023-08-18 22:07:28 +02:00
parent 37a211a2ae
commit 3d9545d2e0
2 changed files with 6 additions and 5 deletions

View file

@ -109,11 +109,14 @@ void main() {
discard; discard;
} }
if (pixColor[3] == 0.0) if (additionalAlpha == 0.0)
discard; discard;
pixColor = getColorForCoord(v_texcoord); pixColor = getColorForCoord(v_texcoord);
pixColor.rgb *= pixColor[3];
gl_FragColor = pixColor * alpha * additionalAlpha; pixColor *= alpha * additionalAlpha;
gl_FragColor = pixColor;
} }
)#"; )#";

View file

@ -79,9 +79,7 @@ void main() {
} }
// premultiply // premultiply
pixColor[0] *= pixColor[3]; pixColor.rgb *= pixColor[3];
pixColor[1] *= pixColor[3];
pixColor[2] *= pixColor[3];
gl_FragColor = pixColor; gl_FragColor = pixColor;
})#"; })#";