vulkan: Rename blendmode to blend-mode
authorBenjamin Otte <otte@redhat.com>
Tue, 27 Jun 2023 04:05:33 +0000 (06:05 +0200)
committerBenjamin Otte <otte@redhat.com>
Tue, 27 Jun 2023 04:46:57 +0000 (06:46 +0200)
Preparation for future changes, nothing to see here.

18 files changed:
gsk/vulkan/gskvulkanrender.c
gsk/vulkan/resources/blend-mode-clip-rounded.frag.spv [new file with mode: 0644]
gsk/vulkan/resources/blend-mode-clip-rounded.vert.spv [new file with mode: 0644]
gsk/vulkan/resources/blend-mode-clip.frag.spv [new file with mode: 0644]
gsk/vulkan/resources/blend-mode-clip.vert.spv [new file with mode: 0644]
gsk/vulkan/resources/blend-mode.frag [new file with mode: 0644]
gsk/vulkan/resources/blend-mode.frag.spv [new file with mode: 0644]
gsk/vulkan/resources/blend-mode.vert [new file with mode: 0644]
gsk/vulkan/resources/blend-mode.vert.spv [new file with mode: 0644]
gsk/vulkan/resources/blendmode-clip-rounded.frag.spv [deleted file]
gsk/vulkan/resources/blendmode-clip-rounded.vert.spv [deleted file]
gsk/vulkan/resources/blendmode-clip.frag.spv [deleted file]
gsk/vulkan/resources/blendmode-clip.vert.spv [deleted file]
gsk/vulkan/resources/blendmode.frag [deleted file]
gsk/vulkan/resources/blendmode.frag.spv [deleted file]
gsk/vulkan/resources/blendmode.vert [deleted file]
gsk/vulkan/resources/blendmode.vert.spv [deleted file]
gsk/vulkan/resources/meson.build

index 8f39b7a78c68f7aa627c31eeb11088e0a4e1697f..16b08f32b7cb4c8ce0ecf645982dfd8a6ac34542 100644 (file)
@@ -421,9 +421,9 @@ gsk_vulkan_render_get_pipeline (GskVulkanRender       *self,
     { "crossfade",                  2, gsk_vulkan_cross_fade_pipeline_new },
     { "crossfade-clip",             2, gsk_vulkan_cross_fade_pipeline_new },
     { "crossfade-clip-rounded",     2, gsk_vulkan_cross_fade_pipeline_new },
-    { "blendmode",                  2, gsk_vulkan_blend_mode_pipeline_new },
-    { "blendmode-clip",             2, gsk_vulkan_blend_mode_pipeline_new },
-    { "blendmode-clip-rounded",     2, gsk_vulkan_blend_mode_pipeline_new },
+    { "blend-mode",                 2, gsk_vulkan_blend_mode_pipeline_new },
+    { "blend-mode-clip",            2, gsk_vulkan_blend_mode_pipeline_new },
+    { "blend-mode-clip-rounded",    2, gsk_vulkan_blend_mode_pipeline_new },
   };
 
   g_return_val_if_fail (type < GSK_VULKAN_N_PIPELINES, NULL);
