[gtk/wip/baedert/gl-rework: 24/41] gl renderer: Move color computation to vertex shader
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/gl-rework: 24/41] gl renderer: Move color computation to vertex shader
- Date: Fri, 20 Dec 2019 09:54:40 +0000 (UTC)
commit 79f4585f865d6b7a2d40c1d0f1cfa5717f3a9877
Author: Timm Bäder <mail baedert org>
Date: Tue Dec 17 16:06:28 2019 +0100
gl renderer: Move color computation to vertex shader
gsk/resources/glsl/border.glsl | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/gsk/resources/glsl/border.glsl b/gsk/resources/glsl/border.glsl
index 6a0ff18024..a47fe7e393 100644
--- a/gsk/resources/glsl/border.glsl
+++ b/gsk/resources/glsl/border.glsl
@@ -1,14 +1,22 @@
// VERTEX_SHADER:
+uniform vec4 u_color;
+
+_OUT_ vec4 final_color;
void main() {
gl_Position = u_projection * u_modelview * vec4(aPosition, 0.0, 1.0);
+
+ final_color = u_color;
+ final_color.rgb *= final_color.a; // pre-multiply
+ final_color *= u_alpha;
}
// FRAGMENT_SHADER:
-uniform vec4 u_color;
uniform vec4 u_widths;
uniform vec4[3] u_outline_rect;
+_IN_ vec4 final_color;
+
void main() {
vec4 f = gl_FragCoord;
f.x += u_viewport.x;
@@ -21,9 +29,5 @@ void main() {
rounded_rect_coverage (inside, f.xy),
0.0, 1.0);
- /* Pre-multiply */
- vec4 color = u_color;
- color.rgb *= color.a;
-
- setOutputColor (color * alpha * u_alpha);
+ setOutputColor(final_color * alpha);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]