From: Henry Song Date: Thu, 9 Jul 2015 14:12:45 +0000 (-0700) Subject: GL: query current program before set it in gl context reset X-Git-Tag: submit/tizen/20151214.061957~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6553e8bbfb0afcc558a0e4bb2147159c0971d9db;p=platform%2Fcore%2Fgraphics%2Fcairo.git GL: query current program before set it in gl context reset Change-Id: I36c3de424036ff177a8b5791fc87da3c63d2ee1b Signed-off-by: nisanthmp --- 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;