diff --git a/gsk/gl/gskgldriver.c b/gsk/gl/gskgldriver.c index cc5538a320..2c7f42a958 100644 --- a/gsk/gl/gskgldriver.c +++ b/gsk/gl/gskgldriver.c @@ -226,6 +226,8 @@ gsk_gl_driver_dispose (GObject *object) GSK_GL_DELETE_PROGRAM(name); \ GSK_GL_DELETE_PROGRAM(name ## _no_clip); \ GSK_GL_DELETE_PROGRAM(name ## _rect_clip); +#define GSK_GL_DEFINE_PROGRAM_NO_CLIP(name, resource, uniforms) \ + GSK_GL_DELETE_PROGRAM(name); #define GSK_GL_DELETE_PROGRAM(name) \ G_STMT_START { \ if (self->name) \ @@ -240,6 +242,7 @@ gsk_gl_driver_dispose (GObject *object) #undef GSK_GL_SHADER_JOINED #undef GSK_GL_ADD_UNIFORM #undef GSK_GL_DEFINE_PROGRAM +#undef GSK_GL_DEFINE_PROGRAM_NO_CLIP if (self->shader_cache != NULL) { @@ -375,6 +378,11 @@ gsk_gl_driver_load_programs (GskGLDriver *self, GSK_GL_COMPILE_PROGRAM(name ## _no_clip, uniforms, "#define NO_CLIP 1\n"); \ GSK_GL_COMPILE_PROGRAM(name ## _rect_clip, uniforms, "#define RECT_CLIP 1\n"); \ GSK_GL_COMPILE_PROGRAM(name, uniforms, ""); +#define GSK_GL_DEFINE_PROGRAM_NO_CLIP(name, sources, uniforms) \ + gsk_gl_compiler_set_source (compiler, GSK_GL_COMPILER_VERTEX, NULL); \ + gsk_gl_compiler_set_source (compiler, GSK_GL_COMPILER_FRAGMENT, NULL); \ + sources \ + GSK_GL_COMPILE_PROGRAM(name, uniforms, "#define NO_CLIP 1\n"); #define GSK_GL_COMPILE_PROGRAM(name, uniforms, clip) \ G_STMT_START { \ GskGLProgram *program; \ @@ -402,6 +410,7 @@ gsk_gl_driver_load_programs (GskGLDriver *self, } G_STMT_END; # include "gskglprograms.defs" #undef GSK_GL_DEFINE_PROGRAM +#undef GSK_GL_DEFINE_PROGRAM_NO_CLIP #undef GSK_GL_ADD_UNIFORM #undef GSK_GL_SHADER_SINGLE #undef GSK_GL_SHADER_JOINED diff --git a/gsk/gl/gskgldriverprivate.h b/gsk/gl/gskgldriverprivate.h index 021792bd8c..c421bed98a 100644 --- a/gsk/gl/gskgldriverprivate.h +++ b/gsk/gl/gskgldriverprivate.h @@ -69,7 +69,9 @@ typedef struct { #define CONCAT_EXPANDED2(a,b) a##b #define GSK_GL_ADD_UNIFORM(pos, KEY, name) UNIFORM_##KEY = UNIFORM_SHARED_LAST + pos, #define GSK_GL_DEFINE_PROGRAM(name, resource, uniforms) enum { uniforms }; +#define GSK_GL_DEFINE_PROGRAM_NO_CLIP(name, resource, uniforms) enum { uniforms }; # include "gskglprograms.defs" +#undef GSK_GL_DEFINE_PROGRAM_NO_CLIP #undef GSK_GL_DEFINE_PROGRAM #undef GSK_GL_ADD_UNIFORM #undef GSK_GL_NO_UNIFORMS @@ -116,10 +118,13 @@ struct _GskGLDriver GskGLProgram *name ## _no_clip; \ GskGLProgram *name ## _rect_clip; \ GskGLProgram *name; +#define GSK_GL_DEFINE_PROGRAM_NO_CLIP(name, resource, uniforms) \ + GskGLProgram *name; # include "gskglprograms.defs" #undef GSK_GL_NO_UNIFORMS #undef GSK_GL_ADD_UNIFORM #undef GSK_GL_DEFINE_PROGRAM +#undef GSK_GL_DEFINE_PROGRAM_NO_CLIP gint64 current_frame_id;