optimize border shader

Do not calculate gradient for discarded fragments
This commit is contained in:
vaxerski 2022-11-27 00:29:51 +00:00
parent b2cb3b8bf2
commit 7699d657d9

View file

@ -55,8 +55,7 @@ void main() {
highp vec2 originalPixCoord = v_texcoord; highp vec2 originalPixCoord = v_texcoord;
originalPixCoord *= fullSizeUntransformed; originalPixCoord *= fullSizeUntransformed;
vec4 pixColor = getColorForCoord(v_texcoord); vec4 pixColor = vec4(1.0, 1.0, 1.0, 1.0);
pixColor[3] *= alpha;
bool done = false; bool done = false;
@ -112,6 +111,9 @@ void main() {
if (pixColor[3] == 0.0) if (pixColor[3] == 0.0)
discard; discard;
pixColor = getColorForCoord(v_texcoord) * pixColor[3];
pixColor[3] *= alpha;
gl_FragColor = pixColor; gl_FragColor = pixColor;
} }
)#"; )#";