From d69b6e537173d5ade8e62a34816d977f7d7fdc3c Mon Sep 17 00:00:00 2001 From: raster Date: Wed, 12 Oct 2011 23:22:26 +0000 Subject: [PATCH] fix use of invalid program id IF viewport changed - also disable GLERR. this can really hurt performance. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@64027 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/modules/engines/gl_common/evas_gl_common.h | 2 +- src/modules/engines/gl_common/evas_gl_context.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/modules/engines/gl_common/evas_gl_common.h b/src/modules/engines/gl_common/evas_gl_common.h index a71afe6..6155f1e 100644 --- a/src/modules/engines/gl_common/evas_gl_common.h +++ b/src/modules/engines/gl_common/evas_gl_common.h @@ -640,7 +640,7 @@ extern unsigned int (*secsym_eglUnmapImageSEC) (void *a, void *b); extern unsigned int (*secsym_eglGetImageAttribSEC) (void *a, void *b, int c, int *d); #endif -#define GL_ERRORS 1 +//#define GL_ERRORS 1 #ifdef GL_ERRORS # define GLERR(fn, fl, ln, op) \ diff --git a/src/modules/engines/gl_common/evas_gl_context.c b/src/modules/engines/gl_common/evas_gl_context.c index 7ee41ee..49551f5 100644 --- a/src/modules/engines/gl_common/evas_gl_context.c +++ b/src/modules/engines/gl_common/evas_gl_context.c @@ -1,5 +1,6 @@ #include "evas_gl_private.h" +#define PRG_INVALID 0xffffffff #define GLPIPES 1 static int sym_done = 0; @@ -454,7 +455,9 @@ _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc) GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } - glUseProgram(gc->state.current.cur_prog); + if (gc->state.current.cur_prog == PRG_INVALID) + glUseProgram(gc->shared->shader[0].prog); + else glUseProgram(gc->state.current.cur_prog); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } @@ -703,7 +706,9 @@ evas_gl_common_context_new(void) SHADER_TEXTURE_ADD(shared, IMG_MASK, tex); SHADER_TEXTURE_ADD(shared, IMG_MASK, texm); - glUseProgram(gc->state.current.cur_prog); + if (gc->state.current.cur_prog == PRG_INVALID) + glUseProgram(gc->shared->shader[0].prog); + else glUseProgram(gc->state.current.cur_prog); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); evas_gl_common_shader_program_init_done(); @@ -891,7 +896,9 @@ evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc) GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glEnableVertexAttribArray(SHAD_COLOR); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); - glUseProgram(gc->state.current.cur_prog); + if (gc->state.current.cur_prog == PRG_INVALID) + glUseProgram(gc->shared->shader[0].prog); + else glUseProgram(gc->state.current.cur_prog); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glActiveTexture(GL_TEXTURE0); @@ -922,7 +929,7 @@ evas_gl_common_context_target_surface_set(Evas_Engine_GL_Context *gc, evas_gl_common_context_flush(gc); - gc->state.current.cur_prog = -1; + gc->state.current.cur_prog = PRG_INVALID; gc->state.current.cur_tex = -1; gc->state.current.cur_texu = -1; gc->state.current.cur_texv = -1; -- 2.7.4