diff -x '*.am' -x '*.in' -rupwN cairo-1.12.16.old/src/cairo-gl-composite.c cairo-1.12.16.new/src/cairo-gl-composite.c --- cairo-1.12.16.old/src/cairo-gl-composite.c 2013-08-26 15:07:21 +0000 +++ cairo-1.12.16.new/src/cairo-gl-composite.c 2014-08-01 21:46:09 +0000 @@ -243,7 +243,7 @@ _cairo_gl_context_setup_operand (cairo_g case CAIRO_GL_OPERAND_CONSTANT: break; case CAIRO_GL_OPERAND_TEXTURE: - glActiveTexture (GL_TEXTURE0 + tex_unit); + ctx->dispatch.ActiveTexture (GL_TEXTURE0 + tex_unit); glBindTexture (ctx->tex_target, operand->texture.tex); _cairo_gl_texture_set_extend (ctx, ctx->tex_target, operand->texture.attributes.extend); @@ -261,7 +261,7 @@ _cairo_gl_context_setup_operand (cairo_g case CAIRO_GL_OPERAND_RADIAL_GRADIENT_A0: case CAIRO_GL_OPERAND_RADIAL_GRADIENT_NONE: case CAIRO_GL_OPERAND_RADIAL_GRADIENT_EXT: - glActiveTexture (GL_TEXTURE0 + tex_unit); + ctx->dispatch.ActiveTexture (GL_TEXTURE0 + tex_unit); glBindTexture (ctx->tex_target, operand->gradient.gradient->tex); _cairo_gl_texture_set_extend (ctx, ctx->tex_target, operand->gradient.extend); _cairo_gl_texture_set_filter (ctx, ctx->tex_target, CAIRO_FILTER_BILINEAR); @@ -384,9 +384,9 @@ _cairo_gl_set_operator (cairo_gl_context } if (ctx->current_target->base.content == CAIRO_CONTENT_ALPHA) { - glBlendFuncSeparate (GL_ZERO, GL_ZERO, src_factor, dst_factor); + ctx->dispatch.BlendFuncSeparate (GL_ZERO, GL_ZERO, src_factor, dst_factor); } else if (ctx->current_target->base.content == CAIRO_CONTENT_COLOR) { - glBlendFuncSeparate (src_factor, dst_factor, GL_ONE, GL_ONE); + ctx->dispatch.BlendFuncSeparate (src_factor, dst_factor, GL_ONE, GL_ONE); } else { glBlendFunc (src_factor, dst_factor); } diff -x '*.am' -x '*.in' -rupwN cairo-1.12.16.old/src/cairo-gl-device.c cairo-1.12.16.new/src/cairo-gl-device.c --- cairo-1.12.16.old/src/cairo-gl-device.c 2013-08-26 15:07:21 +0000 +++ cairo-1.12.16.new/src/cairo-gl-device.c 2014-08-01 21:45:23 +0000 @@ -331,9 +331,9 @@ _cairo_gl_context_activate (cairo_gl_con _cairo_gl_composite_flush (ctx); _cairo_gl_context_destroy_operand (ctx, ctx->max_textures - 1); } - glActiveTexture (ctx->max_textures - 1); + ctx->dispatch.ActiveTexture (ctx->max_textures - 1); } else { - glActiveTexture (GL_TEXTURE0 + tex_unit); + ctx->dispatch.ActiveTexture (GL_TEXTURE0 + tex_unit); } } 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 --- cairo-1.12.16.old/src/cairo-gl-dispatch-private.h 2013-08-26 15:07:21 +0000 +++ cairo-1.12.16.new/src/cairo-gl-dispatch-private.h 2014-08-02 14:58:08 +0000 @@ -59,6 +59,16 @@ typedef struct _cairo_gl_dispatch_entry offsetof(cairo_gl_dispatch_t, name)} #define DISPATCH_ENTRY_LAST { { NULL, NULL, NULL }, 0 } +cairo_private cairo_gl_dispatch_entry_t dispatch_multitexture_entries[] = { + DISPATCH_ENTRY_ARB (ActiveTexture), + DISPATCH_ENTRY_LAST +}; + +cairo_private cairo_gl_dispatch_entry_t dispatch_blendfuncseparate_entries[] = { + DISPATCH_ENTRY_EXT (BlendFuncSeparate), + DISPATCH_ENTRY_LAST +}; + cairo_private cairo_gl_dispatch_entry_t dispatch_buffers_entries[] = { DISPATCH_ENTRY_ARB (GenBuffers), DISPATCH_ENTRY_ARB (BindBuffer), 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 --- cairo-1.12.16.old/src/cairo-gl-dispatch.c 2013-08-26 15:07:21 +0000 +++ cairo-1.12.16.new/src/cairo-gl-dispatch.c 2014-08-02 15:00:10 +0000 @@ -226,6 +226,45 @@ _cairo_gl_dispatch_init_multisampling (c return CAIRO_STATUS_SUCCESS; } +static cairo_status_t +_cairo_gl_dispatch_init_multitexture (cairo_gl_dispatch_t *dispatch, + cairo_gl_get_proc_addr_func_t get_proc_addr, + int gl_version, + cairo_gl_flavor_t gl_flavor) +{ + cairo_gl_dispatch_name_t dispatch_name = CAIRO_GL_DISPATCH_NAME_EXT; + + if (gl_version >= CAIRO_GL_VERSION_ENCODE (1, 3)) + dispatch_name = CAIRO_GL_DISPATCH_NAME_CORE; + else if (!_cairo_gl_has_extension ("GL_ARB_multitexture")) + return CAIRO_STATUS_DEVICE_ERROR; + + _cairo_gl_dispatch_init_entries (dispatch, get_proc_addr, + dispatch_multitexture_entries, + dispatch_name); + return CAIRO_STATUS_SUCCESS; +} + +static cairo_status_t +_cairo_gl_dispatch_init_blendfuncseparate (cairo_gl_dispatch_t *dispatch, + cairo_gl_get_proc_addr_func_t get_proc_addr, + int gl_version, + cairo_gl_flavor_t gl_flavor) +{ + cairo_gl_dispatch_name_t dispatch_name = CAIRO_GL_DISPATCH_NAME_EXT; + + if (gl_version >= CAIRO_GL_VERSION_ENCODE (1, 4)) + { + dispatch_name = CAIRO_GL_DISPATCH_NAME_CORE; + } else if (!_cairo_gl_has_extension ("GL_EXT_blend_func_separate")) + return CAIRO_STATUS_DEVICE_ERROR; + + _cairo_gl_dispatch_init_entries (dispatch, get_proc_addr, + dispatch_blendfuncseparate_entries, + dispatch_name); + return CAIRO_STATUS_SUCCESS; +} + cairo_status_t _cairo_gl_dispatch_init (cairo_gl_dispatch_t *dispatch, cairo_gl_get_proc_addr_func_t get_proc_addr) @@ -257,5 +296,15 @@ _cairo_gl_dispatch_init (cairo_gl_dispat if (status != CAIRO_STATUS_SUCCESS) return status; + status = _cairo_gl_dispatch_init_multitexture (dispatch, get_proc_addr, + gl_version, gl_flavor); + if (status != CAIRO_STATUS_SUCCESS) + return status; + + status = _cairo_gl_dispatch_init_blendfuncseparate (dispatch, get_proc_addr, + gl_version, gl_flavor); + if (status != CAIRO_STATUS_SUCCESS) + return status; + return CAIRO_STATUS_SUCCESS; } 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 --- cairo-1.12.16.old/src/cairo-gl-glyphs.c 2013-08-26 15:07:21 +0000 +++ cairo-1.12.16.new/src/cairo-gl-glyphs.c 2014-08-01 21:45:43 +0000 @@ -130,7 +130,7 @@ _cairo_gl_glyph_cache_add_glyph (cairo_g return status; /* XXX: Make sure we use the mask texture. This should work automagically somehow */ - glActiveTexture (GL_TEXTURE1); + ctx->dispatch.ActiveTexture (GL_TEXTURE1); status = _cairo_gl_surface_draw_image (cache->surface, glyph_surface, 0, 0, glyph_surface->width, glyph_surface->height, 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 --- cairo-1.12.16.old/src/cairo-gl-private.h 2013-08-26 15:07:21 +0000 +++ cairo-1.12.16.new/src/cairo-gl-private.h 2014-08-01 21:35:01 +0000 @@ -325,6 +325,11 @@ typedef struct _cairo_gl_dispatch { void (*FramebufferTexture2DMultisample) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); + + /* Misc */ + void (*ActiveTexture) (GLenum texture); + void (*BlendFuncSeparate) (GLenum sfactorRGB, GLenum dfactorRGB, + GLenum sfactorAlpha, GLenum dfactorAlpha); } cairo_gl_dispatch_t; struct _cairo_gl_context {