diff options
author | Henry Song <henry.song@samsung.com> | 2015-07-09 07:12:45 -0700 |
---|---|---|
committer | nisanthmp <nisanth.mp@samsung.com> | 2015-08-03 18:47:35 +0530 |
commit | 6553e8bbfb0afcc558a0e4bb2147159c0971d9db (patch) | |
tree | 7f27708f3535da610921203611c6764e4504c64d | |
parent | 7a9a971d386015c2c4da1565942ba1d34657b0e7 (diff) | |
download | cairo-6553e8bbfb0afcc558a0e4bb2147159c0971d9db.tar.gz cairo-6553e8bbfb0afcc558a0e4bb2147159c0971d9db.tar.bz2 cairo-6553e8bbfb0afcc558a0e4bb2147159c0971d9db.zip |
GL: query current program before set it in gl context reset
Change-Id: I36c3de424036ff177a8b5791fc87da3c63d2ee1b
Signed-off-by: nisanthmp <nisanth.mp@samsung.com>
-rw-r--r-- | src/cairo-gl-device.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/cairo-gl-device.c b/src/cairo-gl-device.c index b98c76930..827d50b76 100644 --- a/src/cairo-gl-device.c +++ b/src/cairo-gl-device.c @@ -1106,14 +1106,18 @@ 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; + GLint current_program; + /* 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); + if (shader) { + ctx->dispatch.GetIntegerv (GL_CURRENT_PROGRAM, ¤t_program); + if ((GLint)(ctx->current_shader->program) != current_program) + _cairo_gl_set_shader (ctx, shader); + } ctx->states_cache.viewport_box.width = 0; ctx->states_cache.viewport_box.height = 0; |