🔧 Convert window texture alpha from premultiplied to straight
This commit is contained in:
+6
-1
@@ -213,7 +213,7 @@ if (utils.isInShellProcess()) {
|
||||
freeShaders.push(this);
|
||||
}
|
||||
|
||||
// This is called by the constructor. This is means it's only called when the effect
|
||||
// This is called by the constructor. This means, it's only called when the effect
|
||||
// is used for the first time.
|
||||
vfunc_build_pipeline() {
|
||||
const declarations = `
|
||||
@@ -277,6 +277,11 @@ if (utils.isInShellProcess()) {
|
||||
cogl_color_out = texture2D(uTexture, coords);
|
||||
}
|
||||
}
|
||||
|
||||
// Shell.GLSLEffect uses straight alpha. So we have to convert from premultiplied.
|
||||
if (cogl_color_out.a > 0) {
|
||||
cogl_color_out.rgb /= cogl_color_out.a;
|
||||
}
|
||||
`;
|
||||
|
||||
this.add_glsl_snippet(Shell.SnippetHook.FRAGMENT, declarations, code, true);
|
||||
|
||||
Reference in New Issue
Block a user