diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c index ac36b88117..aea42b8368 100644 --- a/gsk/gl/gskglrenderer.c +++ b/gsk/gl/gskglrenderer.c @@ -282,7 +282,6 @@ struct _GskGLRenderer union { Program programs[GL_N_PROGRAMS]; struct { - Program blend_program; Program blit_program; Program color_program; Program coloring_program; @@ -1965,7 +1964,6 @@ gsk_gl_renderer_create_programs (GskGLRenderer *self, const char *vs; const char *fs; } program_definitions[] = { - { "blend", "blend.vs.glsl", "blend.fs.glsl" }, { "blit", "blit.vs.glsl", "blit.fs.glsl" }, { "color", "blit.vs.glsl", "color.fs.glsl" }, { "coloring", "blit.vs.glsl", "coloring.fs.glsl" }, diff --git a/gsk/gl/gskglrenderopsprivate.h b/gsk/gl/gskglrenderopsprivate.h index 88303f039e..c4bf2b29b9 100644 --- a/gsk/gl/gskglrenderopsprivate.h +++ b/gsk/gl/gskglrenderopsprivate.h @@ -10,7 +10,7 @@ #include "gskglrendererprivate.h" #define GL_N_VERTICES 6 -#define GL_N_PROGRAMS 12 +#define GL_N_PROGRAMS 11 diff --git a/gsk/meson.build b/gsk/meson.build index 9b3db2beac..46c578454b 100644 --- a/gsk/meson.build +++ b/gsk/meson.build @@ -1,6 +1,4 @@ gsk_private_gl_shaders = [ - 'resources/glsl/blend.fs.glsl', - 'resources/glsl/blend.vs.glsl', 'resources/glsl/blit.fs.glsl', 'resources/glsl/blit.vs.glsl', 'resources/glsl/color.fs.glsl', diff --git a/gsk/resources/glsl/blend.fs.glsl b/gsk/resources/glsl/blend.fs.glsl deleted file mode 100644 index d179e447a4..0000000000 --- a/gsk/resources/glsl/blend.fs.glsl +++ /dev/null @@ -1,61 +0,0 @@ -vec3 BlendMultiply(vec3 Cb, vec3 Cs) { - return Cb * Cs; -} - -vec3 BlendScreen(vec3 Cb, vec3 Cs) { - return Cb + Cs - (Cb * Cs); -} - -vec3 BlendHardLight(vec3 Cb, vec3 Cs) { - vec3 m = BlendMultiply(Cb, 2.0 * Cs); - vec3 s = BlendScreen(Cb, 2.0 * Cs - 1.0); - vec3 edge = vec3(0.5, 0.5, 0.5); - - /* Use mix() and step() to avoid a branch */ - return mix(m, s, step(edge, Cs)); -} - -vec3 BlendOverlay(vec3 Cb, vec3 Cs) { - return BlendHardLight(Cs, Cb); -} - -vec3 BlendDarken(vec3 Cb, vec3 Cs) { - return min(Cb, Cs); -} - -vec3 BlendLighten(vec3 Cb, vec3 Cs) { - return max(Cb, Cs); -} - -void main() { - vec4 Cs = Texture(u_source, vUv); - vec4 Cb = Texture(u_mask, vUv); - vec3 res; - - if (uBlendMode == 0) { - res = Cs.xyz; - } - else if (uBlendMode == 1) { - res = BlendMultiply(Cb.xyz, Cs.xyz); - } - else if (uBlendMode == 2) { - res = BlendScreen(Cb.xyz, Cs.xyz); - } - else if (uBlendMode == 3) { - res = BlendOverlay(Cb.xyz, Cs.xyz); - } - else if (uBlendMode == 4) { - res = BlendDarken(Cb.xyz, Cs.xyz); - } - else if (uBlendMode == 5) { - res = BlendLighten(Cb.xyz, Cs.xyz); - } - else if (uBlendMode == 8) { - res = BlendHardLight(Cb.xyz, Cs.xyz); - } - else { - // Use red for debugging missing blend modes - res = vec3(1.0, 0.0, 0.0); - } - setOutputColor(vec4(res, Cs.a) * u_alpha); -} diff --git a/gsk/resources/glsl/blend.vs.glsl b/gsk/resources/glsl/blend.vs.glsl deleted file mode 100644 index 24d8da3c52..0000000000 --- a/gsk/resources/glsl/blend.vs.glsl +++ /dev/null @@ -1,5 +0,0 @@ -void main() { - gl_Position = u_modelview * u_projection * vec4(aPosition, 0.0, 1.0); - - vUv = vec2(aUv.x, aUv.y); -}