diff --git a/gsk/vulkan/resources/blend-mode-clip-rounded.frag.spv b/gsk/vulkan/resources/blend-mode-clip-rounded.frag.spv
new file mode 100644 (file)
index 0000000..b1f01de
Binary files /dev/null and b/gsk/vulkan/resources/blend-mode-clip-rounded.frag.spv differ
diff --git a/gsk/vulkan/resources/blend-mode-clip-rounded.vert.spv b/gsk/vulkan/resources/blend-mode-clip-rounded.vert.spv
new file mode 100644 (file)
index 0000000..13f49e7
Binary files /dev/null and b/gsk/vulkan/resources/blend-mode-clip-rounded.vert.spv differ
diff --git a/gsk/vulkan/resources/blend-mode-clip.frag.spv b/gsk/vulkan/resources/blend-mode-clip.frag.spv
new file mode 100644 (file)
index 0000000..5fae3d4
Binary files /dev/null and b/gsk/vulkan/resources/blend-mode-clip.frag.spv differ
diff --git a/gsk/vulkan/resources/blend-mode-clip.vert.spv b/gsk/vulkan/resources/blend-mode-clip.vert.spv
new file mode 100644 (file)
index 0000000..13f49e7
Binary files /dev/null and b/gsk/vulkan/resources/blend-mode-clip.vert.spv differ
diff --git a/gsk/vulkan/resources/blend-mode.frag b/gsk/vulkan/resources/blend-mode.frag
new file mode 100644 (file)
index 0000000..d8179c2
--- /dev/null
@@ -0,0 +1,319 @@
+#version 450
+
+#include "common.frag.glsl"
+#include "clip.frag.glsl"
+#include "rect.frag.glsl"
+
+layout(location = 0) in vec2 inPos;
+layout(location = 1) in Rect inTopRect;
+layout(location = 2) in Rect inBottomRect;
+layout(location = 3) in vec2 inTopTexCoord;
+layout(location = 4) in vec2 inBottomTexCoord;
+layout(location = 5) flat in uvec2 inTopTexId;
+layout(location = 6) flat in uvec2 inBottomTexId;
+layout(location = 7) flat in uint inBlendMode;
+
+layout(location = 0) out vec4 color;
+
+float
+combine (float source, float backdrop)
+{
+  return source + backdrop * (1 - source);
+}
+
+vec4
+composite (vec4 Cs, vec4 Cb, vec3 B)
+{
+  float ao = Cs.a + Cb.a * (1 - Cs.a);
+  vec3 Co = (Cs.a*(1 - Cb.a)*Cs.rgb + Cs.a*Cb.a*B + (1 - Cs.a)*Cb.a*Cb.rgb) / ao;
+  return vec4(Co, ao);
+}
+
+vec4
+normal (vec4 Cs, vec4 Cb)
+{
+  return composite (Cs, Cb, Cs.rgb);
+}
+
+vec4
+multiply (vec4 Cs, vec4 Cb)
+{
+  return composite (Cs, Cb, Cs.rgb * Cb.rgb);
+}
+
+vec4
+difference (vec4 Cs, vec4 Cb)
+{
+  return composite (Cs, Cb, abs(Cs.rgb - Cb.rgb));
+}
+
+vec4
+screen (vec4 Cs, vec4 Cb)
+{
+  return composite (Cs, Cb, Cs.rgb + Cb.rgb - Cs.rgb * Cb.rgb);
+}
+
+float
+hard_light (float source, float backdrop)
+{
+  if (source <= 0.5)
+    return 2 * backdrop * source;
+  else
+    return 2 * (backdrop + source - backdrop * source) - 1;
+}
+
+vec4
+hard_light (vec4 Cs, vec4 Cb)
+{
+  vec3 B = vec3 (hard_light (Cs.r, Cb.r),
+                 hard_light (Cs.g, Cb.g),
+                 hard_light (Cs.b, Cb.b));
+  return composite (Cs, Cb, B);
+}
+
+float
+soft_light (float source, float backdrop)
+{
+  float db;
+
+  if (backdrop <= 0.25)
+    db = ((16 * backdrop - 12) * backdrop + 4) * backdrop;
+  else
+    db = sqrt (backdrop);
+
+  if (source <= 0.5)
+    return backdrop - (1 - 2 * source) * backdrop * (1 - backdrop);
+  else
+    return backdrop + (2 * source - 1) * (db - backdrop);
+}
+
+vec4
+soft_light (vec4 Cs, vec4 Cb)
+{
+  vec3 B = vec3 (soft_light (Cs.r, Cb.r),
+                 soft_light (Cs.g, Cb.g),
+                 soft_light (Cs.b, Cb.b));
+  return composite (Cs, Cb, B);
+}
+
+vec4
+overlay (vec4 Cs, vec4 Cb)
+{
+  vec3 B = vec3 (hard_light (Cb.r, Cs.r),
+                 hard_light (Cb.g, Cs.g),
+                 hard_light (Cb.b, Cs.b));
+  return composite (Cs, Cb, B);
+}
+
+vec4
+darken (vec4 Cs, vec4 Cb)
+{
+  vec3 B = min (Cs.rgb, Cb.rgb);
+  return composite (Cs, Cb, B);
+}
+
+vec4
+lighten (vec4 Cs, vec4 Cb)
+{
+  vec3 B = max (Cs.rgb, Cb.rgb);
+  return composite (Cs, Cb, B);
+}
+
+float
+color_dodge (float source, float backdrop)
+{
+  return (source == 1.0) ? source : min (backdrop / (1.0 - source), 1.0);
+}
+
+vec4
+color_dodge (vec4 Cs, vec4 Cb)
+{
+  vec3 B = vec3 (color_dodge (Cs.r, Cb.r),
+                 color_dodge (Cs.g, Cb.g),
+                 color_dodge (Cs.b, Cb.b));
+  return composite (Cs, Cb, B);
+}
+
+
+float
+color_burn (float source, float backdrop)
+{
+  return (source == 0.0) ? source : max ((1.0 - ((1.0 - backdrop) / source)), 0.0);
+}
+
+vec4
+color_burn (vec4 Cs, vec4 Cb)
+{
+  vec3 B = vec3 (color_burn (Cs.r, Cb.r),
+                 color_burn (Cs.g, Cb.g),
+                 color_burn (Cs.b, Cb.b));
+  return composite (Cs, Cb, B);
+}
+
+vec4
+exclusion (vec4 Cs, vec4 Cb)
+{
+  vec3 B = Cb.rgb + Cs.rgb - 2.0 * Cb.rgb * Cs.rgb;
+  return composite (Cs, Cb, B);
+}
+
+float
+lum (vec3 c)
+{
+  return 0.3 * c.r + 0.59 * c.g + 0.11 * c.b;
+}
+
+vec3
+clip_color (vec3 c)
+{
+  float l = lum (c);
+  float n = min (c.r, min (c.g, c.b));
+  float x = max (c.r, max (c.g, c.b));
+  if (n < 0) c = l + (((c - l) * l) / (l - n));
+  if (x > 1) c = l + (((c - l) * (1 - l)) / (x - l));
+  return c;
+}
+
+vec3
+set_lum (vec3 c, float l)
+{
+  float d = l - lum (c);
+  return clip_color (vec3 (c.r + d, c.g + d, c.b + d));
+}
+
+float
+sat (vec3 c)
+{
+  return max (c.r, max (c.g, c.b)) - min (c.r, min (c.g, c.b));
+}
+
+vec3
+set_sat (vec3 c, float s)
+{
+  float cmin = min (c.r, min (c.g, c.b));
+  float cmax = max (c.r, max (c.g, c.b));
+  vec3 res;
+
+  if (cmax == cmin)
+    res = vec3 (0, 0, 0);
+  else
+    {
+      if (c.r == cmax)
+        {
+          if (c.g == cmin)
+            {
+              res.b = ((c.b - cmin) * s) / (cmax - cmin);
+              res.g = 0;
+            }
+          else
+            {
+              res.g = ((c.g - cmin) * s) / (cmax - cmin);
+              res.b = 0;
+            }
+          res.r = s;
+        }
+      else if (c.g == cmax)
+        {
+          if (c.r == cmin)
+            {
+              res.b = ((c.b - cmin) * s) / (cmax - cmin);
+              res.r = 0;
+            }
+          else
+            {
+              res.r = ((c.r - cmin) * s) / (cmax - cmin);
+              res.b = 0;
+            }
+          res.g = s;
+        }
+      else
+        {
+          if (c.r == cmin)
+            {
+              res.g = ((c.g - cmin) * s) / (cmax - cmin);
+              res.r = 0;
+            }
+          else
+            {
+              res.r = ((c.r - cmin) * s) / (cmax - cmin);
+              res.g = 0;
+            }
+          res.b = s;
+        }
+    }
+  return res;
+}
+
+vec4
+colorize (vec4 Cs, vec4 Cb)
+{
+  vec3 B = set_lum (Cs.rgb, lum (Cb.rgb));
+  return composite (Cs, Cb, B);
+}
+
+vec4
+hue (vec4 Cs, vec4 Cb)
+{
+  vec3 B = set_lum (set_sat (Cs.rgb, sat (Cb.rgb)), lum (Cb.rgb));
+  return composite (Cs, Cb, B);
+}
+
+vec4
+saturation (vec4 Cs, vec4 Cb)
+{
+  vec3 B = set_lum (set_sat (Cb.rgb, sat (Cs.rgb)), lum (Cb.rgb));
+  return composite (Cs, Cb, B);
+}
+
+vec4
+luminosity (vec4 Cs, vec4 Cb)
+{
+  vec3 B = set_lum (Cb.rgb, lum (Cs.rgb));
+  return composite (Cs, Cb, B);
+}
+
+void main()
+{
+  float source_alpha = rect_coverage (inTopRect, inPos);
+  vec4 source = texture (get_sampler (inTopTexId), inTopTexCoord) * source_alpha;
+  float backdrop_alpha = rect_coverage (inBottomRect, inPos);
+  vec4 backdrop = texture (get_sampler (inBottomTexId), inBottomTexCoord) * backdrop_alpha;
+  vec4 result;
+
+  if (inBlendMode == 0)
+    result = normal (source, backdrop);
+  else if (inBlendMode == 1)
+    result = multiply (source, backdrop);
+  else if (inBlendMode == 2)
+    result = screen (source, backdrop);
+  else if (inBlendMode == 3)
+    result = overlay (source, backdrop);
+  else if (inBlendMode == 4)
+    result = darken (source, backdrop);
+  else if (inBlendMode == 5)
+    result = lighten (source, backdrop);
+  else if (inBlendMode == 6)
+    result = color_dodge (source, backdrop);
+  else if (inBlendMode == 7)
+    result = color_burn (source, backdrop);
+  else if (inBlendMode == 8)
+    result = hard_light (source, backdrop);
+  else if (inBlendMode == 9)
+    result = soft_light (source, backdrop);
+  else if (inBlendMode == 10)
+    result = difference (source, backdrop);
+  else if (inBlendMode == 11)
+    result = exclusion (source, backdrop);
+  else if (inBlendMode == 12)
+    result = colorize (source, backdrop);
+  else if (inBlendMode == 13)
+    result = hue (source, backdrop);
+  else if (inBlendMode == 14)
+    result = saturation (source, backdrop);
+  else if (inBlendMode == 15)
+    result = luminosity (source, backdrop);
+  else
+    discard;
+
+  color = clip_scaled (inPos, result);
+}
diff --git a/gsk/vulkan/resources/blend-mode.frag.spv b/gsk/vulkan/resources/blend-mode.frag.spv
new file mode 100644 (file)
index 0000000..5fae3d4
Binary files /dev/null and b/gsk/vulkan/resources/blend-mode.frag.spv differ
diff --git a/gsk/vulkan/resources/blend-mode.vert b/gsk/vulkan/resources/blend-mode.vert
new file mode 100644 (file)
index 0000000..4a8581a
--- /dev/null
@@ -0,0 +1,36 @@
+#version 450
+
+#include "common.vert.glsl"
+#include "rect.vert.glsl"
+
+layout(location = 0) in vec4 inRect;
+layout(location = 1) in vec4 inTopRect;
+layout(location = 2) in vec4 inBottomRect;
+layout(location = 3) in vec4 inTopTexRect;
+layout(location = 4) in vec4 inBottomTexRect;
+layout(location = 5) in uvec2 inTopTexId;
+layout(location = 6) in uvec2 inBottomTexId;
+layout(location = 7) in uint inBlendMode;
+
+layout(location = 0) out vec2 outPos;
+layout(location = 1) flat out Rect outTopRect;
+layout(location = 2) flat out Rect outBottomRect;
+layout(location = 3) out vec2 outTopTexCoord;
+layout(location = 4) out vec2 outBottomTexCoord;
+layout(location = 5) flat out uvec2 outTopTexId;
+layout(location = 6) flat out uvec2 outBottomTexId;
+layout(location = 7) flat out uint outBlendMode;
+
+void main() {
+  Rect r = rect_from_gsk (inRect);
+  vec2 pos = set_position_from_rect (r);
+
+  outPos = pos;
+  outTopRect = rect_from_gsk (inTopRect);
+  outBottomRect = rect_from_gsk (inBottomRect);
+  outTopTexCoord = scale_tex_coord (pos, r, inTopTexRect);
+  outBottomTexCoord = scale_tex_coord (pos, r, inBottomTexRect);
+  outTopTexId = inTopTexId;
+  outBottomTexId = inBottomTexId;
+  outBlendMode = inBlendMode;
+}
diff --git a/gsk/vulkan/resources/blend-mode.vert.spv b/gsk/vulkan/resources/blend-mode.vert.spv
new file mode 100644 (file)
index 0000000..a0cf5d6
Binary files /dev/null and b/gsk/vulkan/resources/blend-mode.vert.spv differ
diff --git a/gsk/vulkan/resources/blendmode-clip-rounded.frag.spv b/gsk/vulkan/resources/blendmode-clip-rounded.frag.spv
deleted file mode 100644 (file)
index b1f01de..0000000
Binary files a/gsk/vulkan/resources/blendmode-clip-rounded.frag.spv and /dev/null differ
diff --git a/gsk/vulkan/resources/blendmode-clip-rounded.vert.spv b/gsk/vulkan/resources/blendmode-clip-rounded.vert.spv
deleted file mode 100644 (file)
index 13f49e7..0000000
Binary files a/gsk/vulkan/resources/blendmode-clip-rounded.vert.spv and /dev/null differ
diff --git a/gsk/vulkan/resources/blendmode-clip.frag.spv b/gsk/vulkan/resources/blendmode-clip.frag.spv
deleted file mode 100644 (file)
index 5fae3d4..0000000
Binary files a/gsk/vulkan/resources/blendmode-clip.frag.spv and /dev/null differ
diff --git a/gsk/vulkan/resources/blendmode-clip.vert.spv b/gsk/vulkan/resources/blendmode-clip.vert.spv
deleted file mode 100644 (file)
index 13f49e7..0000000
Binary files a/gsk/vulkan/resources/blendmode-clip.vert.spv and /dev/null differ
diff --git a/gsk/vulkan/resources/blendmode.frag b/gsk/vulkan/resources/blendmode.frag
deleted file mode 100644 (file)
index d8179c2..0000000
+++ /dev/null
@@ -1,319 +0,0 @@
-#version 450
-
-#include "common.frag.glsl"
-#include "clip.frag.glsl"
-#include "rect.frag.glsl"
-
-layout(location = 0) in vec2 inPos;
-layout(location = 1) in Rect inTopRect;
-layout(location = 2) in Rect inBottomRect;
-layout(location = 3) in vec2 inTopTexCoord;
-layout(location = 4) in vec2 inBottomTexCoord;
-layout(location = 5) flat in uvec2 inTopTexId;
-layout(location = 6) flat in uvec2 inBottomTexId;
-layout(location = 7) flat in uint inBlendMode;
-
-layout(location = 0) out vec4 color;
-
-float
-combine (float source, float backdrop)
-{
-  return source + backdrop * (1 - source);
-}
-
-vec4
-composite (vec4 Cs, vec4 Cb, vec3 B)
-{
-  float ao = Cs.a + Cb.a * (1 - Cs.a);
-  vec3 Co = (Cs.a*(1 - Cb.a)*Cs.rgb + Cs.a*Cb.a*B + (1 - Cs.a)*Cb.a*Cb.rgb) / ao;
-  return vec4(Co, ao);
-}
-
-vec4
-normal (vec4 Cs, vec4 Cb)
-{
-  return composite (Cs, Cb, Cs.rgb);
-}
-
-vec4
-multiply (vec4 Cs, vec4 Cb)
-{
-  return composite (Cs, Cb, Cs.rgb * Cb.rgb);
-}
-
-vec4
-difference (vec4 Cs, vec4 Cb)
-{
-  return composite (Cs, Cb, abs(Cs.rgb - Cb.rgb));
-}
-
-vec4
-screen (vec4 Cs, vec4 Cb)
-{
-  return composite (Cs, Cb, Cs.rgb + Cb.rgb - Cs.rgb * Cb.rgb);
-}
-
-float
-hard_light (float source, float backdrop)
-{
-  if (source <= 0.5)
-    return 2 * backdrop * source;
-  else
-    return 2 * (backdrop + source - backdrop * source) - 1;
-}
-
-vec4
-hard_light (vec4 Cs, vec4 Cb)
-{
-  vec3 B = vec3 (hard_light (Cs.r, Cb.r),
-                 hard_light (Cs.g, Cb.g),
-                 hard_light (Cs.b, Cb.b));
-  return composite (Cs, Cb, B);
-}
-
-float
-soft_light (float source, float backdrop)
-{
-  float db;
-
-  if (backdrop <= 0.25)
-    db = ((16 * backdrop - 12) * backdrop + 4) * backdrop;
-  else
-    db = sqrt (backdrop);
-
-  if (source <= 0.5)
-    return backdrop - (1 - 2 * source) * backdrop * (1 - backdrop);
-  else
-    return backdrop + (2 * source - 1) * (db - backdrop);
-}
-
-vec4
-soft_light (vec4 Cs, vec4 Cb)
-{
-  vec3 B = vec3 (soft_light (Cs.r, Cb.r),
-                 soft_light (Cs.g, Cb.g),
-                 soft_light (Cs.b, Cb.b));
-  return composite (Cs, Cb, B);
-}
-
-vec4
-overlay (vec4 Cs, vec4 Cb)
-{
-  vec3 B = vec3 (hard_light (Cb.r, Cs.r),
-                 hard_light (Cb.g, Cs.g),
-                 hard_light (Cb.b, Cs.b));
-  return composite (Cs, Cb, B);
-}
-
-vec4
-darken (vec4 Cs, vec4 Cb)
-{
-  vec3 B = min (Cs.rgb, Cb.rgb);
-  return composite (Cs, Cb, B);
-}
-
-vec4
-lighten (vec4 Cs, vec4 Cb)
-{
-  vec3 B = max (Cs.rgb, Cb.rgb);
-  return composite (Cs, Cb, B);
-}
-
-float
-color_dodge (float source, float backdrop)
-{
-  return (source == 1.0) ? source : min (backdrop / (1.0 - source), 1.0);
-}
-
-vec4
-color_dodge (vec4 Cs, vec4 Cb)
-{
-  vec3 B = vec3 (color_dodge (Cs.r, Cb.r),
-                 color_dodge (Cs.g, Cb.g),
-                 color_dodge (Cs.b, Cb.b));
-  return composite (Cs, Cb, B);
-}
-
-
-float
-color_burn (float source, float backdrop)
-{
-  return (source == 0.0) ? source : max ((1.0 - ((1.0 - backdrop) / source)), 0.0);
-}
-
-vec4
-color_burn (vec4 Cs, vec4 Cb)
-{
-  vec3 B = vec3 (color_burn (Cs.r, Cb.r),
-                 color_burn (Cs.g, Cb.g),
-                 color_burn (Cs.b, Cb.b));
-  return composite (Cs, Cb, B);
-}
-
-vec4
-exclusion (vec4 Cs, vec4 Cb)
-{
-  vec3 B = Cb.rgb + Cs.rgb - 2.0 * Cb.rgb * Cs.rgb;
-  return composite (Cs, Cb, B);
-}
-
-float
-lum (vec3 c)
-{
-  return 0.3 * c.r + 0.59 * c.g + 0.11 * c.b;
-}
-
-vec3
-clip_color (vec3 c)
-{
-  float l = lum (c);
-  float n = min (c.r, min (c.g, c.b));
-  float x = max (c.r, max (c.g, c.b));
-  if (n < 0) c = l + (((c - l) * l) / (l - n));
-  if (x > 1) c = l + (((c - l) * (1 - l)) / (x - l));
-  return c;
-}
-
-vec3
-set_lum (vec3 c, float l)
-{
-  float d = l - lum (c);
-  return clip_color (vec3 (c.r + d, c.g + d, c.b + d));
-}
-
-float
-sat (vec3 c)
-{
-  return max (c.r, max (c.g, c.b)) - min (c.r, min (c.g, c.b));
-}
-
-vec3
-set_sat (vec3 c, float s)
-{
-  float cmin = min (c.r, min (c.g, c.b));
-  float cmax = max (c.r, max (c.g, c.b));
-  vec3 res;
-
-  if (cmax == cmin)
-    res = vec3 (0, 0, 0);
-  else
-    {
-      if (c.r == cmax)
-        {
-          if (c.g == cmin)
-            {
-              res.b = ((c.b - cmin) * s) / (cmax - cmin);
-              res.g = 0;
-            }
-          else
-            {
-              res.g = ((c.g - cmin) * s) / (cmax - cmin);
-              res.b = 0;
-            }
-          res.r = s;
-        }
-      else if (c.g == cmax)
-        {
-          if (c.r == cmin)
-            {
-              res.b = ((c.b - cmin) * s) / (cmax - cmin);
-              res.r = 0;
-            }
-          else
-            {
-              res.r = ((c.r - cmin) * s) / (cmax - cmin);
-              res.b = 0;
-            }
-          res.g = s;
-        }
-      else
-        {
-          if (c.r == cmin)
-            {
-              res.g = ((c.g - cmin) * s) / (cmax - cmin);
-              res.r = 0;
-            }
-          else
-            {
-              res.r = ((c.r - cmin) * s) / (cmax - cmin);
-              res.g = 0;
-            }
-          res.b = s;
-        }
-    }
-  return res;
-}
-
-vec4
-colorize (vec4 Cs, vec4 Cb)
-{
-  vec3 B = set_lum (Cs.rgb, lum (Cb.rgb));
-  return composite (Cs, Cb, B);
-}
-
-vec4
-hue (vec4 Cs, vec4 Cb)
-{
-  vec3 B = set_lum (set_sat (Cs.rgb, sat (Cb.rgb)), lum (Cb.rgb));
-  return composite (Cs, Cb, B);
-}
-
-vec4
-saturation (vec4 Cs, vec4 Cb)
-{
-  vec3 B = set_lum (set_sat (Cb.rgb, sat (Cs.rgb)), lum (Cb.rgb));
-  return composite (Cs, Cb, B);
-}
-
-vec4
-luminosity (vec4 Cs, vec4 Cb)
-{
-  vec3 B = set_lum (Cb.rgb, lum (Cs.rgb));
-  return composite (Cs, Cb, B);
-}
-
-void main()
-{
-  float source_alpha = rect_coverage (inTopRect, inPos);
-  vec4 source = texture (get_sampler (inTopTexId), inTopTexCoord) * source_alpha;
-  float backdrop_alpha = rect_coverage (inBottomRect, inPos);
-  vec4 backdrop = texture (get_sampler (inBottomTexId), inBottomTexCoord) * backdrop_alpha;
-  vec4 result;
-
-  if (inBlendMode == 0)
-    result = normal (source, backdrop);
-  else if (inBlendMode == 1)
-    result = multiply (source, backdrop);
-  else if (inBlendMode == 2)
-    result = screen (source, backdrop);
-  else if (inBlendMode == 3)
-    result = overlay (source, backdrop);
-  else if (inBlendMode == 4)
-    result = darken (source, backdrop);
-  else if (inBlendMode == 5)
-    result = lighten (source, backdrop);
-  else if (inBlendMode == 6)
-    result = color_dodge (source, backdrop);
-  else if (inBlendMode == 7)
-    result = color_burn (source, backdrop);
-  else if (inBlendMode == 8)
-    result = hard_light (source, backdrop);
-  else if (inBlendMode == 9)
-    result = soft_light (source, backdrop);
-  else if (inBlendMode == 10)
-    result = difference (source, backdrop);
-  else if (inBlendMode == 11)
-    result = exclusion (source, backdrop);
-  else if (inBlendMode == 12)
-    result = colorize (source, backdrop);
-  else if (inBlendMode == 13)
-    result = hue (source, backdrop);
-  else if (inBlendMode == 14)
-    result = saturation (source, backdrop);
-  else if (inBlendMode == 15)
-    result = luminosity (source, backdrop);
-  else
-    discard;
-
-  color = clip_scaled (inPos, result);
-}
diff --git a/gsk/vulkan/resources/blendmode.frag.spv b/gsk/vulkan/resources/blendmode.frag.spv
deleted file mode 100644 (file)
index 5fae3d4..0000000
Binary files a/gsk/vulkan/resources/blendmode.frag.spv and /dev/null differ
diff --git a/gsk/vulkan/resources/blendmode.vert b/gsk/vulkan/resources/blendmode.vert
deleted file mode 100644 (file)
index 4a8581a..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#version 450
-
-#include "common.vert.glsl"
-#include "rect.vert.glsl"
-
-layout(location = 0) in vec4 inRect;
-layout(location = 1) in vec4 inTopRect;
-layout(location = 2) in vec4 inBottomRect;
-layout(location = 3) in vec4 inTopTexRect;
-layout(location = 4) in vec4 inBottomTexRect;
-layout(location = 5) in uvec2 inTopTexId;
-layout(location = 6) in uvec2 inBottomTexId;
-layout(location = 7) in uint inBlendMode;
-
-layout(location = 0) out vec2 outPos;
-layout(location = 1) flat out Rect outTopRect;
-layout(location = 2) flat out Rect outBottomRect;
-layout(location = 3) out vec2 outTopTexCoord;
-layout(location = 4) out vec2 outBottomTexCoord;
-layout(location = 5) flat out uvec2 outTopTexId;
-layout(location = 6) flat out uvec2 outBottomTexId;
-layout(location = 7) flat out uint outBlendMode;
-
-void main() {
-  Rect r = rect_from_gsk (inRect);
-  vec2 pos = set_position_from_rect (r);
-
-  outPos = pos;
-  outTopRect = rect_from_gsk (inTopRect);
-  outBottomRect = rect_from_gsk (inBottomRect);
-  outTopTexCoord = scale_tex_coord (pos, r, inTopTexRect);
-  outBottomTexCoord = scale_tex_coord (pos, r, inBottomTexRect);
-  outTopTexId = inTopTexId;
-  outBottomTexId = inBottomTexId;
-  outBlendMode = inBlendMode;
-}
diff --git a/gsk/vulkan/resources/blendmode.vert.spv b/gsk/vulkan/resources/blendmode.vert.spv
deleted file mode 100644 (file)
index a0cf5d6..0000000
Binary files a/gsk/vulkan/resources/blendmode.vert.spv and /dev/null differ
index 6eb9057ce88dd32de6d508c2cfb8928c9834bbd2..35cfec7610c38f74ce4f227b8d26b543f50b4d68 100644 (file)
@@ -12,7 +12,7 @@ gsk_private_vulkan_include_shaders = [
 ]
 
 gsk_private_vulkan_fragment_shaders = [
-  'blendmode.frag',
+  'blend-mode.frag',
   'blur.frag',
   'border.frag',
   'color.frag',
@@ -26,7 +26,7 @@ gsk_private_vulkan_fragment_shaders = [
 ]
 
 gsk_private_vulkan_vertex_shaders = [
-  'blendmode.vert',
+  'blend-mode.vert',
   'blur.vert',
   'border.vert',
   'color.vert',