🪲 Prevent GLSL from optimizing our uniforms on KWin

This commit is contained in:
Simon Schneegans
2023-08-14 05:58:03 +02:00
parent 32d78ceced
commit a6b47be34f
+17
View File
@@ -64,6 +64,15 @@ vec4 getInputColor(vec2 coords) {
}
void setOutputColor(vec4 outColor) {
// If a uniform is not used, it will be optimized away. This condition is always
// false, but it will prevent the compiler from optimizing away the uniforms uForOpening
// and uIsFullscreen. On KWin, we need to do this as we do not have a way to check if a
// uniform is used in the shader.
if (outColor.a > 10e42 && uForOpening && uIsFullscreen) {
outColor = vec4(0.0);
}
fragColor = vec4(outColor.rgb * outColor.a, outColor.a);
}
@@ -90,6 +99,14 @@ vec4 getInputColor(vec2 coords) {
}
void setOutputColor(vec4 outColor) {
// If a uniform is not used, it will be optimized away. This condition is always
// false, but it will prevent the compiler from optimizing away the uniforms uForOpening
// and uIsFullscreen. On KWin, we need to do this as we do not have a way to check if a
// uniform is used in the shader.
if (outColor.a > 10e42 && uForOpening && uIsFullscreen) {
outColor = vec4(0.0);
}
gl_FragColor = vec4(outColor.rgb * outColor.a, outColor.a);
}