From: Haegeun Park Date: Mon, 16 Apr 2012 04:34:32 +0000 (-0700) Subject: Add fpgl-call error handling when makecurrent=null (instead of assertion) X-Git-Tag: submit/devel/coregl/20151204.063909^2~120^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;ds=sidebyside;h=5f379bebeeb92e6fde84683a0da74562ebefd0f6;hp=528fe73b16129f78c39a2cf7f0efb70ac4a3bd94;p=platform%2Fcore%2Fuifw%2Fcoregl.git Add fpgl-call error handling when makecurrent=null (instead of assertion) Add new option 'COREGL_TRACE_CTX_FORCE=1' for chasing every context changes (with CORGEL_TRACE_CTX=1) --- diff --git a/src/coregl.c b/src/coregl.c index 2375a18..006934d 100644 --- a/src/coregl.c +++ b/src/coregl.c @@ -15,6 +15,7 @@ GLContext_List *glctx_list = NULL; int trace_api_flag = 0; int trace_ctx_flag = 0; +int trace_ctx_force_flag = 0; int trace_state_flag = 0; int debug_nofp = 0; @@ -407,6 +408,9 @@ init_gl() #ifdef COREGL_TRACE_CONTEXT_INFO trace_ctx_flag = atoi(get_env_setting("COREGL_TRACE_CTX")); #endif +#ifdef COREGL_TRACE_CONTEXT_INFO + trace_ctx_force_flag = atoi(get_env_setting("COREGL_TRACE_CTX_FORCE")); +#endif #ifdef COREGL_TRACE_STATE_INFO trace_state_flag = atoi(get_env_setting("COREGL_TRACE_STATE")); #endif diff --git a/src/coregl_fastpath_egl.c b/src/coregl_fastpath_egl.c index a457cf9..f01580b 100644 --- a/src/coregl_fastpath_egl.c +++ b/src/coregl_fastpath_egl.c @@ -20,7 +20,7 @@ _dump_context_info(const char *ment, int force_output) AST(mutex_lock(&ctx_list_access_mutex) == 1); AST(mutex_lock(&general_trace_lists_access_mutex) == 1); - if (!force_output) + if (!force_output && !trace_ctx_force_flag) { struct timeval tv_now = { 0, 0 }; AST(gettimeofday(&tv_now, NULL) == 0); diff --git a/src/coregl_fastpath_gl.c b/src/coregl_fastpath_gl.c index eda3a4d..57d458a 100644 --- a/src/coregl_fastpath_gl.c +++ b/src/coregl_fastpath_gl.c @@ -18,8 +18,11 @@ #define INIT_FAST_GL_FUNC() \ tstate = get_current_thread_state(); \ - AST(tstate != NULL); \ - AST(tstate->cstate != NULL); \ + if (tstate == NULL || tstate->cstate == NULL) \ + { \ + ERR("\E[0;31;1mWARNING : '%s' called when GLES2 context is not binded (Check MakeCurrent)!\E[0m\n", __func__); \ + goto finish; \ + } \ current_ctx = (GLGlueContext *)tstate->cstate->data; \ AST(current_ctx != NULL); @@ -58,6 +61,10 @@ _set_gl_error(GLenum error) { current_ctx->gl_error = error; } + goto finish; + +finish: + return; } GLenum @@ -246,7 +253,7 @@ finish: GLboolean fpgl_glIsTexture(GLuint texture) { - GLboolean ret; + GLboolean ret = GL_FALSE; GLuint real_obj; DEFINE_FAST_GL_FUNC(); @@ -423,7 +430,7 @@ finish: GLboolean fpgl_glIsBuffer(GLuint buffer) { - GLboolean ret; + GLboolean ret = GL_FALSE; GLuint real_obj; DEFINE_FAST_GL_FUNC(); @@ -589,7 +596,7 @@ finish: GLboolean fpgl_glIsFramebuffer(GLuint framebuffer) { - GLboolean ret; + GLboolean ret = GL_FALSE; GLuint real_obj; DEFINE_FAST_GL_FUNC(); @@ -774,7 +781,7 @@ finish: GLboolean fpgl_glIsRenderbuffer(GLuint renderbuffer) { - GLboolean ret; + GLboolean ret = GL_FALSE; GLuint real_obj; DEFINE_FAST_GL_FUNC(); @@ -1068,7 +1075,7 @@ finish: GLboolean fpgl_glIsShader(GLuint shader) { - GLboolean ret; + GLboolean ret = GL_FALSE; GLuint real_obj; DEFINE_FAST_GL_FUNC(); @@ -1093,7 +1100,7 @@ finish: GLboolean fpgl_glIsProgram(GLuint program) { - GLboolean ret; + GLboolean ret = GL_FALSE; GLuint real_obj; DEFINE_FAST_GL_FUNC(); diff --git a/src/coregl_internal.h b/src/coregl_internal.h index 6d611de..57e10a2 100644 --- a/src/coregl_internal.h +++ b/src/coregl_internal.h @@ -154,6 +154,7 @@ extern Mutex general_trace_lists_access_mutex; extern int trace_api_flag; extern int trace_ctx_flag; +extern int trace_ctx_force_flag; extern int trace_state_flag; extern int debug_nofp; diff --git a/src/coregl_wrappath.c b/src/coregl_wrappath.c index e8f5fc7..1351d17 100644 --- a/src/coregl_wrappath.c +++ b/src/coregl_wrappath.c @@ -51,7 +51,7 @@ dump_wrap_context_states(int force_output) { static struct timeval tv_last = { 0, 0 }; - if (trace_ctx_flag != 1) return; + if (trace_state_flag != 1) return; _sym_glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, (GLint *)initial_fake_ctx->gl_num_tex_units); _sym_glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, (GLint *)initial_fake_ctx->gl_num_vertex_attribs);