gl renderer: Remove shadow program

Drawing shadows is the same task as drawing text in our case and these
two shaders have been the same thing for quite a while.
This commit is contained in:
Timm Bäder 2018-03-15 18:07:35 +01:00
parent 0a7880110e
commit eaf899061a
5 changed files with 4 additions and 25 deletions

View File

@ -209,7 +209,6 @@ struct _GskGLRenderer
Program inset_shadow_program; Program inset_shadow_program;
Program outset_shadow_program; Program outset_shadow_program;
Program unblurred_outset_shadow_program; Program unblurred_outset_shadow_program;
Program shadow_program;
Program border_program; Program border_program;
Program cross_fade_program; Program cross_fade_program;
}; };
@ -1371,7 +1370,7 @@ render_shadow_node (GskGLRenderer *self,
shadow_child, &texture_id, &is_offscreen, FALSE, TRUE); shadow_child, &texture_id, &is_offscreen, FALSE, TRUE);
ops_offset (builder, dx, dy); ops_offset (builder, dx, dy);
ops_set_program (builder, &self->shadow_program); ops_set_program (builder, &self->coloring_program);
ops_set_color (builder, &shadow->color); ops_set_color (builder, &shadow->color);
ops_set_texture (builder, texture_id); ops_set_texture (builder, texture_id);
if (is_offscreen) if (is_offscreen)
@ -1755,7 +1754,6 @@ gsk_gl_renderer_create_programs (GskGLRenderer *self,
{ "inset shadow", "blit.vs.glsl", "inset_shadow.fs.glsl" }, { "inset shadow", "blit.vs.glsl", "inset_shadow.fs.glsl" },
{ "outset shadow", "blit.vs.glsl", "outset_shadow.fs.glsl" }, { "outset shadow", "blit.vs.glsl", "outset_shadow.fs.glsl" },
{ "unblurred outset shadow", "blit.vs.glsl", "unblurred_outset_shadow.fs.glsl" }, { "unblurred outset shadow", "blit.vs.glsl", "unblurred_outset_shadow.fs.glsl" },
{ "shadow", "blit.vs.glsl", "shadow.fs.glsl" },
{ "border", "blit.vs.glsl", "border.fs.glsl" }, { "border", "blit.vs.glsl", "border.fs.glsl" },
{ "cross fade", "blit.vs.glsl", "cross_fade.fs.glsl" }, { "cross fade", "blit.vs.glsl", "cross_fade.fs.glsl" },
}; };
@ -1874,9 +1872,6 @@ gsk_gl_renderer_create_programs (GskGLRenderer *self,
INIT_PROGRAM_UNIFORM_LOCATION (unblurred_outset_shadow, corner_widths); INIT_PROGRAM_UNIFORM_LOCATION (unblurred_outset_shadow, corner_widths);
INIT_PROGRAM_UNIFORM_LOCATION (unblurred_outset_shadow, corner_heights); INIT_PROGRAM_UNIFORM_LOCATION (unblurred_outset_shadow, corner_heights);
/* shadow */
INIT_PROGRAM_UNIFORM_LOCATION (shadow, color);
/* border */ /* border */
INIT_PROGRAM_UNIFORM_LOCATION (border, color); INIT_PROGRAM_UNIFORM_LOCATION (border, color);
INIT_PROGRAM_UNIFORM_LOCATION (border, widths); INIT_PROGRAM_UNIFORM_LOCATION (border, widths);

View File

@ -10,7 +10,7 @@
#include "gskglrendererprivate.h" #include "gskglrendererprivate.h"
#define GL_N_VERTICES 6 #define GL_N_VERTICES 6
#define GL_N_PROGRAMS 13 #define GL_N_PROGRAMS 12
enum { enum {
OP_NONE, OP_NONE,
@ -63,9 +63,6 @@ typedef struct
struct { struct {
int color_location; int color_location;
} coloring; } coloring;
struct {
int color_location;
} shadow;
struct { struct {
int color_matrix_location; int color_matrix_location;
int color_offset_location; int color_offset_location;

View File

@ -11,7 +11,6 @@ gsk_private_gl_shaders = [
'resources/glsl/inset_shadow.fs.glsl', 'resources/glsl/inset_shadow.fs.glsl',
'resources/glsl/outset_shadow.fs.glsl', 'resources/glsl/outset_shadow.fs.glsl',
'resources/glsl/unblurred_outset_shadow.fs.glsl', 'resources/glsl/unblurred_outset_shadow.fs.glsl',
'resources/glsl/shadow.fs.glsl',
'resources/glsl/border.fs.glsl', 'resources/glsl/border.fs.glsl',
'resources/glsl/cross_fade.fs.glsl', 'resources/glsl/cross_fade.fs.glsl',
'resources/glsl/es2_common.fs.glsl', 'resources/glsl/es2_common.fs.glsl',

View File

@ -8,6 +8,7 @@ void main() {
color.rgb *= color.a; color.rgb *= color.a;
// u_source is drawn using cairo, so already pre-multiplied. // u_source is drawn using cairo, so already pre-multiplied.
color = vec4(u_color.rgb * diffuse.a * u_alpha, diffuse.a * color.a * u_alpha);
setOutputColor(color * diffuse * u_alpha); setOutputColor(color);
} }

View File

@ -1,13 +0,0 @@
uniform vec4 u_color;
void main() {
vec4 diffuse = Texture(u_source, vUv);
vec4 color = u_color;
// pre-multiply
color.rgb *= color.a;
color = vec4(u_color.rgb * diffuse.a * u_alpha, diffuse.a * color.a * u_alpha);
setOutputColor(color);
}