summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Song <henry.song@samsung.com>2015-07-08 08:07:08 -0700
committernisanthmp <nisanth.mp@samsung.com>2015-07-31 17:35:37 +0530
commit7a9a971d386015c2c4da1565942ba1d34657b0e7 (patch)
tree1d3e7e90bb7a3285911e050301920a04377f6ef6
parentf658ee1c764eb624d271be64c5a1c8ee519c364e (diff)
downloadcairo-7a9a971d386015c2c4da1565942ba1d34657b0e7.tar.gz
cairo-7a9a971d386015c2c4da1565942ba1d34657b0e7.tar.bz2
cairo-7a9a971d386015c2c4da1565942ba1d34657b0e7.zip
GL: reset GL context's current program to cairo's shader
When cairo's GL context is used by external libraries or applications, it is possible that GL context's current program is changed. When we detect such changes, we must reset GL context's current program to cairo current shader Change-Id: Ifeadbff488200b5a8bcc5014bda9bf5c0f8df3a8 Signed-off-by: nisanthmp <nisanth.mp@samsung.com>
-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;