1 --- cairo-1.16.0/src/cairo-gl-composite.c.orig 2018-10-21 18:12:52.400945600 +0200
2 +++ cairo-1.16.0/src/cairo-gl-composite.c 2018-10-21 18:14:57.924277503 +0200
3 @@ -340,7 +340,7 @@ _cairo_gl_context_setup_operand (cairo_g
4 case CAIRO_GL_OPERAND_CONSTANT:
6 case CAIRO_GL_OPERAND_TEXTURE:
7 - glActiveTexture (GL_TEXTURE0 + tex_unit);
8 + ctx->dispatch.ActiveTexture (GL_TEXTURE0 + tex_unit);
9 glBindTexture (ctx->tex_target, operand->texture.tex);
10 _cairo_gl_texture_set_extend (ctx, ctx->tex_target,
11 operand->texture.attributes.extend);
12 @@ -358,7 +358,7 @@ _cairo_gl_context_setup_operand (cairo_g
13 case CAIRO_GL_OPERAND_RADIAL_GRADIENT_A0:
14 case CAIRO_GL_OPERAND_RADIAL_GRADIENT_NONE:
15 case CAIRO_GL_OPERAND_RADIAL_GRADIENT_EXT:
16 - glActiveTexture (GL_TEXTURE0 + tex_unit);
17 + ctx->dispatch.ActiveTexture (GL_TEXTURE0 + tex_unit);
18 glBindTexture (ctx->tex_target, operand->gradient.gradient->tex);
19 _cairo_gl_texture_set_extend (ctx, ctx->tex_target, operand->gradient.extend);
20 _cairo_gl_texture_set_filter (ctx, ctx->tex_target, CAIRO_FILTER_BILINEAR);
21 @@ -481,9 +481,9 @@ _cairo_gl_set_operator (cairo_gl_context
24 if (ctx->current_target->base.content == CAIRO_CONTENT_ALPHA) {
25 - glBlendFuncSeparate (GL_ZERO, GL_ZERO, src_factor, dst_factor);
26 + ctx->dispatch.BlendFuncSeparate (GL_ZERO, GL_ZERO, src_factor, dst_factor);
27 } else if (ctx->current_target->base.content == CAIRO_CONTENT_COLOR) {
28 - glBlendFuncSeparate (src_factor, dst_factor, GL_ONE, GL_ONE);
29 + ctx->dispatch.BlendFuncSeparate (src_factor, dst_factor, GL_ONE, GL_ONE);
31 glBlendFunc (src_factor, dst_factor);
33 --- cairo-1.16.0/src/cairo-gl-device.c.orig 2018-10-21 18:12:52.400945600 +0200
34 +++ cairo-1.16.0/src/cairo-gl-device.c 2018-10-21 18:16:20.617609890 +0200
35 @@ -341,9 +341,9 @@ _cairo_gl_context_activate (cairo_gl_con
36 _cairo_gl_composite_flush (ctx);
37 _cairo_gl_context_destroy_operand (ctx, ctx->max_textures - 1);
39 - glActiveTexture (ctx->max_textures - 1);
40 + ctx->dispatch.ActiveTexture (ctx->max_textures - 1);
42 - glActiveTexture (GL_TEXTURE0 + tex_unit);
43 + ctx->dispatch.ActiveTexture (GL_TEXTURE0 + tex_unit);
47 diff -x '*.am' -x '*.in' -rupwN cairo-1.12.16.old/src/cairo-gl-dispatch-private.h cairo-1.12.16.new/src/cairo-gl-dispatch-private.h
48 --- cairo-1.12.16.old/src/cairo-gl-dispatch-private.h 2013-08-26 15:07:21 +0000
49 +++ cairo-1.12.16.new/src/cairo-gl-dispatch-private.h 2014-08-02 14:58:08 +0000
50 @@ -59,6 +59,16 @@ typedef struct _cairo_gl_dispatch_entry
51 offsetof(cairo_gl_dispatch_t, name)}
52 #define DISPATCH_ENTRY_LAST { { NULL, NULL, NULL }, 0 }
54 +cairo_private cairo_gl_dispatch_entry_t dispatch_multitexture_entries[] = {
55 + DISPATCH_ENTRY_ARB (ActiveTexture),
59 +cairo_private cairo_gl_dispatch_entry_t dispatch_blendfuncseparate_entries[] = {
60 + DISPATCH_ENTRY_EXT (BlendFuncSeparate),
64 cairo_private cairo_gl_dispatch_entry_t dispatch_buffers_entries[] = {
65 DISPATCH_ENTRY_ARB (GenBuffers),
66 DISPATCH_ENTRY_ARB (BindBuffer),
67 diff -x '*.am' -x '*.in' -rupwN cairo-1.12.16.old/src/cairo-gl-dispatch.c cairo-1.12.16.new/src/cairo-gl-dispatch.c
68 --- cairo-1.12.16.old/src/cairo-gl-dispatch.c 2013-08-26 15:07:21 +0000
69 +++ cairo-1.12.16.new/src/cairo-gl-dispatch.c 2014-08-02 15:00:10 +0000
70 @@ -226,6 +226,45 @@ _cairo_gl_dispatch_init_multisampling (c
71 return CAIRO_STATUS_SUCCESS;
74 +static cairo_status_t
75 +_cairo_gl_dispatch_init_multitexture (cairo_gl_dispatch_t *dispatch,
76 + cairo_gl_get_proc_addr_func_t get_proc_addr,
78 + cairo_gl_flavor_t gl_flavor)
80 + cairo_gl_dispatch_name_t dispatch_name = CAIRO_GL_DISPATCH_NAME_EXT;
82 + if (gl_version >= CAIRO_GL_VERSION_ENCODE (1, 3))
83 + dispatch_name = CAIRO_GL_DISPATCH_NAME_CORE;
84 + else if (!_cairo_gl_has_extension ("GL_ARB_multitexture"))
85 + return CAIRO_STATUS_DEVICE_ERROR;
87 + _cairo_gl_dispatch_init_entries (dispatch, get_proc_addr,
88 + dispatch_multitexture_entries,
90 + return CAIRO_STATUS_SUCCESS;
93 +static cairo_status_t
94 +_cairo_gl_dispatch_init_blendfuncseparate (cairo_gl_dispatch_t *dispatch,
95 + cairo_gl_get_proc_addr_func_t get_proc_addr,
97 + cairo_gl_flavor_t gl_flavor)
99 + cairo_gl_dispatch_name_t dispatch_name = CAIRO_GL_DISPATCH_NAME_EXT;
101 + if (gl_version >= CAIRO_GL_VERSION_ENCODE (1, 4))
103 + dispatch_name = CAIRO_GL_DISPATCH_NAME_CORE;
104 + } else if (!_cairo_gl_has_extension ("GL_EXT_blend_func_separate"))
105 + return CAIRO_STATUS_DEVICE_ERROR;
107 + _cairo_gl_dispatch_init_entries (dispatch, get_proc_addr,
108 + dispatch_blendfuncseparate_entries,
110 + return CAIRO_STATUS_SUCCESS;
114 _cairo_gl_dispatch_init (cairo_gl_dispatch_t *dispatch,
115 cairo_gl_get_proc_addr_func_t get_proc_addr)
116 @@ -257,5 +296,15 @@ _cairo_gl_dispatch_init (cairo_gl_dispat
117 if (status != CAIRO_STATUS_SUCCESS)
120 + status = _cairo_gl_dispatch_init_multitexture (dispatch, get_proc_addr,
121 + gl_version, gl_flavor);
122 + if (status != CAIRO_STATUS_SUCCESS)
125 + status = _cairo_gl_dispatch_init_blendfuncseparate (dispatch, get_proc_addr,
126 + gl_version, gl_flavor);
127 + if (status != CAIRO_STATUS_SUCCESS)
130 return CAIRO_STATUS_SUCCESS;
132 diff -x '*.am' -x '*.in' -rupwN cairo-1.12.16.old/src/cairo-gl-glyphs.c cairo-1.12.16.new/src/cairo-gl-glyphs.c
133 --- cairo-1.12.16.old/src/cairo-gl-glyphs.c 2013-08-26 15:07:21 +0000
134 +++ cairo-1.12.16.new/src/cairo-gl-glyphs.c 2014-08-01 21:45:43 +0000
135 @@ -130,7 +130,7 @@ _cairo_gl_glyph_cache_add_glyph (cairo_g
138 /* XXX: Make sure we use the mask texture. This should work automagically somehow */
139 - glActiveTexture (GL_TEXTURE1);
140 + ctx->dispatch.ActiveTexture (GL_TEXTURE1);
141 status = _cairo_gl_surface_draw_image (cache->surface, glyph_surface,
143 glyph_surface->width, glyph_surface->height,
144 diff -x '*.am' -x '*.in' -rupwN cairo-1.12.16.old/src/cairo-gl-private.h cairo-1.12.16.new/src/cairo-gl-private.h
145 --- cairo-1.12.16.old/src/cairo-gl-private.h 2013-08-26 15:07:21 +0000
146 +++ cairo-1.12.16.new/src/cairo-gl-private.h 2014-08-01 21:35:01 +0000
147 @@ -325,6 +325,11 @@ typedef struct _cairo_gl_dispatch {
148 void (*FramebufferTexture2DMultisample) (GLenum target, GLenum attachment,
149 GLenum textarget, GLuint texture,
150 GLint level, GLsizei samples);
153 + void (*ActiveTexture) (GLenum texture);
154 + void (*BlendFuncSeparate) (GLenum sfactorRGB, GLenum dfactorRGB,
155 + GLenum sfactorAlpha, GLenum dfactorAlpha);
156 } cairo_gl_dispatch_t;
158 struct _cairo_gl_context {