[gtk/wip/baedert/gl-rework: 119/176] gl renderer: Don't copy border outline corner sizes around
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/gl-rework: 119/176] gl renderer: Don't copy border outline corner sizes around
- Date: Sun, 29 Dec 2019 15:16:22 +0000 (UTC)
commit 003be6b5d41b6af1ad03cb43439614d78339ac4d
Author: Timm Bäder <mail baedert org>
Date: Wed Dec 11 18:24:35 2019 +0100
gl renderer: Don't copy border outline corner sizes around
We already offset + scale the outline and its corners, just pass those
directly to the shader.
gsk/gl/gskglrenderer.c | 23 +++--------------------
gsk/gl/gskglrenderopsprivate.h | 3 +--
gsk/resources/glsl/border.fs.glsl | 7 ++++---
3 files changed, 8 insertions(+), 25 deletions(-)
---
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index 859e574e9c..0799e1af15 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -2635,26 +2635,10 @@ apply_border_op (const Program *program,
const OpBorder *op)
{
const GskRoundedRect *o = &op->outline;
- float outline[4];
- float widths[4];
- float heights[4];
- int i;
OP_PRINT (" -> Border Outline");
- outline[0] = o->bounds.origin.x;
- outline[1] = o->bounds.origin.y;
- outline[2] = o->bounds.size.width;
- outline[3] = o->bounds.size.height;
-
- for (i = 0; i < 4; i ++)
- {
- widths[i] = o->corner[i].width;
- heights[i] = o->corner[i].height;
- }
-
- glUniform4fv (program->border.outline_location, 1, outline);
- glUniform4fv (program->border.corner_widths_location, 1, widths);
- glUniform4fv (program->border.corner_heights_location, 1, heights);
+ glUniform4fv (program->border.outline_location, 1, (float *)&o->bounds);
+ glUniform2fv (program->border.corner_sizes_location, 4, (float *)&o->corner);
}
static inline void
@@ -2877,8 +2861,7 @@ gsk_gl_renderer_create_programs (GskGLRenderer *self,
INIT_PROGRAM_UNIFORM_LOCATION (border, color);
INIT_PROGRAM_UNIFORM_LOCATION (border, widths);
INIT_PROGRAM_UNIFORM_LOCATION (border, outline);
- INIT_PROGRAM_UNIFORM_LOCATION (border, corner_widths);
- INIT_PROGRAM_UNIFORM_LOCATION (border, corner_heights);
+ INIT_PROGRAM_UNIFORM_LOCATION (border, corner_sizes);
/* cross fade */
INIT_PROGRAM_UNIFORM_LOCATION (cross_fade, progress);
diff --git a/gsk/gl/gskglrenderopsprivate.h b/gsk/gl/gskglrenderopsprivate.h
index f095a194ba..9924969ca4 100644
--- a/gsk/gl/gskglrenderopsprivate.h
+++ b/gsk/gl/gskglrenderopsprivate.h
@@ -99,8 +99,7 @@ struct _Program
int color_location;
int widths_location;
int outline_location;
- int corner_widths_location;
- int corner_heights_location;
+ int corner_sizes_location;
} border;
struct {
int source2_location;
diff --git a/gsk/resources/glsl/border.fs.glsl b/gsk/resources/glsl/border.fs.glsl
index 970c5739ea..ea9760717e 100644
--- a/gsk/resources/glsl/border.fs.glsl
+++ b/gsk/resources/glsl/border.fs.glsl
@@ -2,8 +2,7 @@ uniform vec4 u_color;
uniform vec4 u_widths;
uniform vec4 u_outline;
-uniform vec4 u_corner_widths;
-uniform vec4 u_corner_heights;
+uniform vec2 u_corner_sizes[4];
void main() {
vec4 bounds = u_outline;
@@ -15,7 +14,9 @@ void main() {
f.x += u_viewport.x;
f.y = (u_viewport.y + u_viewport.w) - f.y;
- RoundedRect routside = RoundedRect (bounds, u_corner_widths, u_corner_heights);
+ vec4 corner_widths = vec4(u_corner_sizes[0].x, u_corner_sizes[1].x, u_corner_sizes[2].x,
u_corner_sizes[3].x);
+ vec4 corner_heights = vec4(u_corner_sizes[0].y, u_corner_sizes[1].y, u_corner_sizes[2].y,
u_corner_sizes[3].y);
+ RoundedRect routside = RoundedRect (bounds, corner_widths, corner_heights);
RoundedRect rinside = rounded_rect_shrink (routside, u_widths);
float alpha = clamp (rounded_rect_coverage (routside, f.xy) -
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]