summaryrefslogtreecommitdiff
path: root/src/cairo-gl-device.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cairo-gl-device.c')
-rw-r--r--src/cairo-gl-device.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/cairo-gl-device.c b/src/cairo-gl-device.c
index dbb6f162f..b98c76930 100644
--- a/src/cairo-gl-device.c
+++ b/src/cairo-gl-device.c
@@ -1105,6 +1105,16 @@ cairo_gl_device_set_thread_aware (cairo_device_t *device,
void _cairo_gl_context_reset (cairo_gl_context_t *ctx)
{
+ cairo_gl_shader_t *shader = ctx->current_shader;
+ /* reset current shader, this is because if cairo shares a same
+ * context other extern libraries or applications, the current
+ * program may well be changed, in this case, we must set cairo
+ * to use cairo program
+ */
+ ctx->current_shader = NULL;
+ if (shader)
+ _cairo_gl_set_shader (ctx, shader);
+
ctx->states_cache.viewport_box.width = 0;
ctx->states_cache.viewport_box.height = 0;
@@ -1127,8 +1137,6 @@ void _cairo_gl_context_reset (cairo_gl_context_t *ctx)
/* FIXME: this is hack to fix mali driver */
ctx->dispatch.Disable (GL_DITHER);
- ctx->current_shader = NULL;
-
ctx->states_cache.bound_vbo = 0;
ctx->states_cache.bound_vao = 0;
ctx->states_cache.bound_ibo = 0;