diff options
author | jutty.lee <jutty.lee@samsung.com> | 2016-10-26 17:04:42 +0900 |
---|---|---|
committer | Haegeun Park <haegeun.park@samsung.com> | 2017-01-11 18:20:35 +0900 |
commit | 898699f4e29e53ec73ce733cabcbf6584ec3e6d2 (patch) | |
tree | 8585ba244672a59e4f7d350e674e7b9e1313736f | |
parent | dc4eaade3dd302d55818d24c4d9dd6238d0bbe14 (diff) | |
download | efl-898699f4e29e53ec73ce733cabcbf6584ec3e6d2.tar.gz |
evas/gl_common: (GL thread) Replace GL APIs in GL-backend to threaded APIs (1/4)
Replace GL API to threaded API ({GL API}_thread_cmd).
Split patch by modules :
- patch 1: Replace gl_common module
- patch 2: Replace gl_generic module
- patch 3: Replace gl_x11 module
- patch 4: Replace wayland_egl module
Change-Id: Ib4c9e901f8070279c5ced8b37abab3e410c7b094
-rw-r--r-- | src/modules/evas/engines/gl_common/evas_gl_3d.c | 118 | ||||
-rw-r--r-- | src/modules/evas/engines/gl_common/evas_gl_3d_renderer.c | 80 | ||||
-rw-r--r-- | src/modules/evas/engines/gl_common/evas_gl_3d_shader.c | 220 | ||||
-rw-r--r-- | src/modules/evas/engines/gl_common/evas_gl_api_gles1.c | 4 | ||||
-rw-r--r-- | src/modules/evas/engines/gl_common/evas_gl_common.h | 106 | ||||
-rw-r--r-- | src/modules/evas/engines/gl_common/evas_gl_context.c | 420 | ||||
-rw-r--r-- | src/modules/evas/engines/gl_common/evas_gl_file_cache.c | 6 | ||||
-rw-r--r-- | src/modules/evas/engines/gl_common/evas_gl_line.c | 2 | ||||
-rw-r--r-- | src/modules/evas/engines/gl_common/evas_gl_shader.c | 134 | ||||
-rw-r--r-- | src/modules/evas/engines/gl_common/evas_gl_texture.c | 222 |
10 files changed, 655 insertions, 657 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_3d.c b/src/modules/evas/engines/gl_common/evas_gl_3d.c index 83cc0738ee..c3ab287f4a 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_3d.c +++ b/src/modules/evas/engines/gl_common/evas_gl_3d.c @@ -34,15 +34,15 @@ e3d_texture_param_update(E3D_Texture *texture) { if (texture->wrap_dirty) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, texture->wrap_s); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, texture->wrap_t); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, texture->wrap_s); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, texture->wrap_t); texture->wrap_dirty = EINA_FALSE; } if (texture->filter_dirty) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, texture->filter_min); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, texture->filter_mag); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, texture->filter_min); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, texture->filter_mag); texture->filter_dirty = EINA_FALSE; } } @@ -282,22 +282,22 @@ e3d_texture_filter_get(const E3D_Texture *texture, static void _gen_texture_2d(GLuint *texture, GLenum wrap_type, GLfloat filter_type) { - glGenTextures(1, texture); - glBindTexture(GL_TEXTURE_2D, *texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap_type); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap_type); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter_type); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter_type); + evas_glGenTextures_th(1, texture); + evas_glBindTexture_th(GL_TEXTURE_2D, *texture); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap_type); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap_type); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter_type); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter_type); } static void _gen_depth_stencil_buffer(GLuint *buffer, GLenum format, GLenum attach, int size_w, int size_h) { - glGenRenderbuffers(1, buffer); - glBindRenderbuffer(GL_RENDERBUFFER, *buffer); - glRenderbufferStorage(GL_RENDERBUFFER, format, size_w, size_h); - glFramebufferRenderbuffer(GL_FRAMEBUFFER, attach, GL_RENDERBUFFER, *buffer); + evas_glGenRenderbuffers_th(1, buffer); + evas_glBindRenderbuffer_th(GL_RENDERBUFFER, *buffer); + evas_glRenderbufferStorage_th(GL_RENDERBUFFER, format, size_w, size_h); + evas_glFramebufferRenderbuffer_th(GL_FRAMEBUFFER, attach, GL_RENDERBUFFER, *buffer); } E3D_Drawable * @@ -312,32 +312,32 @@ e3d_drawable_new(int w, int h, int alpha, GLenum depth_format, GLenum stencil_fo _gen_texture_2d(&tex, GL_CLAMP_TO_EDGE, GL_NEAREST); if (alpha) - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + evas_glTexImage2D_th(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); else - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); + evas_glTexImage2D_th(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); _gen_texture_2d(&texDepth, GL_CLAMP_TO_EDGE, GL_NEAREST); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + evas_glTexImage2D_th(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); - glGenFramebuffers(1, &color_pick_fb_id); + evas_glGenFramebuffers_th(1, &color_pick_fb_id); _gen_texture_2d(&texcolorpick, GL_CLAMP_TO_EDGE, GL_NEAREST); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + evas_glTexImage2D_th(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); - glGenFramebuffers(1, &fbo); - glBindFramebuffer(GL_FRAMEBUFFER, fbo); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0); + evas_glGenFramebuffers_th(1, &fbo); + evas_glBindFramebuffer_th(GL_FRAMEBUFFER, fbo); + evas_glFramebufferTexture2D_th(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0); #ifdef GL_GLES if (depth_format == GL_DEPTH_STENCIL_OES) { _gen_texture_2d(&depth_stencil_buf, GL_CLAMP_TO_EDGE, GL_NEAREST); - glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_STENCIL_OES, w, h, 0, - GL_DEPTH_STENCIL_OES, GL_UNSIGNED_INT_24_8_OES, NULL); + evas_glTexImage2D_th(GL_TEXTURE_2D, 0, GL_DEPTH_STENCIL_OES, w, h, 0, + GL_DEPTH_STENCIL_OES, GL_UNSIGNED_INT_24_8_OES, NULL); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, - GL_TEXTURE_2D, depth_stencil_buf, 0); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, - GL_TEXTURE_2D, depth_stencil_buf, 0); + evas_glFramebufferTexture2D_th(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + GL_TEXTURE_2D, depth_stencil_buf, 0); + evas_glFramebufferTexture2D_th(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, + GL_TEXTURE_2D, depth_stencil_buf, 0); depth_stencil = EINA_TRUE; } @@ -356,7 +356,7 @@ e3d_drawable_new(int w, int h, int alpha, GLenum depth_format, GLenum stencil_fo if ((!depth_stencil) && (stencil_format)) _gen_depth_stencil_buffer(&stencil_buf, stencil_format, GL_STENCIL_ATTACHMENT, w, h); - if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) + if (evas_glCheckFramebufferStatus_th(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) goto error; drawable = (E3D_Drawable *)calloc(1, sizeof(E3D_Drawable)); @@ -389,31 +389,31 @@ error: ERR("Drawable creation failed."); if (tex) - glDeleteTextures(1, &tex); + evas_glDeleteTextures_th(1, &tex); if (texcolorpick) - glDeleteTextures(1, &texcolorpick); + evas_glDeleteTextures_th(1, &texcolorpick); if (texDepth) - glDeleteTextures(1, &texDepth); + evas_glDeleteTextures_th(1, &texDepth); if (fbo) - glDeleteFramebuffers(1, &fbo); + evas_glDeleteFramebuffers_th(1, &fbo); if (color_pick_fb_id) - glDeleteFramebuffers(1, &color_pick_fb_id); + evas_glDeleteFramebuffers_th(1, &color_pick_fb_id); if (depth_stencil_buf) { #ifdef GL_GLES - glDeleteTextures(1, &depth_stencil_buf); + evas_glDeleteTextures_th(1, &depth_stencil_buf); #else - glDeleteRenderbuffers(1, &depth_stencil_buf); + evas_glDeleteRenderbuffers_th(1, &depth_stencil_buf); #endif } if (depth_buf) - glDeleteRenderbuffers(1, &depth_buf); + evas_glDeleteRenderbuffers_th(1, &depth_buf); if (stencil_buf) - glDeleteRenderbuffers(1, &stencil_buf); + evas_glDeleteRenderbuffers_th(1, &stencil_buf); return NULL; @@ -426,25 +426,25 @@ e3d_drawable_free(E3D_Drawable *drawable) return; if (drawable->tex) - glDeleteTextures(1, &drawable->tex); + evas_glDeleteTextures_th(1, &drawable->tex); if (drawable->fbo) - glDeleteFramebuffers(1, &drawable->fbo); + evas_glDeleteFramebuffers_th(1, &drawable->fbo); if (drawable->depth_stencil_buf) { #ifdef GL_GLES - glDeleteTextures(1, &drawable->depth_stencil_buf); + evas_glDeleteTextures_th(1, &drawable->depth_stencil_buf); #else - glDeleteRenderbuffers(1, &drawable->depth_stencil_buf); + evas_glDeleteRenderbuffers_th(1, &drawable->depth_stencil_buf); #endif } if (drawable->depth_buf) - glDeleteRenderbuffers(1, &drawable->depth_buf); + evas_glDeleteRenderbuffers_th(1, &drawable->depth_buf); if (drawable->stencil_buf) - glDeleteRenderbuffers(1, &drawable->stencil_buf); + evas_glDeleteRenderbuffers_th(1, &drawable->stencil_buf); free(drawable); } @@ -1118,7 +1118,7 @@ _mesh_draw_data_build(E3D_Draw_Data *data, } /*Check possible quantity of texture units*/ int num, count = 0; - glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &num); + evas_glGetIntegerv_th(GL_MAX_TEXTURE_IMAGE_UNITS, &num); data->smap_sampler = num - 1; if (data->render_to_texture) @@ -1161,11 +1161,11 @@ void _shadowmap_render(E3D_Drawable *drawable, E3D_Renderer *renderer, Evas_Color c = {1.0, 1.0, 1.0, 1.0}; Eina_Matrix4 matrix_vp; - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(data->depth_offset, data->depth_constant); + evas_glEnable_th(GL_POLYGON_OFFSET_FILL); + evas_glPolygonOffset_th(data->depth_offset, data->depth_constant); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, - drawable->texDepth, 0); + evas_glFramebufferTexture2D_th(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, + drawable->texDepth, 0); e3d_renderer_clear(renderer, &c); @@ -1198,18 +1198,18 @@ void _shadowmap_render(E3D_Drawable *drawable, E3D_Renderer *renderer, } } - glDisable(GL_POLYGON_OFFSET_FILL); + evas_glDisable_th(GL_POLYGON_OFFSET_FILL); if (data->render_to_texture) { - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, - drawable->texcolorpick, 0); + evas_glFramebufferTexture2D_th(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, + drawable->texcolorpick, 0); e3d_renderer_clear(renderer, &data->bg_color); } else { - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, - drawable->tex, 0); + evas_glFramebufferTexture2D_th(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, + drawable->tex, 0); e3d_renderer_clear(renderer, &data->bg_color); } } @@ -1415,7 +1415,7 @@ e3d_drawable_scene_render_to_texture(E3D_Drawable *drawable, E3D_Renderer *rende else { _scene_render(drawable, renderer, data); //Just render scene in texture - glBindFramebuffer(GL_FRAMEBUFFER, drawable->fbo); + evas_glBindFramebuffer_th(GL_FRAMEBUFFER, drawable->fbo); /*Render full screen quard*/ if (data->post_processing) _scene_post_render(drawable, renderer, data); @@ -1430,15 +1430,15 @@ e3d_drawable_texture_pixel_color_get(GLuint tex EINA_UNUSED, int x, int y, { E3D_Drawable *d = (E3D_Drawable *)drawable; - glBindFramebuffer(GL_FRAMEBUFFER, d->color_pick_fb_id); + evas_glBindFramebuffer_th(GL_FRAMEBUFFER, d->color_pick_fb_id); GLubyte pixel[4] = {0, 0, 0, 0}; - glReadPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel); + evas_glReadPixels_th(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel); color->r = (double)pixel[0] / 255; color->g = (double)pixel[1] / 255; color->b = (double)pixel[2] / 255; - glBindFramebuffer(GL_FRAMEBUFFER, d->fbo); + evas_glBindFramebuffer_th(GL_FRAMEBUFFER, d->fbo); } void @@ -1450,7 +1450,7 @@ e3d_drawable_texture_rendered_pixels_get(GLuint tex EINA_UNUSED, int x, int y, i DATA32 pixel; int i, j, width = 0, up, bellow; - glReadPixels(x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, (GLubyte *)buffer); + evas_glReadPixels_th(x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, (GLubyte *)buffer); /*Due to returned pixels buffer filled as from the bottom left of the screen going up to the top right*/ diff --git a/src/modules/evas/engines/gl_common/evas_gl_3d_renderer.c b/src/modules/evas/engines/gl_common/evas_gl_3d_renderer.c index 2e4f885b77..e34ab93b15 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_3d_renderer.c +++ b/src/modules/evas/engines/gl_common/evas_gl_3d_renderer.c @@ -119,7 +119,7 @@ _renderer_vertex_attrib_array_enable(E3D_Renderer *renderer, int index) if (renderer->vertex_attrib_enable[index]) return; - glEnableVertexAttribArray(index); + evas_glEnableVertexAttribArray_th(index); renderer->vertex_attrib_enable[index] = EINA_TRUE; } @@ -129,7 +129,7 @@ _renderer_vertex_attrib_array_disable(E3D_Renderer *renderer, int index) if (!renderer->vertex_attrib_enable[index]) return; - glDisableVertexAttribArray(index); + evas_glDisableVertexAttribArray_th(index); renderer->vertex_attrib_enable[index] = EINA_FALSE; } @@ -137,8 +137,8 @@ static inline void _renderer_vertex_attrib_pointer_set(E3D_Renderer *renderer EINA_UNUSED, int index, const Evas_Canvas3D_Vertex_Buffer *buffer) { - glVertexAttribPointer(index, buffer->element_count, GL_FLOAT, - GL_FALSE, buffer->stride, buffer->data); + evas_glVertexAttribPointer_th(index, buffer->element_count, GL_FLOAT, + GL_FALSE, buffer->stride, buffer->data); } static inline void @@ -148,9 +148,9 @@ _renderer_elements_draw(E3D_Renderer *renderer EINA_UNUSED, Evas_Canvas3D_Vertex GLenum mode = _gl_assembly_get(assembly); if (format == EVAS_CANVAS3D_INDEX_FORMAT_UNSIGNED_BYTE) - glDrawElements(mode, count, GL_UNSIGNED_BYTE, indices); + evas_glDrawElements_th(mode, count, GL_UNSIGNED_BYTE, indices); else if (format == EVAS_CANVAS3D_INDEX_FORMAT_UNSIGNED_SHORT) - glDrawElements(mode, count, GL_UNSIGNED_SHORT, indices); + evas_glDrawElements_th(mode, count, GL_UNSIGNED_SHORT, indices); } static inline void @@ -159,7 +159,7 @@ _renderer_array_draw(E3D_Renderer *renderer EINA_UNUSED, { GLenum mode = _gl_assembly_get(assembly); - glDrawArrays(mode, 0, count); + evas_glDrawArrays_th(mode, 0, count); } static inline void @@ -169,7 +169,7 @@ _renderer_program_use(E3D_Renderer *renderer ,E3D_Program *program) if (renderer->program != prog) { - glUseProgram(prog); + evas_glUseProgram_th(prog); renderer->program = prog; } } @@ -185,8 +185,8 @@ _renderer_texture_bind(E3D_Renderer *renderer, E3D_Draw_Data *data) { if (renderer->textures[data->materials[i].sampler0] != data->materials[i].tex0) { - glActiveTexture(GL_TEXTURE0 + data->materials[i].sampler0); - glBindTexture(GL_TEXTURE_2D, data->materials[i].tex0->tex); + evas_glActiveTexture_th(GL_TEXTURE0 + data->materials[i].sampler0); + evas_glBindTexture_th(GL_TEXTURE_2D, data->materials[i].tex0->tex); e3d_texture_param_update(data->materials[i].tex0); renderer->textures[data->materials[i].sampler0] = data->materials[i].tex0; @@ -197,8 +197,8 @@ _renderer_texture_bind(E3D_Renderer *renderer, E3D_Draw_Data *data) { if (renderer->textures[data->materials[i].sampler1] != data->materials[i].tex1) { - glActiveTexture(GL_TEXTURE0 + data->materials[i].sampler1); - glBindTexture(GL_TEXTURE_2D, data->materials[i].tex1->tex); + evas_glActiveTexture_th(GL_TEXTURE0 + data->materials[i].sampler1); + evas_glBindTexture_th(GL_TEXTURE_2D, data->materials[i].tex1->tex); e3d_texture_param_update(data->materials[i].tex1); renderer->textures[data->materials[i].sampler1] = data->materials[i].tex1; @@ -207,14 +207,14 @@ _renderer_texture_bind(E3D_Renderer *renderer, E3D_Draw_Data *data) } if ((data->flags & E3D_SHADER_FLAG_SHADOWED) && (renderer->smap_sampler != data->smap_sampler)) { - glActiveTexture(GL_TEXTURE0 + data->smap_sampler); - glBindTexture(GL_TEXTURE_2D, renderer->texDepth); + evas_glActiveTexture_th(GL_TEXTURE0 + data->smap_sampler); + evas_glBindTexture_th(GL_TEXTURE_2D, renderer->texDepth); renderer->smap_sampler = data->smap_sampler; } if (renderer->render_to_texture) { - glActiveTexture(GL_TEXTURE0 + data->colortex_sampler); - glBindTexture(GL_TEXTURE_2D, renderer->texcolorpick); + evas_glActiveTexture_th(GL_TEXTURE0 + data->colortex_sampler); + evas_glBindTexture_th(GL_TEXTURE_2D, renderer->texcolorpick); renderer->colortex_sampler = data->colortex_sampler; } } @@ -226,12 +226,12 @@ _renderer_depth_test_enable(E3D_Renderer *renderer, Eina_Bool enable) { if (enable) { - glEnable(GL_DEPTH_TEST); + evas_glEnable_th(GL_DEPTH_TEST); /* Use default depth func. */ } else { - glDisable(GL_DEPTH_TEST); + evas_glDisable_th(GL_DEPTH_TEST); } renderer->depth_test_enable = enable; @@ -274,8 +274,8 @@ e3d_renderer_target_set(E3D_Renderer *renderer, E3D_Drawable *target) if (renderer->fbo == target->fbo) return; - glBindFramebuffer(GL_FRAMEBUFFER, target->fbo); - glViewport(0, 0, target->w, target->h); + evas_glBindFramebuffer_th(GL_FRAMEBUFFER, target->fbo); + evas_glViewport_th(0, 0, target->w, target->h); renderer->fbo = target->fbo; renderer->texDepth = target->texDepth; renderer->texcolorpick = target->texcolorpick; @@ -285,19 +285,19 @@ e3d_renderer_target_set(E3D_Renderer *renderer, E3D_Drawable *target) void e3d_renderer_color_pick_target_set(E3D_Renderer *renderer, E3D_Drawable *drawable) { - glBindFramebuffer(GL_FRAMEBUFFER, drawable->color_pick_fb_id); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, drawable->texcolorpick, 0); + evas_glBindFramebuffer_th(GL_FRAMEBUFFER, drawable->color_pick_fb_id); + evas_glFramebufferTexture2D_th(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, drawable->texcolorpick, 0); #ifdef GL_GLES - glBindRenderbuffer(GL_RENDERBUFFER, drawable->depth_stencil_buf); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, - GL_TEXTURE_2D, drawable->depth_stencil_buf, 0); + evas_glBindRenderbuffer_th(GL_RENDERBUFFER, drawable->depth_stencil_buf); + evas_glFramebufferTexture2D_th(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, + GL_TEXTURE_2D, drawable->depth_stencil_buf, 0); #else - glBindRenderbuffer(GL_RENDERBUFFER, drawable->depth_stencil_buf); - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, - GL_RENDERBUFFER, drawable->depth_stencil_buf); + evas_glBindRenderbuffer_th(GL_RENDERBUFFER, drawable->depth_stencil_buf); + evas_glFramebufferRenderbuffer_th(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, + GL_RENDERBUFFER, drawable->depth_stencil_buf); #endif - glViewport(0, 0, drawable->w, drawable->h); + evas_glViewport_th(0, 0, drawable->w, drawable->h); renderer->texDepth = drawable->texDepth; renderer->texcolorpick = drawable->texcolorpick; renderer->render_to_texture = EINA_TRUE; @@ -312,8 +312,8 @@ e3d_renderer_rendering_to_texture_get(E3D_Renderer *renderer) void e3d_renderer_clear(E3D_Renderer *renderer EINA_UNUSED, const Evas_Color *color) { - glClearColor(color->r, color->g, color->b, color->a); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + evas_glClearColor_th(color->r, color->g, color->b, color->a); + evas_glClear_th(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } void @@ -383,19 +383,19 @@ e3d_renderer_draw(E3D_Renderer *renderer, E3D_Draw_Data *data) if (data->blending) { - glEnable(GL_BLEND); - glBlendFunc(_gl_blend_func_get(data->blend_sfactor), _gl_blend_func_get(data->blend_dfactor)); + evas_glEnable_th(GL_BLEND); + evas_glBlendFunc_th(_gl_blend_func_get(data->blend_sfactor), _gl_blend_func_get(data->blend_dfactor)); } - else glDisable(GL_BLEND); + else evas_glDisable_th(GL_BLEND); #ifndef GL_GLES if (data->alpha_test_enabled) { - glEnable(GL_ALPHA_TEST); - glAlphaFunc(_gl_comparison_func_get(data->alpha_comparison), - (GLclampf)data->alpha_ref_value); + evas_glEnable_th(GL_ALPHA_TEST); + evas_glAlphaFunc_th(_gl_comparison_func_get(data->alpha_comparison), + (GLclampf)data->alpha_ref_value); } - else glDisable(GL_ALPHA_TEST); + else evas_glDisable_th(GL_ALPHA_TEST); #endif if (data->indices) @@ -412,7 +412,7 @@ e3d_renderer_draw(E3D_Renderer *renderer, E3D_Draw_Data *data) void e3d_renderer_flush(E3D_Renderer *renderer EINA_UNUSED) { - glFlush(); + evas_glFlush_th(); } GLint diff --git a/src/modules/evas/engines/gl_common/evas_gl_3d_shader.c b/src/modules/evas/engines/gl_common/evas_gl_3d_shader.c index 95be4a63fa..d289e15aec 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_3d_shader.c +++ b/src/modules/evas/engines/gl_common/evas_gl_3d_shader.c @@ -194,9 +194,9 @@ _shader_compile(GLuint shader, const char *src) { GLint ok = 0; - glShaderSource(shader, 1, &src, NULL); - glCompileShader(shader); - glGetShaderiv(shader, GL_COMPILE_STATUS, &ok); + evas_glShaderSource_th(shader, 1, &src, NULL); + evas_glCompileShader_th(shader); + evas_glGetShaderiv_th(shader, GL_COMPILE_STATUS, &ok); if (!ok) { @@ -204,9 +204,9 @@ _shader_compile(GLuint shader, const char *src) GLint len; GLsizei info_len; - glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &len); + evas_glGetShaderiv_th(shader, GL_INFO_LOG_LENGTH, &len); log_str = (GLchar *)malloc(len); - glGetShaderInfoLog(shader, len, &info_len, log_str); + evas_glGetShaderInfoLog_th(shader, len, &info_len, log_str); ERR("Shader compilation failed: %s", log_str); DBG("Shader source was:\n%s", src); free(log_str); @@ -223,34 +223,34 @@ _program_vertex_attrib_bind(E3D_Program *program) GLint index = 0; if (program->flags & E3D_SHADER_FLAG_VERTEX_POSITION) - glBindAttribLocation(program->prog, index++, "aPosition0"); + evas_glBindAttribLocation_th(program->prog, index++, "aPosition0"); if (program->flags & E3D_SHADER_FLAG_VERTEX_POSITION_BLEND) - glBindAttribLocation(program->prog, index++, "aPosition1"); + evas_glBindAttribLocation_th(program->prog, index++, "aPosition1"); if (program->flags & E3D_SHADER_FLAG_VERTEX_NORMAL) - glBindAttribLocation(program->prog, index++, "aNormal0"); + evas_glBindAttribLocation_th(program->prog, index++, "aNormal0"); if (program->flags & E3D_SHADER_FLAG_VERTEX_NORMAL_BLEND) - glBindAttribLocation(program->prog, index++, "aNormal1"); + evas_glBindAttribLocation_th(program->prog, index++, "aNormal1"); if (program->flags & E3D_SHADER_FLAG_VERTEX_TANGENT) - glBindAttribLocation(program->prog, index++, "aTangent0"); + evas_glBindAttribLocation_th(program->prog, index++, "aTangent0"); if (program->flags & E3D_SHADER_FLAG_VERTEX_TANGENT_BLEND) - glBindAttribLocation(program->prog, index++, "aTangent1"); + evas_glBindAttribLocation_th(program->prog, index++, "aTangent1"); if (program->flags & E3D_SHADER_FLAG_VERTEX_COLOR) - glBindAttribLocation(program->prog, index++, "aColor0"); + evas_glBindAttribLocation_th(program->prog, index++, "aColor0"); if (program->flags & E3D_SHADER_FLAG_VERTEX_COLOR_BLEND) - glBindAttribLocation(program->prog, index++, "aColor1"); + evas_glBindAttribLocation_th(program->prog, index++, "aColor1"); if (program->flags & E3D_SHADER_FLAG_VERTEX_TEXCOORD) - glBindAttribLocation(program->prog, index++, "aTexCoord0"); + evas_glBindAttribLocation_th(program->prog, index++, "aTexCoord0"); if (program->flags & E3D_SHADER_FLAG_VERTEX_TEXCOORD_BLEND) - glBindAttribLocation(program->prog, index++, "aTexCoord1"); + evas_glBindAttribLocation_th(program->prog, index++, "aTexCoord1"); } static inline Eina_Bool @@ -259,8 +259,8 @@ _program_build(E3D_Program *program, const char *vert_src, const char *frag_src) GLint ok = 0; /* Create OpenGL vertex & fragment shader object. */ - program->vert = glCreateShader(GL_VERTEX_SHADER); - program->frag = glCreateShader(GL_FRAGMENT_SHADER); + program->vert = evas_glCreateShader_th(GL_VERTEX_SHADER); + program->frag = evas_glCreateShader_th(GL_FRAGMENT_SHADER); /* Commpile vertex shader. */ if (!_shader_compile(program->vert, vert_src)) @@ -277,18 +277,18 @@ _program_build(E3D_Program *program, const char *vert_src, const char *frag_src) } /* Create OpenGL program object. */ - program->prog = glCreateProgram(); + program->prog = evas_glCreateProgram_th(); /* Attach shaders. */ - glAttachShader(program->prog, program->vert); - glAttachShader(program->prog, program->frag); + evas_glAttachShader_th(program->prog, program->vert); + evas_glAttachShader_th(program->prog, program->frag); _program_vertex_attrib_bind(program); /* Link program. */ - glLinkProgram(program->prog); + evas_glLinkProgram_th(program->prog); /* Check link status. */ - glGetProgramiv(program->prog, GL_LINK_STATUS, &ok); + evas_glGetProgramiv_th(program->prog, GL_LINK_STATUS, &ok); if (!ok) { @@ -296,9 +296,9 @@ _program_build(E3D_Program *program, const char *vert_src, const char *frag_src) GLint len = 0; GLsizei info_len; - glGetProgramiv(program->prog, GL_INFO_LOG_LENGTH, &len); + evas_glGetProgramiv_th(program->prog, GL_INFO_LOG_LENGTH, &len); log_str = (GLchar *)malloc(len); - glGetProgramInfoLog(program->prog, len, &info_len, log_str); + evas_glGetProgramInfoLog_th(program->prog, len, &info_len, log_str); ERR("Shader link failed.\n%s", log_str); free(log_str); return EINA_FALSE; @@ -376,7 +376,7 @@ _program_uniform_init(E3D_Program *program) int i; for (i = 0; i < E3D_UNIFORM_COUNT; i++) { - program->uniform_locations[i] = glGetUniformLocation(program->prog, uniform_names[i]); + program->uniform_locations[i] = evas_glGetUniformLocation_th(program->prog, uniform_names[i]); } } @@ -417,7 +417,7 @@ _uniform_upload(E3D_Uniform u, GLint loc, const E3D_Draw_Data *data) { \ float m[9]; \ UNIFORM_MATRIX3_FOREACH(m, data->materials[attrib].tex##tn->trans); \ - glUniformMatrix3fv(loc, 1, EINA_FALSE, &m[0]); \ + evas_glUniformMatrix3fv_th(loc, 1, EINA_FALSE, &m[0]); \ } switch (u) @@ -425,86 +425,86 @@ _uniform_upload(E3D_Uniform u, GLint loc, const E3D_Draw_Data *data) case E3D_UNIFORM_MATRIX_MVP: { float m[16]; UNIFORM_MATRIX4_FOREACH(m, data->matrix_mvp); - glUniformMatrix4fv(loc, 1, EINA_FALSE, &m[0]); + evas_glUniformMatrix4fv_th(loc, 1, EINA_FALSE, &m[0]); break; } case E3D_UNIFORM_MATRIX_MV: { float m[16]; UNIFORM_MATRIX4_FOREACH(m, data->matrix_mv); - glUniformMatrix4fv(loc, 1, EINA_FALSE, &m[0]); + evas_glUniformMatrix4fv_th(loc, 1, EINA_FALSE, &m[0]); break; } case E3D_UNIFORM_MATRIX_NORMAL: { float m[9]; UNIFORM_MATRIX3_FOREACH(m, data->matrix_normal); - glUniformMatrix3fv(loc, 1, EINA_FALSE, &m[0]); + evas_glUniformMatrix3fv_th(loc, 1, EINA_FALSE, &m[0]); break; } case E3D_UNIFORM_MATRIX_LIGHT: { float m[16]; UNIFORM_MATRIX4_FOREACH(m, data->matrix_light); - glUniformMatrix4fv(loc, 1, EINA_FALSE, &m[0]); + evas_glUniformMatrix4fv_th(loc, 1, EINA_FALSE, &m[0]); break; } case E3D_UNIFORM_POSITION_WEIGHT: - glUniform1f(loc, data->vertices[EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION].weight); + evas_glUniform1f_th(loc, data->vertices[EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION].weight); break; case E3D_UNIFORM_NORMAL_WEIGHT: - glUniform1f(loc, data->vertices[EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL].weight); + evas_glUniform1f_th(loc, data->vertices[EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL].weight); break; case E3D_UNIFORM_TANGENT_WEIGHT: - glUniform1f(loc, data->vertices[EVAS_CANVAS3D_VERTEX_ATTRIB_TANGENT].weight); + evas_glUniform1f_th(loc, data->vertices[EVAS_CANVAS3D_VERTEX_ATTRIB_TANGENT].weight); break; case E3D_UNIFORM_COLOR_WEIGHT: - glUniform1f(loc, data->vertices[EVAS_CANVAS3D_VERTEX_ATTRIB_COLOR].weight); + evas_glUniform1f_th(loc, data->vertices[EVAS_CANVAS3D_VERTEX_ATTRIB_COLOR].weight); break; case E3D_UNIFORM_TEXCOORD_WEIGHT: - glUniform1f(loc, data->vertices[EVAS_CANVAS3D_VERTEX_ATTRIB_TEXCOORD].weight); + evas_glUniform1f_th(loc, data->vertices[EVAS_CANVAS3D_VERTEX_ATTRIB_TEXCOORD].weight); break; case E3D_UNIFORM_TEXTURE_WEIGHT_AMBIENT: - glUniform1f(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT].texture_weight); + evas_glUniform1f_th(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT].texture_weight); break; case E3D_UNIFORM_TEXTURE_WEIGHT_DIFFUSE: - glUniform1f(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE].texture_weight); + evas_glUniform1f_th(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE].texture_weight); break; case E3D_UNIFORM_TEXTURE_WEIGHT_SPECULAR: - glUniform1f(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR].texture_weight); + evas_glUniform1f_th(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR].texture_weight); break; case E3D_UNIFORM_TEXTURE_WEIGHT_EMISSION: - glUniform1f(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_EMISSION].texture_weight); + evas_glUniform1f_th(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_EMISSION].texture_weight); break; case E3D_UNIFORM_TEXTURE_WEIGHT_NORMAL: - glUniform1f(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL].texture_weight); + evas_glUniform1f_th(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL].texture_weight); break; case E3D_UNIFORM_TEXTURE_AMBIENT0: - glUniform1i(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT].sampler0); + evas_glUniform1i_th(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT].sampler0); break; case E3D_UNIFORM_TEXTURE_DIFFUSE0: - glUniform1i(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE].sampler0); + evas_glUniform1i_th(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE].sampler0); break; case E3D_UNIFORM_TEXTURE_SPECULAR0: - glUniform1i(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR].sampler0); + evas_glUniform1i_th(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR].sampler0); break; case E3D_UNIFORM_TEXTURE_EMISSION0: - glUniform1i(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_EMISSION].sampler0); + evas_glUniform1i_th(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_EMISSION].sampler0); break; case E3D_UNIFORM_TEXTURE_NORMAL0: - glUniform1i(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL].sampler0); + evas_glUniform1i_th(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL].sampler0); break; case E3D_UNIFORM_TEXTURE_AMBIENT1: - glUniform1i(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT].sampler1); + evas_glUniform1i_th(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT].sampler1); break; case E3D_UNIFORM_TEXTURE_DIFFUSE1: - glUniform1i(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE].sampler1); + evas_glUniform1i_th(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE].sampler1); break; case E3D_UNIFORM_TEXTURE_SPECULAR1: - glUniform1i(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR].sampler1); + evas_glUniform1i_th(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR].sampler1); break; case E3D_UNIFORM_TEXTURE_EMISSION1: - glUniform1i(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_EMISSION].sampler1); + evas_glUniform1i_th(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_EMISSION].sampler1); break; case E3D_UNIFORM_TEXTURE_NORMAL1: - glUniform1i(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL].sampler1); + evas_glUniform1i_th(loc, data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_NORMAL].sampler1); break; case E3D_UNIFORM_TEXTURE_MATRIX_TRANSFORM_AMBIENT0: { SET_TEX_COORD_TRANSFORM_MATRIX(EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT, 0) @@ -547,104 +547,106 @@ _uniform_upload(E3D_Uniform u, GLint loc, const E3D_Draw_Data *data) break; } case E3D_UNIFORM_SHADOWMAP: - glUniform1i(loc, data->smap_sampler); + evas_glUniform1i_th(loc, data->smap_sampler); break; case E3D_UNIFORM_SHADOWS_PCF_STEP: - glUniform1f(loc, data->pcf_step); + evas_glUniform1f_th(loc, data->pcf_step); break; case E3D_UNIFORM_SHADOWS_PCF_SIZE: - glUniform1f(loc, data->pcf_size); + evas_glUniform1f_th(loc, data->pcf_size); break; case E3D_UNIFORM_SHADOWS_CONSTANT_BIAS: - glUniform1f(loc, data->constant_bias); + evas_glUniform1f_th(loc, data->constant_bias); break; case E3D_UNIFORM_LIGHT_POSITION: - glUniform4f(loc, data->light.position.x, data->light.position.y, - data->light.position.z, data->light.position.w); + evas_glUniform4f_th(loc, data->light.position.x, data->light.position.y, + data->light.position.z, data->light.position.w); break; case E3D_UNIFORM_LIGHT_SPOT_DIR: - glUniform3f(loc, data->light.spot_dir.x, data->light.spot_dir.y, data->light.spot_dir.z); + evas_glUniform3f_th(loc, data->light.spot_dir.x, data->light.spot_dir.y, + data->light.spot_dir.z); break; case E3D_UNIFORM_LIGHT_SPOT_EXP: - glUniform1f(loc, data->light.spot_exp); + evas_glUniform1f_th(loc, data->light.spot_exp); break; case E3D_UNIFORM_LIGHT_SPOT_CUTOFF_COS: - glUniform1f(loc, data->light.spot_cutoff_cos); + evas_glUniform1f_th(loc, data->light.spot_cutoff_cos); break; case E3D_UNIFORM_LIGHT_ATTENUATION: - glUniform3f(loc, data->light.atten.x, data->light.atten.y, data->light.atten.z); + evas_glUniform3f_th(loc, data->light.atten.x, data->light.atten.y, + data->light.atten.z); break; case E3D_UNIFORM_LIGHT_AMBIENT: - glUniform4f(loc, - data->light.ambient.r, data->light.ambient.g, - data->light.ambient.b, data->light.ambient.a); + evas_glUniform4f_th(loc, + data->light.ambient.r, data->light.ambient.g, + data->light.ambient.b, data->light.ambient.a); break; case E3D_UNIFORM_LIGHT_DIFFUSE: - glUniform4f(loc, - data->light.diffuse.r, data->light.diffuse.g, - data->light.diffuse.b, data->light.diffuse.a); + evas_glUniform4f_th(loc, + data->light.diffuse.r, data->light.diffuse.g, + data->light.diffuse.b, data->light.diffuse.a); break; case E3D_UNIFORM_LIGHT_SPECULAR: - glUniform4f(loc, - data->light.specular.r, data->light.specular.g, - data->light.specular.b, data->light.specular.a); + evas_glUniform4f_th(loc, + data->light.specular.r, data->light.specular.g, + data->light.specular.b, data->light.specular.a); break; case E3D_UNIFORM_MATERIAL_AMBIENT: - glUniform4f(loc, - data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT].color.r, - data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT].color.g, - data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT].color.b, - data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT].color.a); + evas_glUniform4f_th(loc, + data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT].color.r, + data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT].color.g, + data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT].color.b, + data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_AMBIENT].color.a); break; case E3D_UNIFORM_MATERIAL_DIFFUSE: - glUniform4f(loc, - data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE].color.r, - data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE].color.g, - data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE].color.b, - data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE].color.a); + evas_glUniform4f_th(loc, + data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE].color.r, + data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE].color.g, + data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE].color.b, + data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_DIFFUSE].color.a); break; case E3D_UNIFORM_MATERIAL_SPECULAR: - glUniform4f(loc, - data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR].color.r, - data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR].color.g, - data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR].color.b, - data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR].color.a); + evas_glUniform4f_th(loc, + data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR].color.r, + data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR].color.g, + data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR].color.b, + data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_SPECULAR].color.a); break; case E3D_UNIFORM_MATERIAL_EMISSION: - glUniform4f(loc, - data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_EMISSION].color.r, - data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_EMISSION].color.g, - data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_EMISSION].color.b, - data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_EMISSION].color.a); + evas_glUniform4f_th(loc, + data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_EMISSION].color.r, + data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_EMISSION].color.g, + data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_EMISSION].color.b, + data->materials[EVAS_CANVAS3D_MATERIAL_ATTRIB_EMISSION].color.a); break; case E3D_UNIFORM_MATERIAL_SHININESS: - glUniform1f(loc, data->shininess); + evas_glUniform1f_th(loc, data->shininess); break; case E3D_UNIFORM_FOG_FACTOR: - glUniform1f(loc, data->fog_color.a); + evas_glUniform1f_th(loc, data->fog_color.a); break; case E3D_UNIFORM_FOG_COLOR: - glUniform4f(loc, data->fog_color.r, data->fog_color.g, data->fog_color.b, 1); + evas_glUniform4f_th(loc, data->fog_color.r, data->fog_color.g, data->fog_color.b, 1); break; case E3D_UNIFORM_COLOR_PICK: - glUniform4f(loc, data->color_pick_key.r, data->color_pick_key.g, - data->color_pick_key.b, 1.0); + evas_glUniform4f_th(loc, data->color_pick_key.r, data->color_pick_key.g, + data->color_pick_key.b, 1.0); break; case E3D_UNIFORM_ALPHATEST_COMPARISON: - glUniform1i(loc, - (data->alpha_comparison ? data->alpha_comparison : EVAS_CANVAS3D_COMPARISON_GREATER)); + evas_glUniform1i_th(loc, + (data->alpha_comparison ? data->alpha_comparison : EVAS_CANVAS3D_COMPARISON_GREATER)); break; case E3D_UNIFORM_ALPHATEST_REFVALUE: - glUniform1f(loc, (data->alpha_ref_value ? data->alpha_ref_value : 0.0)); + evas_glUniform1f_th(loc, (data->alpha_ref_value ? data->alpha_ref_value : 0.0)); break; case E3D_UNIFORM_RENDER_TO_TEXTURE: - glUniform1i(loc, data->colortex_sampler); + evas_glUniform1i_th(loc, data->colortex_sampler); break; case E3D_UNIFORM_FRAME_SIZE_H: - glUniform1f(loc, data->frame_size_h); + evas_glUniform1f_th(loc, data->frame_size_h); break; case E3D_UNIFORM_FRAME_SIZE_W: - glUniform1f(loc, data->frame_size_w); + evas_glUniform1f_th(loc, data->frame_size_w); break; default: ERR("Invalid uniform ID."); @@ -683,9 +685,9 @@ e3d_program_new(Evas_Canvas3D_Shader_Mode mode, E3D_Shader_Flag flags) return NULL; } - program->prog = glCreateProgram(); - program->vert = glCreateShader(GL_VERTEX_SHADER); - program->frag = glCreateShader(GL_FRAGMENT_SHADER); + program->prog = evas_glCreateProgram_th(); + program->vert = evas_glCreateShader_th(GL_VERTEX_SHADER); + program->frag = evas_glCreateShader_th(GL_FRAGMENT_SHADER); program->mode = mode; program->flags = flags; @@ -707,13 +709,13 @@ e3d_program_new(Evas_Canvas3D_Shader_Mode mode, E3D_Shader_Flag flags) error: if (program->prog) - glDeleteProgram(program->prog); + evas_glDeleteProgram_th(program->prog); if (program->vert) - glDeleteShader(program->vert); + evas_glDeleteShader_th(program->vert); if (program->frag) - glDeleteShader(program->frag); + evas_glDeleteShader_th(program->frag); _shader_string_fini(&vert); _shader_string_fini(&frag); @@ -726,9 +728,9 @@ error: void e3d_program_free(E3D_Program *program) { - glDeleteProgram(program->prog); - glDeleteShader(program->vert); - glDeleteShader(program->frag); + evas_glDeleteProgram_th(program->prog); + evas_glDeleteShader_th(program->vert); + evas_glDeleteShader_th(program->frag); free(program); } diff --git a/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c b/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c index 0619c037ea..5c415db387 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c +++ b/src/modules/evas/engines/gl_common/evas_gl_api_gles1.c @@ -538,7 +538,7 @@ _evgl_gles1_glClear(GLbitfield mask) if (!(rsc->current_ctx->current_fbo)) //|| rsc->current_ctx->map_tex) { - /* Skip glClear() if clearing with transparent color + /* Skip glClear if clearing with transparent color * Note: There will be side effects if the object itself is not * marked as having an alpha channel! */ @@ -1138,7 +1138,7 @@ _evgl_gles1_glGetString(GLenum name) case GL_SHADING_LANGUAGE_VERSION: break; case GL_VERSION: - ret = glGetString(GL_VERSION); + ret = evas_glGetString_th(GL_VERSION); if (!ret) return NULL; #ifdef GL_GLES if (ret[13] != (GLubyte) '1') diff --git a/src/modules/evas/engines/gl_common/evas_gl_common.h b/src/modules/evas/engines/gl_common/evas_gl_common.h index 1c2fa65419..9600852fc2 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_common.h +++ b/src/modules/evas/engines/gl_common/evas_gl_common.h @@ -18,8 +18,6 @@ # define MESA_EGL_NO_X11_HEADERS #endif -#ifndef EVAS_GL_NO_HEADERS - #ifdef BUILD_ENGINE_GL_COCOA # include <OpenGL/gl.h> # include <OpenGL/glext.h> @@ -42,8 +40,6 @@ # endif #endif -#endif - #include "evas_gl_define.h" #define EVAS_GL_TILE_SIZE 16 @@ -805,7 +801,7 @@ __evas_gl_errdyn(int err, const char *file, const char *func, int line, const ch } # define GLERRV(op) \ { \ - int __gl_err = glGetError(); \ + int __gl_err = evas_glGetError_th(); \ if (__gl_err != GL_NO_ERROR) \ __evas_gl_errdyn(__gl_err, __FILE__, __FUNCTION__, __LINE__, op); \ } @@ -818,56 +814,56 @@ __evas_gl_errdyn(int err, const char *file, const char *func, int line, const ch # define GL_ERROR_TRACE(f, _args, ...) do { DBG("%s(%s);", #f, _args); f(__VA_ARGS__); GLERRV(#f); } while(0) # define GL_ERROR_TRACE_RET(t, f, _args, ...) ({ t _r; DBG("%s(%s);", #f, _args); _r = f(__VA_ARGS__); GLERRV(#f); _r; }) # endif -# define glActiveTexture(...) GL_ERROR_TRACE(glActiveTexture, #__VA_ARGS__, __VA_ARGS__) -# define glBindAttribLocation(...) GL_ERROR_TRACE(glBindAttribLocation, #__VA_ARGS__, __VA_ARGS__) -# define glBindBuffer(...) GL_ERROR_TRACE(glBindBuffer, #__VA_ARGS__, __VA_ARGS__) -# define glBindTexture(...) GL_ERROR_TRACE(glBindTexture, #__VA_ARGS__, __VA_ARGS__) -# define glBlendFunc(...) GL_ERROR_TRACE(glBlendFunc, #__VA_ARGS__, __VA_ARGS__) -# define glBufferData(...) GL_ERROR_TRACE(glBufferData, #__VA_ARGS__, __VA_ARGS__) -# define glCompressedTexSubImage2D(...) GL_ERROR_TRACE(glCompressedTexSubImage2D, #__VA_ARGS__, __VA_ARGS__) -# define glDeleteBuffers(...) GL_ERROR_TRACE(glDeleteBuffers, #__VA_ARGS__, __VA_ARGS__) -# define glDepthMask(...) GL_ERROR_TRACE(glDepthMask, #__VA_ARGS__, __VA_ARGS__) -# define glDisable(...) GL_ERROR_TRACE(glDisable, #__VA_ARGS__, __VA_ARGS__) -# define glDisableVertexAttribArray(...) GL_ERROR_TRACE(glDisableVertexAttribArray, #__VA_ARGS__, __VA_ARGS__) -# define glDrawArrays(...) GL_ERROR_TRACE(glDrawArrays, #__VA_ARGS__, __VA_ARGS__) -# define glEnable(...) GL_ERROR_TRACE(glEnable, #__VA_ARGS__, __VA_ARGS__) -# define glEnableVertexAttribArray(...) GL_ERROR_TRACE(glEnableVertexAttribArray, #__VA_ARGS__, __VA_ARGS__) -# define glGenBuffers(...) GL_ERROR_TRACE(glGenBuffers, #__VA_ARGS__, __VA_ARGS__) -# define glGetFloatv(...) GL_ERROR_TRACE(glGetFloatv, #__VA_ARGS__, __VA_ARGS__) -# define glGetIntegerv(...) GL_ERROR_TRACE(glGetIntegerv, #__VA_ARGS__, __VA_ARGS__) -# define glGetUniformLocation(...) GL_ERROR_TRACE_RET(GLuint, glGetUniformLocation, #__VA_ARGS__, __VA_ARGS__) -# define glHint(...) GL_ERROR_TRACE(glHint, #__VA_ARGS__, __VA_ARGS__) -# define glReadPixels(...) GL_ERROR_TRACE(glReadPixels, #__VA_ARGS__, __VA_ARGS__) -# define glScissor(...) GL_ERROR_TRACE(glScissor, #__VA_ARGS__, __VA_ARGS__) -# define glGenFramebuffers(...) GL_ERROR_TRACE(glGenFramebuffers, #__VA_ARGS__, __VA_ARGS__) -# define glBindFramebuffer(...) GL_ERROR_TRACE(glBindFramebuffer, #__VA_ARGS__, __VA_ARGS__) -# define glEndTiling(...) GL_ERROR_TRACE(glEndTiling, #__VA_ARGS__, __VA_ARGS__) -# define glGetProgramBinary(...) GL_ERROR_TRACE(glGetProgramBinary, #__VA_ARGS__, __VA_ARGS__) -# define glMapBuffer(...) GL_ERROR_TRACE_RET(void *, glMapBuffer, #__VA_ARGS__, __VA_ARGS__) -# define glStartTiling(...) GL_ERROR_TRACE(glStartTiling, #__VA_ARGS__, __VA_ARGS__) -# define glUnmapBuffer(...) GL_ERROR_TRACE(glUnmapBuffer, #__VA_ARGS__, __VA_ARGS__) -# define glTexParameterf(...) GL_ERROR_TRACE(glTexParameterf, #__VA_ARGS__, __VA_ARGS__) -# define glTexParameteri(...) GL_ERROR_TRACE(glTexParameteri, #__VA_ARGS__, __VA_ARGS__) -# define glTexSubImage2D(...) GL_ERROR_TRACE(glTexSubImage2D, #__VA_ARGS__, __VA_ARGS__) -# define glUniform1f(...) GL_ERROR_TRACE(glUniform1f, #__VA_ARGS__, __VA_ARGS__) -# define glUniform1i(...) GL_ERROR_TRACE(glUniform1i, #__VA_ARGS__, __VA_ARGS__) -# define glUniform2fv(...) GL_ERROR_TRACE(glUniform2fv, #__VA_ARGS__, __VA_ARGS__) -# define glUniform4fv(...) GL_ERROR_TRACE(glUniform4fv, #__VA_ARGS__, __VA_ARGS__) -# define glUniformMatrix4fv(...) GL_ERROR_TRACE(glUniformMatrix4fv, #__VA_ARGS__, __VA_ARGS__) -# define glUseProgram(...) GL_ERROR_TRACE(glUseProgram, #__VA_ARGS__, __VA_ARGS__) -# define glVertexAttribPointer(...) GL_ERROR_TRACE(glVertexAttribPointer, #__VA_ARGS__, __VA_ARGS__) -# define glViewport(...) GL_ERROR_TRACE(glViewport, #__VA_ARGS__, __VA_ARGS__) -# define glPixelStorei(...) GL_ERROR_TRACE(glPixelStorei, #__VA_ARGS__, __VA_ARGS__) -# define glCompressedTexImage2D(...) GL_ERROR_TRACE(glCompressedTexImage2D, #__VA_ARGS__, __VA_ARGS__) -# define glCreateShader(...) GL_ERROR_TRACE_RET(GLuint, glCreateShader, #__VA_ARGS__, __VA_ARGS__) -# define glCreateProgram(...) GL_ERROR_TRACE_RET(GLuint, glCreateProgram, #__VA_ARGS__, __VA_ARGS__) -# define glAttachShader(...) GL_ERROR_TRACE(glAttachShader, #__VA_ARGS__, __VA_ARGS__) -# define glLinkProgram(...) GL_ERROR_TRACE(glLinkProgram, #__VA_ARGS__, __VA_ARGS__) -# define glGetProgramiv(...) GL_ERROR_TRACE(glGetProgramiv, #__VA_ARGS__, __VA_ARGS__) -# define glGetProgramInfoLog(...) GL_ERROR_TRACE(glGetProgramInfoLog, #__VA_ARGS__, __VA_ARGS__) -# define glGetShaderiv(...) GL_ERROR_TRACE(glGetShaderiv, #__VA_ARGS__, __VA_ARGS__) -# define glShaderSource(...) GL_ERROR_TRACE(glShaderSource, #__VA_ARGS__, __VA_ARGS__) -# define glCompileShader(...) GL_ERROR_TRACE(glCompileShader, #__VA_ARGS__, __VA_ARGS__) +# define glActiveTexture(...) GL_ERROR_TRACE(evas_glActiveTexture_th, #__VA_ARGS__, __VA_ARGS__) +# define glBindAttribLocation(...) GL_ERROR_TRACE(evas_glBindAttribLocation_th, #__VA_ARGS__, __VA_ARGS__) +# define glBindBuffer(...) GL_ERROR_TRACE(evas_glBindBuffer_th, #__VA_ARGS__, __VA_ARGS__) +# define glBindTexture(...) GL_ERROR_TRACE(evas_glBindTexture_th, #__VA_ARGS__, __VA_ARGS__) +# define glBlendFunc(...) GL_ERROR_TRACE(evas_glBlendFunc_th, #__VA_ARGS__, __VA_ARGS__) +# define glBufferData(...) GL_ERROR_TRACE(evas_glBufferData_th, #__VA_ARGS__, __VA_ARGS__) +# define glCompressedTexSubImage2D(...) GL_ERROR_TRACE(evas_glCompressedTexSubImage2D_th, #__VA_ARGS__, __VA_ARGS__) +# define glDeleteBuffers(...) GL_ERROR_TRACE(evas_glDeleteBuffers_th, #__VA_ARGS__, __VA_ARGS__) +# define glDepthMask(...) GL_ERROR_TRACE(evas_glDepthMask_th, #__VA_ARGS__, __VA_ARGS__) +# define glDisable(...) GL_ERROR_TRACE(evas_glDisable_th, #__VA_ARGS__, __VA_ARGS__) +# define glDisableVertexAttribArray(...) GL_ERROR_TRACE(evas_glDisableVertexAttribArray_th, #__VA_ARGS__, __VA_ARGS__) +# define glDrawArrays(...) GL_ERROR_TRACE(evas_glDrawArrays_th, #__VA_ARGS__, __VA_ARGS__) +# define glEnable(...) GL_ERROR_TRACE(evas_glEnable_th, #__VA_ARGS__, __VA_ARGS__) +# define glEnableVertexAttribArray(...) GL_ERROR_TRACE(evas_glEnableVertexAttribArray_th, #__VA_ARGS__, __VA_ARGS__) +# define glGenBuffers(...) GL_ERROR_TRACE(evas_glGenBuffers_th, #__VA_ARGS__, __VA_ARGS__) +# define glGetFloatv(...) GL_ERROR_TRACE(evas_glGetFloatv_th, #__VA_ARGS__, __VA_ARGS__) +# define glGetIntegerv(...) GL_ERROR_TRACE(evas_glGetIntegerv_th, #__VA_ARGS__, __VA_ARGS__) +# define glGetUniformLocation(...) GL_ERROR_TRACE_RET(GLuint, evas_glGetUniformLocation_th, #__VA_ARGS__, __VA_ARGS__) +# define glHint(...) GL_ERROR_TRACE(evas_glHint_th, #__VA_ARGS__, __VA_ARGS__) +# define glReadPixels(...) GL_ERROR_TRACE(evas_glReadPixels_th, #__VA_ARGS__, __VA_ARGS__) +# define glScissor(...) GL_ERROR_TRACE(evas_glScissor_th, #__VA_ARGS__, __VA_ARGS__) +# define glGenFramebuffers(...) GL_ERROR_TRACE(evas_glGenFramebuffers_th, #__VA_ARGS__, __VA_ARGS__) +# define glBindFramebuffer(...) GL_ERROR_TRACE(evas_glBindFramebuffer_th, #__VA_ARGS__, __VA_ARGS__) +# define glEndTiling(...) GL_ERROR_TRACE(evas_glEndTiling_th, #__VA_ARGS__, __VA_ARGS__) +# define glGetProgramBinary(...) GL_ERROR_TRACE(evas_glGetProgramBinary_th, #__VA_ARGS__, __VA_ARGS__) +# define glMapBuffer(...) GL_ERROR_TRACE_RET(void *, evas_glMapBuffer_th, #__VA_ARGS__, __VA_ARGS__) +# define glStartTiling(...) GL_ERROR_TRACE(evas_glStartTiling_th, #__VA_ARGS__, __VA_ARGS__) +# define glUnmapBuffer(...) GL_ERROR_TRACE(evas_glUnmapBuffer_th, #__VA_ARGS__, __VA_ARGS__) +# define glTexParameterf(...) GL_ERROR_TRACE(evas_glTexParameterf_th, #__VA_ARGS__, __VA_ARGS__) +# define glTexParameteri(...) GL_ERROR_TRACE(evas_glTexParameteri_th, #__VA_ARGS__, __VA_ARGS__) +# define glTexSubImage2D(...) GL_ERROR_TRACE(evas_glTexSubImage2D_th, #__VA_ARGS__, __VA_ARGS__) +# define glUniform1f(...) GL_ERROR_TRACE(evas_glUniform1f_th, #__VA_ARGS__, __VA_ARGS__) +# define glUniform1i(...) GL_ERROR_TRACE(evas_glUniform1i_th, #__VA_ARGS__, __VA_ARGS__) +# define glUniform2fv(...) GL_ERROR_TRACE(evas_glUniform2fv_th, #__VA_ARGS__, __VA_ARGS__) +# define glUniform4fv(...) GL_ERROR_TRACE(evas_glUniform4fv_th, #__VA_ARGS__, __VA_ARGS__) +# define glUniformMatrix4fv(...) GL_ERROR_TRACE(evas_glUniformMatrix4fv_th, #__VA_ARGS__, __VA_ARGS__) +# define glUseProgram(...) GL_ERROR_TRACE(evas_glUseProgram_th, #__VA_ARGS__, __VA_ARGS__) +# define glVertexAttribPointer(...) GL_ERROR_TRACE(evas_glVertexAttribPointer_th, #__VA_ARGS__, __VA_ARGS__) +# define glViewport(...) GL_ERROR_TRACE(evas_glViewport_th, #__VA_ARGS__, __VA_ARGS__) +# define glPixelStorei(...) GL_ERROR_TRACE(evas_glPixelStorei_th, #__VA_ARGS__, __VA_ARGS__) +# define glCompressedTexImage2D(...) GL_ERROR_TRACE(evas_glCompressedTexImage2D_th, #__VA_ARGS__, __VA_ARGS__) +# define glCreateShader(...) GL_ERROR_TRACE_RET(GLuint, evas_glCreateShader_th, #__VA_ARGS__, __VA_ARGS__) +# define glCreateProgram(...) GL_ERROR_TRACE_RET(GLuint, evas_glCreateProgram_th, #__VA_ARGS__, __VA_ARGS__) +# define glAttachShader(...) GL_ERROR_TRACE(evas_glAttachShader_th, #__VA_ARGS__, __VA_ARGS__) +# define glLinkProgram(...) GL_ERROR_TRACE(evas_glLinkProgram_th, #__VA_ARGS__, __VA_ARGS__) +# define glGetProgramiv(...) GL_ERROR_TRACE(evas_glGetProgramiv_th, #__VA_ARGS__, __VA_ARGS__) +# define glGetProgramInfoLog(...) GL_ERROR_TRACE(evas_glGetProgramInfoLog_th, #__VA_ARGS__, __VA_ARGS__) +# define glGetShaderiv(...) GL_ERROR_TRACE(evas_glGetShaderiv_th, #__VA_ARGS__, __VA_ARGS__) +# define glShaderSource(...) GL_ERROR_TRACE(evas_glShaderSource_th, #__VA_ARGS__, __VA_ARGS__) +# define glCompileShader(...) GL_ERROR_TRACE(evas_glCompileShader_th, #__VA_ARGS__, __VA_ARGS__) # define glsym_glGenFramebuffers(...) GL_ERROR_TRACE(glsym_glGenFramebuffers, #__VA_ARGS__, __VA_ARGS__) # define glsym_glBindFramebuffer(...) GL_ERROR_TRACE(glsym_glBindFramebuffer, #__VA_ARGS__, __VA_ARGS__) # define glsym_glFramebufferTexture2D(...) GL_ERROR_TRACE(glsym_glFramebufferTexture2D, #__VA_ARGS__, __VA_ARGS__) diff --git a/src/modules/evas/engines/gl_common/evas_gl_context.c b/src/modules/evas/engines/gl_common/evas_gl_context.c index dc04597cbc..12efbf53c3 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_context.c +++ b/src/modules/evas/engines/gl_common/evas_gl_context.c @@ -94,7 +94,7 @@ _has_ext(const char *ext, const char **pexts, int *pnum) GLint num = *pnum, k; if (!num) { - glGetIntegerv(GL_NUM_EXTENSIONS, &num); + evas_glGetIntegerv_th(GL_NUM_EXTENSIONS, &num); *pnum = num; } for (k = 0; k < num; k++) @@ -110,7 +110,7 @@ _has_ext(const char *ext, const char **pexts, int *pnum) const char *exts = *pexts; if (!exts) { - exts = (const char *) glGetString(GL_EXTENSIONS); + exts = (const char *) evas_glGetString_th(GL_EXTENSIONS); if (!exts) return EINA_FALSE; *pexts = exts; } @@ -394,7 +394,7 @@ __evas_gl_err(int err, const char *file, const char *func, int line, const char #ifdef GL_INVALID_FRAMEBUFFER_OPERATION case GL_INVALID_FRAMEBUFFER_OPERATION: { - GLenum e = glCheckFramebufferStatus(GL_FRAMEBUFFER); + GLenum e = evas_glCheckFramebufferStatus_th(GL_FRAMEBUFFER); switch (e) { #ifdef GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT @@ -505,7 +505,7 @@ _evas_gl_common_version_check(int *gles_ver) * GL_VERSION is used to get the version of the connection */ - version = (char *)glGetString(GL_VERSION); + version = (char *)evas_glGetString_th(GL_VERSION); if (!version) { /* Something is wrong! */ @@ -567,7 +567,7 @@ _evas_gl_common_version_check(int *gles_ver) * version number and the vendor-specific information. */ - /* glGetString() returns a static string, and we are going to */ + /* glGetString returns a static string, and we are going to */ /* modify it, so we get a copy first */ version = strdup(version); if (!version) @@ -675,9 +675,9 @@ _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc) if (foc == 0) { if ((rot == 0) || (rot == 180)) - glViewport(offx, offy, w, h); + evas_glViewport_th(offx, offy, w, h); else - glViewport(offx, offy, h, w); + evas_glViewport_th(offx, offy, h, w); // std matrix if (m == 1) matrix_ortho(gc->shared->proj, @@ -739,9 +739,9 @@ _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc) if (m == -1) ay = vy * 2; if ((rot == 0) || (rot == 180)) - glViewport(offx + (-2 * vx), offy + (-2 * vy), vw, vh); + evas_glViewport_th(offx + (-2 * vx), offy + (-2 * vy), vw, vh); else - glViewport(offx + (-2 * vy), offy + (-2 * vx), vh, vw); + evas_glViewport_th(offx + (-2 * vy), offy + (-2 * vx), vh, vw); if (m == 1) matrix_ortho(gc->shared->proj, 0, vw, 0, vh, @@ -767,9 +767,9 @@ _evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc) if (gc->state.current.prog != PRG_INVALID) { prog = gc->state.current.prog; - glUseProgram(prog->prog); - glUniform1i(prog->uniform.rotation_id, gc->rot / 90); - glUniformMatrix4fv(prog->uniform.mvp, 1, GL_FALSE, gc->shared->proj); + evas_glUseProgram_th(prog->prog); + evas_glUniform1i_th(prog->uniform.rotation_id, gc->rot / 90); + evas_glUniformMatrix4fv_th(prog->uniform.mvp, 1, GL_FALSE, gc->shared->proj); } } @@ -808,7 +808,7 @@ evas_gl_common_context_new(void) gc->pipe[i].shader.render_op = EVAS_RENDER_BLEND; if (glsym_glMapBuffer && glsym_glUnmapBuffer) { - glGenBuffers(1, &gc->pipe[i].array.buffer); + evas_glGenBuffers_th(1, &gc->pipe[i].array.buffer); gc->pipe[i].array.buffer_alloc = 0; gc->pipe[i].array.buffer_use = 0; } @@ -821,7 +821,7 @@ evas_gl_common_context_new(void) const char *ext; shared = calloc(1, sizeof(Evas_GL_Shared)); - ext = (const char *) glGetString(GL_EXTENSIONS); + ext = (const char *) evas_glGetString_th(GL_EXTENSIONS); if (ext) { if (getenv("EVAS_GL_INFO")) @@ -849,8 +849,8 @@ evas_gl_common_context_new(void) #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT if ((strstr(ext, "GL_EXT_texture_filter_anisotropic"))) - glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, - &(shared->info.anisotropic)); + evas_glGetFloatv_th(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, + &(shared->info.anisotropic)); #endif #ifdef GL_BGRA if ((strstr(ext, "GL_EXT_bgra")) || @@ -894,15 +894,15 @@ evas_gl_common_context_new(void) glsym_glEndTiling = NULL; } } - glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, - &(shared->info.max_texture_units)); - glGetIntegerv(GL_MAX_TEXTURE_SIZE, - &(shared->info.max_texture_size)); + evas_glGetIntegerv_th(GL_MAX_TEXTURE_IMAGE_UNITS, + &(shared->info.max_texture_units)); + evas_glGetIntegerv_th(GL_MAX_TEXTURE_SIZE, + &(shared->info.max_texture_size)); shared->info.max_vertex_elements = 6 * 100000; #ifdef GL_MAX_ELEMENTS_VERTICES /* only applies to glDrawRangeElements. don't really need to get it. - glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, - &(shared->info.max_vertex_elements)); + evas_glGetIntegerv_th(GL_MAX_ELEMENTS_VERTICES, + &(shared->info.max_vertex_elements)); */ #endif s = getenv("EVAS_GL_VERTEX_MAX"); @@ -920,7 +920,7 @@ evas_gl_common_context_new(void) shared->info.tune.atlas.max_h = DEF_ATLAS_H; // per gpu hacks. based on impirical measurement of some known gpu's - s = (const char *)glGetString(GL_RENDERER); + s = (const char *)evas_glGetString_th(GL_RENDERER); if (s) { if (strstr(s, "PowerVR SGX 540")) @@ -964,14 +964,14 @@ evas_gl_common_context_new(void) // Detect ECT2 support. We need both RGB and RGBA formats. { GLint texFormatCnt = 0; - glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &texFormatCnt); + evas_glGetIntegerv_th(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &texFormatCnt); if (texFormatCnt > 0) { GLenum *texFormats = malloc(texFormatCnt * sizeof(GLenum)); if (texFormats) { int k, cnt = 0; - glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, (GLint *) texFormats); + evas_glGetIntegerv_th(GL_COMPRESSED_TEXTURE_FORMATS, (GLint *) texFormats); for (k = 0; k < texFormatCnt && cnt < 2; k++) { if (texFormats[k] == GL_COMPRESSED_RGB8_ETC2) @@ -1043,40 +1043,40 @@ evas_gl_common_context_new(void) (int)shared->info.tune.atlas.max_w, (int)shared->info.tune.atlas.max_h ); - glDisable(GL_DEPTH_TEST); - glEnable(GL_DITHER); - glDisable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + evas_glDisable_th(GL_DEPTH_TEST); + evas_glEnable_th(GL_DITHER); + evas_glDisable_th(GL_BLEND); + evas_glBlendFunc_th(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); // no dest alpha -// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // dest alpha -// glBlendFunc(GL_SRC_ALPHA, GL_ONE); // ??? - glDepthMask(GL_FALSE); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); +// evas_glBlendFunc_th(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // dest alpha +// evas_glBlendFunc_th(GL_SRC_ALPHA, GL_ONE); // ??? + evas_glDepthMask_th(GL_FALSE); + + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT if (shared->info.anisotropic > 0.0) - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0); + evas_glTexParameterf_th(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0); #endif - glEnableVertexAttribArray(SHAD_VERTEX); - glEnableVertexAttribArray(SHAD_COLOR); + evas_glEnableVertexAttribArray_th(SHAD_VERTEX); + evas_glEnableVertexAttribArray_th(SHAD_COLOR); if (!evas_gl_common_shader_program_init(shared)) goto error; if (gc->state.current.prog) - glUseProgram(gc->state.current.prog->prog); + evas_glUseProgram_th(gc->state.current.prog->prog); // in shader: // uniform sampler2D tex[8]; // // in code: // GLuint texes[8]; - // GLint loc = glGetUniformLocation(prog, "tex"); - // glUniform1iv(loc, 8, texes); + // GLint loc = evas_glGetUniformLocation_th(prog, "tex"); + // evas_glUniform1iv_th(loc, 8, texes); shared->native_pm_hash = eina_hash_int32_new(NULL); shared->native_tex_hash = eina_hash_int32_new(NULL); @@ -1115,7 +1115,7 @@ evas_gl_common_context_free(Evas_Engine_GL_Context *gc) if (glsym_glMapBuffer && glsym_glUnmapBuffer) { for (i = 0; i < MAX_PIPES; i++) - glDeleteBuffers(1, &gc->pipe[i].array.buffer); + evas_glDeleteBuffers_th(1, &gc->pipe[i].array.buffer); } if (gc->shared) @@ -1245,34 +1245,34 @@ evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc) } gc->change.size = 1; - glDisable(GL_SCISSOR_TEST); - glScissor(0, 0, 0, 0); + evas_glDisable_th(GL_SCISSOR_TEST); + evas_glScissor_th(0, 0, 0, 0); - glDisable(GL_DEPTH_TEST); - glEnable(GL_DITHER); - glDisable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + evas_glDisable_th(GL_DEPTH_TEST); + evas_glEnable_th(GL_DITHER); + evas_glDisable_th(GL_BLEND); + evas_glBlendFunc_th(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); // no dest alpha -// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // dest alpha -// glBlendFunc(GL_SRC_ALPHA, GL_ONE); // ??? - glDepthMask(GL_FALSE); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); +// evas_glBlendFunc_th(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // dest alpha +// evas_glBlendFunc_th(GL_SRC_ALPHA, GL_ONE); // ??? + evas_glDepthMask_th(GL_FALSE); + + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT if (shared->info.anisotropic > 0.0) - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0); + evas_glTexParameterf_th(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0); #endif - glEnableVertexAttribArray(SHAD_VERTEX); - glEnableVertexAttribArray(SHAD_COLOR); + evas_glEnableVertexAttribArray_th(SHAD_VERTEX); + evas_glEnableVertexAttribArray_th(SHAD_COLOR); if (gc->state.current.prog != PRG_INVALID) - glUseProgram(gc->state.current.prog->prog); + evas_glUseProgram_th(gc->state.current.prog->prog); - glActiveTexture(GL_TEXTURE0); - glBindTexture(gc->pipe[0].shader.tex_target, gc->pipe[0].shader.cur_tex); + evas_glActiveTexture_th(GL_TEXTURE0); + evas_glBindTexture_th(gc->pipe[0].shader.tex_target, gc->pipe[0].shader.cur_tex); _evas_gl_common_viewport_set(gc); } @@ -2989,19 +2989,19 @@ scissor_rot(Evas_Engine_GL_Context *gc EINA_UNUSED, switch (rot) { case 0: // UP this way: ^ - glScissor(cx, cy, cw, ch); + evas_glScissor_th(cx, cy, cw, ch); break; case 90: // UP this way: < - glScissor(gh - (cy + ch), cx, ch, cw); + evas_glScissor_th(gh - (cy + ch), cx, ch, cw); break; case 180: // UP this way: v - glScissor(gw - (cx + cw), gh - (cy + ch), cw, ch); + evas_glScissor_th(gw - (cx + cw), gh - (cy + ch), cw, ch); break; case 270: // UP this way: > - glScissor(cy, gw - (cx + cw), ch, cw); + evas_glScissor_th(cy, gw - (cx + cw), ch, cw); break; default: // assume up is up - glScissor(cx, cy, cw, ch); + evas_glScissor_th(cx, cy, cw, ch); break; } } @@ -3067,11 +3067,11 @@ shader_array_flush(Evas_Engine_GL_Context *gc) GLERRV("<flush err>"); if (prog && (prog != gc->state.current.prog)) { - glUseProgram(prog->prog); + evas_glUseProgram_th(prog->prog); if (prog->reset) { - glUniform1i(prog->uniform.rotation_id, gc->rot / 90); - glUniformMatrix4fv(prog->uniform.mvp, 1, GL_FALSE, gc->shared->proj); + evas_glUniform1i_th(prog->uniform.rotation_id, gc->rot / 90); + evas_glUniformMatrix4fv_th(prog->uniform.mvp, 1, GL_FALSE, gc->shared->proj); prog->reset = EINA_FALSE; } } @@ -3081,15 +3081,15 @@ shader_array_flush(Evas_Engine_GL_Context *gc) #if 0 if (gc->pipe[i].shader.cur_tex) { - glEnable(GL_TEXTURE_2D); + evas_glEnable_th(GL_TEXTURE_2D); } else { - glDisable(GL_TEXTURE_2D); + evas_glDisable_th(GL_TEXTURE_2D); } #endif - glActiveTexture(GL_TEXTURE0); - glBindTexture(gc->pipe[i].shader.tex_target, gc->pipe[i].shader.cur_tex); + evas_glActiveTexture_th(GL_TEXTURE0); + evas_glBindTexture_th(gc->pipe[i].shader.tex_target, gc->pipe[i].shader.cur_tex); } if (gc->pipe[i].array.im) { @@ -3115,49 +3115,49 @@ shader_array_flush(Evas_Engine_GL_Context *gc) switch (gc->pipe[i].shader.render_op) { case EVAS_RENDER_BLEND: /**< default op: d = d*(1-sa) + s */ - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + evas_glBlendFunc_th(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); break; case EVAS_RENDER_BLEND_REL: /**< d = d*(1 - sa) + s*da */ - glBlendFunc(GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + evas_glBlendFunc_th(GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA); break; case EVAS_RENDER_COPY: /**< d = s */ gc->pipe[i].shader.blend = 0; // just disable blend mode. no need to set blend func - //glBlendFunc(GL_ONE, GL_ZERO); + //evas_glBlendFunc_th(GL_ONE, GL_ZERO); break; case EVAS_RENDER_COPY_REL: /**< d = s*da */ - glBlendFunc(GL_DST_ALPHA, GL_ZERO); + evas_glBlendFunc_th(GL_DST_ALPHA, GL_ZERO); break; case EVAS_RENDER_ADD: /**< d = d + s */ - glBlendFunc(GL_ONE, GL_ONE); + evas_glBlendFunc_th(GL_ONE, GL_ONE); break; case EVAS_RENDER_ADD_REL: /**< d = d + s*da */ - glBlendFunc(GL_DST_ALPHA, GL_ONE); + evas_glBlendFunc_th(GL_DST_ALPHA, GL_ONE); break; case EVAS_RENDER_SUB: /**< d = d - s */ - glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_COLOR); + evas_glBlendFunc_th(GL_ZERO, GL_ONE_MINUS_SRC_COLOR); break; case EVAS_RENDER_SUB_REL: /**< d = d - s*da */ - glBlendFunc(GL_ZERO, GL_ONE_MINUS_DST_ALPHA); + evas_glBlendFunc_th(GL_ZERO, GL_ONE_MINUS_DST_ALPHA); break; case EVAS_RENDER_MASK: /**< d = d*sa */ - glBlendFunc(GL_ZERO, GL_SRC_ALPHA); + evas_glBlendFunc_th(GL_ZERO, GL_SRC_ALPHA); break; // FIXME: fix blend funcs below! case EVAS_RENDER_TINT: /**< d = d*s + d*(1 - sa) + s*(1 - da) */ case EVAS_RENDER_TINT_REL: /**< d = d*(1 - sa + s) */ case EVAS_RENDER_MUL: /**< d = d*s */ default: - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + evas_glBlendFunc_th(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); break; } } if (gc->pipe[i].shader.blend != gc->state.current.blend) { if (gc->pipe[i].shader.blend) - glEnable(GL_BLEND); + evas_glEnable_th(GL_BLEND); else - glDisable(GL_BLEND); + evas_glDisable_th(GL_BLEND); } if ((gc->pipe[i].shader.smooth != gc->state.current.smooth) || (gc->pipe[i].shader.cur_tex != gc->state.current.cur_tex)) @@ -3166,23 +3166,23 @@ shader_array_flush(Evas_Engine_GL_Context *gc) { #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT if (shared->info.anisotropic > 0.0) - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, shared->info.anisotropic); + evas_glTexParameterf_th(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, shared->info.anisotropic); #endif - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } else { #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT if (shared->info.anisotropic > 0.0) - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0); + evas_glTexParameterf_th(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0); #endif - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } } if (gc->pipe[i].shader.clip != gc->state.current.clip) @@ -3236,14 +3236,14 @@ shader_array_flush(Evas_Engine_GL_Context *gc) if ((gc->pipe[i].shader.clip) || ((gc->master_clip.enabled) && (!fbo))) { - glEnable(GL_SCISSOR_TEST); + evas_glEnable_th(GL_SCISSOR_TEST); if (!fbo) scissor_rot(gc, gc->rot, gw, gh, cx + offx, gh - cy - offy - ch, cw, ch); else - glScissor(cx + offx, cy + offy, cw, ch); + evas_glScissor_th(cx + offx, cy + offy, cw, ch); setclip = EINA_TRUE; gc->state.current.cx = cx; gc->state.current.cy = cy; @@ -3252,8 +3252,8 @@ shader_array_flush(Evas_Engine_GL_Context *gc) } else { - glDisable(GL_SCISSOR_TEST); - glScissor(0, 0, 0, 0); + evas_glDisable_th(GL_SCISSOR_TEST); + evas_glScissor_th(0, 0, 0, 0); gc->state.current.cx = 0; gc->state.current.cy = 0; gc->state.current.cw = 0; @@ -3296,7 +3296,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc) gh - cy - offy - ch, cw, ch); else - glScissor(cx, cy, cw, ch); + evas_glScissor_th(cx, cy, cw, ch); gc->state.current.cx = cx; gc->state.current.cy = cy; gc->state.current.cw = cw; @@ -3335,11 +3335,11 @@ shader_array_flush(Evas_Engine_GL_Context *gc) masksam_ptr = mask_ptr + MASK_SIZE; # define END_POINTER (masksam_ptr + SAM_SIZE) - glBindBuffer(GL_ARRAY_BUFFER, gc->pipe[i].array.buffer); + evas_glBindBuffer_th(GL_ARRAY_BUFFER, gc->pipe[i].array.buffer); if ((gc->pipe[i].array.buffer_alloc < (long)END_POINTER) || (gc->pipe[i].array.buffer_use >= (ARRAY_BUFFER_USE + ARRAY_BUFFER_USE_SHIFT * i))) { - glBufferData(GL_ARRAY_BUFFER, (long)END_POINTER, NULL, GL_STATIC_DRAW); + evas_glBufferData_th(GL_ARRAY_BUFFER, (long)END_POINTER, NULL, GL_STATIC_DRAW); gc->pipe[i].array.buffer_alloc = (long)END_POINTER; gc->pipe[i].array.buffer_use = 0; } @@ -3400,171 +3400,171 @@ shader_array_flush(Evas_Engine_GL_Context *gc) } // use_vertex is always true - glVertexAttribPointer(SHAD_VERTEX, VERTEX_CNT, GL_SHORT, GL_FALSE, 0, vertex_ptr); + evas_glVertexAttribPointer_th(SHAD_VERTEX, VERTEX_CNT, GL_SHORT, GL_FALSE, 0, vertex_ptr); if (gc->pipe[i].array.use_color) { - glEnableVertexAttribArray(SHAD_COLOR); - glVertexAttribPointer(SHAD_COLOR, COLOR_CNT, GL_UNSIGNED_BYTE, GL_TRUE, 0, color_ptr); + evas_glEnableVertexAttribArray_th(SHAD_COLOR); + evas_glVertexAttribPointer_th(SHAD_COLOR, COLOR_CNT, GL_UNSIGNED_BYTE, GL_TRUE, 0, color_ptr); } else - glDisableVertexAttribArray(SHAD_COLOR); + evas_glDisableVertexAttribArray_th(SHAD_COLOR); if (gc->pipe[i].array.line) { if (gc->pipe[i].array.anti_alias) { - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glHint(GL_LINE_SMOOTH, GL_NICEST); - glEnable(GL_LINE_SMOOTH); + evas_glEnable_th(GL_BLEND); + evas_glBlendFunc_th(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + evas_glHint_th(GL_LINE_SMOOTH, GL_NICEST); + evas_glEnable_th(GL_LINE_SMOOTH); } else { - glDisable(GL_LINE_SMOOTH); + evas_glDisable_th(GL_LINE_SMOOTH); } - glDisableVertexAttribArray(SHAD_TEXUV); - glDisableVertexAttribArray(SHAD_TEXUV2); - glDisableVertexAttribArray(SHAD_TEXUV3); - glDisableVertexAttribArray(SHAD_TEXA); - glDisableVertexAttribArray(SHAD_TEXSAM); + evas_glDisableVertexAttribArray_th(SHAD_TEXUV); + evas_glDisableVertexAttribArray_th(SHAD_TEXUV2); + evas_glDisableVertexAttribArray_th(SHAD_TEXUV3); + evas_glDisableVertexAttribArray_th(SHAD_TEXA); + evas_glDisableVertexAttribArray_th(SHAD_TEXSAM); /* kopi pasta from below */ if (gc->pipe[i].array.use_mask) { - glEnableVertexAttribArray(SHAD_MASK); - glVertexAttribPointer(SHAD_MASK, MASK_CNT, GL_FLOAT, GL_FALSE, 0, mask_ptr); - glActiveTexture(MASK_TEXTURE); - glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texm); + evas_glEnableVertexAttribArray_th(SHAD_MASK); + evas_glVertexAttribPointer_th(SHAD_MASK, MASK_CNT, GL_FLOAT, GL_FALSE, 0, mask_ptr); + evas_glActiveTexture_th(MASK_TEXTURE); + evas_glBindTexture_th(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texm); #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT if (shared->info.anisotropic > 0.0) - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, shared->info.anisotropic); + evas_glTexParameterf_th(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, shared->info.anisotropic); #endif if (gc->pipe[i].shader.mask_smooth) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); } else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); } - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glActiveTexture(GL_TEXTURE0); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + evas_glActiveTexture_th(GL_TEXTURE0); if (gc->pipe[i].array.use_masksam) { - glEnableVertexAttribArray(SHAD_MASKSAM); - glVertexAttribPointer(SHAD_MASKSAM, SAM_CNT, GL_FLOAT, GL_FALSE, 0, masksam_ptr); + evas_glEnableVertexAttribArray_th(SHAD_MASKSAM); + evas_glVertexAttribPointer_th(SHAD_MASKSAM, SAM_CNT, GL_FLOAT, GL_FALSE, 0, masksam_ptr); } - else glDisableVertexAttribArray(SHAD_MASKSAM); + else evas_glDisableVertexAttribArray_th(SHAD_MASKSAM); } else { - glDisableVertexAttribArray(SHAD_MASK); - glDisableVertexAttribArray(SHAD_MASKSAM); + evas_glDisableVertexAttribArray_th(SHAD_MASK); + evas_glDisableVertexAttribArray_th(SHAD_MASKSAM); } - glDrawArrays(GL_LINES, 0, gc->pipe[i].array.num); + evas_glDrawArrays_th(GL_LINES, 0, gc->pipe[i].array.num); } else { if (gc->pipe[i].array.use_texuv) { - glEnableVertexAttribArray(SHAD_TEXUV); - glVertexAttribPointer(SHAD_TEXUV, TEX_CNT, GL_FLOAT, GL_FALSE, 0, texuv_ptr); + evas_glEnableVertexAttribArray_th(SHAD_TEXUV); + evas_glVertexAttribPointer_th(SHAD_TEXUV, TEX_CNT, GL_FLOAT, GL_FALSE, 0, texuv_ptr); MASK_TEXTURE += 1; } else { - glDisableVertexAttribArray(SHAD_TEXUV); + evas_glDisableVertexAttribArray_th(SHAD_TEXUV); } /* Alpha plane */ if (gc->pipe[i].array.use_texa) { - glEnableVertexAttribArray(SHAD_TEXA); - glVertexAttribPointer(SHAD_TEXA, TEX_CNT, GL_FLOAT, GL_FALSE, 0, texa_ptr); - glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texa); + evas_glEnableVertexAttribArray_th(SHAD_TEXA); + evas_glVertexAttribPointer_th(SHAD_TEXA, TEX_CNT, GL_FLOAT, GL_FALSE, 0, texa_ptr); + evas_glActiveTexture_th(GL_TEXTURE1); + evas_glBindTexture_th(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texa); #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT if (shared->info.anisotropic > 0.0) - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, shared->info.anisotropic); + evas_glTexParameterf_th(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, shared->info.anisotropic); #endif if (gc->pipe[i].shader.smooth) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); } else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); } - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glActiveTexture(GL_TEXTURE0); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + evas_glActiveTexture_th(GL_TEXTURE0); MASK_TEXTURE += 1; } else { - glDisableVertexAttribArray(SHAD_TEXA); + evas_glDisableVertexAttribArray_th(SHAD_TEXA); } if (gc->pipe[i].array.use_texsam) { - glEnableVertexAttribArray(SHAD_TEXSAM); - glVertexAttribPointer(SHAD_TEXSAM, SAM_CNT, GL_FLOAT, GL_FALSE, 0, texsam_ptr); + evas_glEnableVertexAttribArray_th(SHAD_TEXSAM); + evas_glVertexAttribPointer_th(SHAD_TEXSAM, SAM_CNT, GL_FLOAT, GL_FALSE, 0, texsam_ptr); } else { - glDisableVertexAttribArray(SHAD_TEXSAM); + evas_glDisableVertexAttribArray_th(SHAD_TEXSAM); } if ((gc->pipe[i].array.use_texuv2) && (gc->pipe[i].array.use_texuv3)) { - glEnableVertexAttribArray(SHAD_TEXUV2); - glEnableVertexAttribArray(SHAD_TEXUV3); - glVertexAttribPointer(SHAD_TEXUV2, TEX_CNT, GL_FLOAT, GL_FALSE, 0, texuv2_ptr); - glVertexAttribPointer(SHAD_TEXUV3, TEX_CNT, GL_FLOAT, GL_FALSE, 0, texuv3_ptr); + evas_glEnableVertexAttribArray_th(SHAD_TEXUV2); + evas_glEnableVertexAttribArray_th(SHAD_TEXUV3); + evas_glVertexAttribPointer_th(SHAD_TEXUV2, TEX_CNT, GL_FLOAT, GL_FALSE, 0, texuv2_ptr); + evas_glVertexAttribPointer_th(SHAD_TEXUV3, TEX_CNT, GL_FLOAT, GL_FALSE, 0, texuv3_ptr); - glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu); + evas_glActiveTexture_th(GL_TEXTURE1); + evas_glBindTexture_th(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu); #ifdef GL_GLES if (gc->pipe[i].shader.cur_texu_dyn) secsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu_dyn); #endif - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glActiveTexture(GL_TEXTURE2); - glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texv); + evas_glActiveTexture_th(GL_TEXTURE2); + evas_glBindTexture_th(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texv); #ifdef GL_GLES if (gc->pipe[i].shader.cur_texv_dyn) secsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texv_dyn); #endif - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glActiveTexture(GL_TEXTURE0); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + evas_glActiveTexture_th(GL_TEXTURE0); MASK_TEXTURE += 2; } else if (gc->pipe[i].array.use_texuv2) { - glEnableVertexAttribArray(SHAD_TEXUV2); - glVertexAttribPointer(SHAD_TEXUV2, TEX_CNT, GL_FLOAT, GL_FALSE, 0, texuv2_ptr); + evas_glEnableVertexAttribArray_th(SHAD_TEXUV2); + evas_glVertexAttribPointer_th(SHAD_TEXUV2, TEX_CNT, GL_FLOAT, GL_FALSE, 0, texuv2_ptr); - glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu); + evas_glActiveTexture_th(GL_TEXTURE1); + evas_glBindTexture_th(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu); #ifdef GL_GLES if (gc->pipe[i].shader.cur_texu_dyn) secsym_glEGLImageTargetTexture2DOES @@ -3572,65 +3572,65 @@ shader_array_flush(Evas_Engine_GL_Context *gc) #endif if (gc->pipe[i].shader.smooth) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } - glActiveTexture(GL_TEXTURE0); + evas_glActiveTexture_th(GL_TEXTURE0); - glDisableVertexAttribArray(SHAD_TEXUV3); + evas_glDisableVertexAttribArray_th(SHAD_TEXUV3); MASK_TEXTURE += 1; } else { - glDisableVertexAttribArray(SHAD_TEXUV2); - glDisableVertexAttribArray(SHAD_TEXUV3); + evas_glDisableVertexAttribArray_th(SHAD_TEXUV2); + evas_glDisableVertexAttribArray_th(SHAD_TEXUV3); } /* Mask surface */ if (gc->pipe[i].array.use_mask) { - glEnableVertexAttribArray(SHAD_MASK); - glVertexAttribPointer(SHAD_MASK, MASK_CNT, GL_FLOAT, GL_FALSE, 0, mask_ptr); - glActiveTexture(MASK_TEXTURE); - glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texm); + evas_glEnableVertexAttribArray_th(SHAD_MASK); + evas_glVertexAttribPointer_th(SHAD_MASK, MASK_CNT, GL_FLOAT, GL_FALSE, 0, mask_ptr); + evas_glActiveTexture_th(MASK_TEXTURE); + evas_glBindTexture_th(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texm); #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT if (shared->info.anisotropic > 0.0) - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, shared->info.anisotropic); + evas_glTexParameterf_th(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, shared->info.anisotropic); #endif if (gc->pipe[i].shader.mask_smooth) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); } else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); } - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glActiveTexture(GL_TEXTURE0); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + evas_glActiveTexture_th(GL_TEXTURE0); if (gc->pipe[i].array.use_masksam) { - glEnableVertexAttribArray(SHAD_MASKSAM); - glVertexAttribPointer(SHAD_MASKSAM, SAM_CNT, GL_FLOAT, GL_FALSE, 0, masksam_ptr); + evas_glEnableVertexAttribArray_th(SHAD_MASKSAM); + evas_glVertexAttribPointer_th(SHAD_MASKSAM, SAM_CNT, GL_FLOAT, GL_FALSE, 0, masksam_ptr); } - else glDisableVertexAttribArray(SHAD_MASKSAM); + else evas_glDisableVertexAttribArray_th(SHAD_MASKSAM); } else { - glDisableVertexAttribArray(SHAD_MASK); - glDisableVertexAttribArray(SHAD_MASKSAM); + evas_glDisableVertexAttribArray_th(SHAD_MASK); + evas_glDisableVertexAttribArray_th(SHAD_MASKSAM); } if (dbgflushnum == 1) @@ -3648,7 +3648,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc) types[gc->pipe[i].region.type] ); } - glDrawArrays(GL_TRIANGLES, 0, gc->pipe[i].array.num); + evas_glDrawArrays_th(GL_TRIANGLES, 0, gc->pipe[i].array.num); } if (gc->pipe[i].array.im) { @@ -3704,7 +3704,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc) if (glsym_glMapBuffer && glsym_glUnmapBuffer) { - glBindBuffer(GL_ARRAY_BUFFER, 0); + evas_glBindBuffer_th(GL_ARRAY_BUFFER, 0); } gc->pipe[i].region.x = 0; @@ -3740,8 +3740,8 @@ evas_gl_common_buffer_dump(Evas_Engine_GL_Context *gc, const char* dname, const if ((!data1) || (!data2)) goto finish; - glReadPixels(0, 0, gc->w, gc->h, GL_RGBA, - GL_UNSIGNED_BYTE, (unsigned char*)data1); + evas_glReadPixels_th(0, 0, gc->w, gc->h, GL_RGBA, + GL_UNSIGNED_BYTE, (unsigned char*)data1); // Flip the Y and change from RGBA TO BGRA int i, j; diff --git a/src/modules/evas/engines/gl_common/evas_gl_file_cache.c b/src/modules/evas/engines/gl_common/evas_gl_file_cache.c index f31ce118ac..f0985214bd 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_file_cache.c +++ b/src/modules/evas/engines/gl_common/evas_gl_file_cache.c @@ -95,9 +95,9 @@ evas_gl_common_file_cache_file_check(const char *cache_dir, const char *cache_na char *driver = NULL; char *version = NULL; - vendor = (char *)glGetString(GL_VENDOR); - driver = (char *)glGetString(GL_RENDERER); - version = (char *)glGetString(GL_VERSION); + vendor = (char *)evas_glGetString_th(GL_VENDOR); + driver = (char *)evas_glGetString_th(GL_RENDERER); + version = (char *)evas_glGetString_th(GL_VERSION); if (!vendor) vendor = "-UNKNOWN-"; if (!driver) driver = "-UNKNOWN-"; diff --git a/src/modules/evas/engines/gl_common/evas_gl_line.c b/src/modules/evas/engines/gl_common/evas_gl_line.c index 1b7def125f..b517998dbe 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_line.c +++ b/src/modules/evas/engines/gl_common/evas_gl_line.c @@ -59,7 +59,7 @@ evas_gl_common_line_draw(Evas_Engine_GL_Context *gc, int x1, int y1, int x2, int if (!getenv("EVAS_GL_LINE_OFFSET_HACK_DISABLE")) { const char *vendor_name; - vendor_name = (char *) glGetString(GL_VENDOR); + vendor_name = (char *) evas_glGetString_th(GL_VENDOR); if (vendor_name && !strcmp(vendor_name, "ARM")) offset_hack = OFFSET_HACK_ARM; else diff --git a/src/modules/evas/engines/gl_common/evas_gl_shader.c b/src/modules/evas/engines/gl_common/evas_gl_shader.c index d80d77976f..a063128128 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_shader.c +++ b/src/modules/evas/engines/gl_common/evas_gl_shader.c @@ -75,18 +75,18 @@ gl_compile_link_error(GLuint target, const char *action, Eina_Bool is_shader) if (is_shader) /* Shader info log */ - glGetShaderiv(target, GL_INFO_LOG_LENGTH, &loglen); + evas_glGetShaderiv_th(target, GL_INFO_LOG_LENGTH, &loglen); else /* Program info log */ - glGetProgramiv(target, GL_INFO_LOG_LENGTH, &loglen); + evas_glGetProgramiv_th(target, GL_INFO_LOG_LENGTH, &loglen); if (loglen > 0) { logtxt = calloc(loglen, sizeof(char)); if (logtxt) { - if (is_shader) glGetShaderInfoLog(target, loglen, &chars, logtxt); - else glGetProgramInfoLog(target, loglen, &chars, logtxt); + if (is_shader) evas_glGetShaderInfoLog_th(target, loglen, &chars, logtxt); + else evas_glGetProgramInfoLog_th(target, loglen, &chars, logtxt); ERR("Failed to %s: %s", action, logtxt); free(logtxt); } @@ -115,43 +115,43 @@ _evas_gl_common_shader_program_binary_load(Eet_File *ef, unsigned int flags) } if ((!data) || (length <= 0)) goto finish; - glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &num); + evas_glGetIntegerv_th(GL_NUM_PROGRAM_BINARY_FORMATS, &num); if (num <= 0) goto finish; formats = calloc(num, sizeof(int)); if (!formats) goto finish; - glGetIntegerv(GL_PROGRAM_BINARY_FORMATS, formats); + evas_glGetIntegerv_th(GL_PROGRAM_BINARY_FORMATS, formats); if (!formats[0]) goto finish; - prg = glCreateProgram(); + prg = evas_glCreateProgram_th(); #if 1 // TODO: invalid rendering error occurs when attempting to use a // glProgramBinary. in order to render correctly we should create a dummy // vertex shader. - vtx = glCreateShader(GL_VERTEX_SHADER); - glAttachShader(prg, vtx); - frg = glCreateShader(GL_FRAGMENT_SHADER); - glAttachShader(prg, frg); + vtx = evas_glCreateShader_th(GL_VERTEX_SHADER); + evas_glAttachShader_th(prg, vtx); + frg = evas_glCreateShader_th(GL_FRAGMENT_SHADER); + evas_glAttachShader_th(prg, frg); #endif glsym_glProgramBinary(prg, formats[0], data, length); - glBindAttribLocation(prg, SHAD_VERTEX, "vertex"); - glBindAttribLocation(prg, SHAD_COLOR, "color"); - glBindAttribLocation(prg, SHAD_TEXUV, "tex_coord"); - glBindAttribLocation(prg, SHAD_TEXUV2, "tex_coord2"); - glBindAttribLocation(prg, SHAD_TEXUV3, "tex_coord3"); - glBindAttribLocation(prg, SHAD_TEXA, "tex_coorda"); - glBindAttribLocation(prg, SHAD_TEXSAM, "tex_sample"); - glBindAttribLocation(prg, SHAD_MASK, "mask_coord"); - glBindAttribLocation(prg, SHAD_MASKSAM, "tex_masksample"); - - glGetProgramiv(prg, GL_LINK_STATUS, &ok); + evas_glBindAttribLocation_th(prg, SHAD_VERTEX, "vertex"); + evas_glBindAttribLocation_th(prg, SHAD_COLOR, "color"); + evas_glBindAttribLocation_th(prg, SHAD_TEXUV, "tex_coord"); + evas_glBindAttribLocation_th(prg, SHAD_TEXUV2, "tex_coord2"); + evas_glBindAttribLocation_th(prg, SHAD_TEXUV3, "tex_coord3"); + evas_glBindAttribLocation_th(prg, SHAD_TEXA, "tex_coorda"); + evas_glBindAttribLocation_th(prg, SHAD_TEXSAM, "tex_sample"); + evas_glBindAttribLocation_th(prg, SHAD_MASK, "mask_coord"); + evas_glBindAttribLocation_th(prg, SHAD_MASKSAM, "tex_masksample"); + + evas_glGetProgramiv_th(prg, GL_LINK_STATUS, &ok); if (!ok) { gl_compile_link_error(prg, "load a program object", EINA_FALSE); ERR("Abort load of program (%s)", pname); - glDeleteProgram(prg); + evas_glDeleteProgram_th(prg); goto finish; } @@ -160,13 +160,13 @@ _evas_gl_common_shader_program_binary_load(Eet_File *ef, unsigned int flags) p->prog = prg; p->reset = EINA_TRUE; p->bin_saved = EINA_TRUE; - p->uniform.mvp = glGetUniformLocation(prg, "mvp"); - p->uniform.rotation_id = glGetUniformLocation(prg, "rotation_id"); + p->uniform.mvp = evas_glGetUniformLocation_th(prg, "mvp"); + p->uniform.rotation_id = evas_glGetUniformLocation_th(prg, "rotation_id"); evas_gl_common_shader_textures_bind(p); finish: - if (vtx) glDeleteShader(vtx); - if (frg) glDeleteShader(frg); + if (vtx) evas_glDeleteShader_th(vtx); + if (frg) evas_glDeleteShader_th(frg); free(formats); if (!direct) free(data); return p; @@ -182,7 +182,7 @@ _evas_gl_common_shader_program_binary_save(Evas_GL_Program *p, Eet_File *ef) if (!glsym_glGetProgramBinary) return 0; - glGetProgramiv(p->prog, GL_PROGRAM_BINARY_LENGTH, &length); + evas_glGetProgramiv_th(p->prog, GL_PROGRAM_BINARY_LENGTH, &length); if (length <= 0) return 0; data = malloc(length); @@ -384,7 +384,7 @@ save: static inline void _program_del(Evas_GL_Program *p) { - if (p->prog) glDeleteProgram(p->prog); + if (p->prog) evas_glDeleteProgram_th(p->prog); free(p); } @@ -422,61 +422,61 @@ evas_gl_common_shader_compile(unsigned int flags, const char *vertex, GLint ok = 0; compiler_released = EINA_FALSE; - vtx = glCreateShader(GL_VERTEX_SHADER); - frg = glCreateShader(GL_FRAGMENT_SHADER); + vtx = evas_glCreateShader_th(GL_VERTEX_SHADER); + frg = evas_glCreateShader_th(GL_FRAGMENT_SHADER); - glShaderSource(vtx, 1, &vertex, NULL); - glCompileShader(vtx); - glGetShaderiv(vtx, GL_COMPILE_STATUS, &ok); + evas_glShaderSource_th(vtx, 1, &vertex, NULL); + evas_glCompileShader_th(vtx); + evas_glGetShaderiv_th(vtx, GL_COMPILE_STATUS, &ok); if (!ok) { gl_compile_link_error(vtx, "compile vertex shader", EINA_TRUE); ERR("Abort compile of vertex shader:\n%s", vertex); - glDeleteShader(vtx); + evas_glDeleteShader_th(vtx); return NULL; } ok = 0; - glShaderSource(frg, 1, &fragment, NULL); - glCompileShader(frg); - glGetShaderiv(frg, GL_COMPILE_STATUS, &ok); + evas_glShaderSource_th(frg, 1, &fragment, NULL); + evas_glCompileShader_th(frg); + evas_glGetShaderiv_th(frg, GL_COMPILE_STATUS, &ok); if (!ok) { gl_compile_link_error(frg, "compile fragment shader", EINA_TRUE); ERR("Abort compile of fragment shader:\n%s", fragment); - glDeleteShader(vtx); - glDeleteShader(frg); + evas_glDeleteShader_th(vtx); + evas_glDeleteShader_th(frg); return NULL; } ok = 0; - prg = glCreateProgram(); + prg = evas_glCreateProgram_th(); #ifndef GL_GLES if ((glsym_glGetProgramBinary) && (glsym_glProgramParameteri)) glsym_glProgramParameteri(prg, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE); #endif - glAttachShader(prg, vtx); - glAttachShader(prg, frg); - - glBindAttribLocation(prg, SHAD_VERTEX, "vertex"); - glBindAttribLocation(prg, SHAD_COLOR, "color"); - glBindAttribLocation(prg, SHAD_TEXUV, "tex_coord"); - glBindAttribLocation(prg, SHAD_TEXUV2, "tex_coord2"); - glBindAttribLocation(prg, SHAD_TEXUV3, "tex_coord3"); - glBindAttribLocation(prg, SHAD_TEXA, "tex_coorda"); - glBindAttribLocation(prg, SHAD_TEXSAM, "tex_sample"); - glBindAttribLocation(prg, SHAD_MASK, "mask_coord"); - glBindAttribLocation(prg, SHAD_MASKSAM, "tex_masksample"); - - glLinkProgram(prg); - glGetProgramiv(prg, GL_LINK_STATUS, &ok); + evas_glAttachShader_th(prg, vtx); + evas_glAttachShader_th(prg, frg); + + evas_glBindAttribLocation_th(prg, SHAD_VERTEX, "vertex"); + evas_glBindAttribLocation_th(prg, SHAD_COLOR, "color"); + evas_glBindAttribLocation_th(prg, SHAD_TEXUV, "tex_coord"); + evas_glBindAttribLocation_th(prg, SHAD_TEXUV2, "tex_coord2"); + evas_glBindAttribLocation_th(prg, SHAD_TEXUV3, "tex_coord3"); + evas_glBindAttribLocation_th(prg, SHAD_TEXA, "tex_coorda"); + evas_glBindAttribLocation_th(prg, SHAD_TEXSAM, "tex_sample"); + evas_glBindAttribLocation_th(prg, SHAD_MASK, "mask_coord"); + evas_glBindAttribLocation_th(prg, SHAD_MASKSAM, "tex_masksample"); + + evas_glLinkProgram_th(prg); + evas_glGetProgramiv_th(prg, GL_LINK_STATUS, &ok); if (!ok) { gl_compile_link_error(prg, "link fragment and vertex shaders", EINA_FALSE); ERR("Abort compile of shader (flags: %08x)", flags); - glDeleteShader(vtx); - glDeleteShader(frg); - glDeleteProgram(prg); + evas_glDeleteShader_th(vtx); + evas_glDeleteShader_th(frg); + evas_glDeleteProgram_th(prg); return 0; } @@ -485,8 +485,8 @@ evas_gl_common_shader_compile(unsigned int flags, const char *vertex, p->prog = prg; p->reset = EINA_TRUE; - glDeleteShader(vtx); - glDeleteShader(frg); + evas_glDeleteShader_th(vtx); + evas_glDeleteShader_th(frg); return p; } @@ -568,8 +568,8 @@ evas_gl_common_shader_generate_and_compile(Evas_GL_Shared *shared, unsigned int if (p) { shared->needs_shaders_flush = 1; - p->uniform.mvp = glGetUniformLocation(p->prog, "mvp"); - p->uniform.rotation_id = glGetUniformLocation(p->prog, "rotation_id"); + p->uniform.mvp = evas_glGetUniformLocation_th(p->prog, "mvp"); + p->uniform.rotation_id = evas_glGetUniformLocation_th(p->prog, "rotation_id"); evas_gl_common_shader_textures_bind(p); eina_hash_add(shared->shaders_hash, &flags, p); } @@ -654,7 +654,7 @@ evas_gl_common_shaders_flush(Evas_GL_Shared *shared) { compiler_released = EINA_TRUE; #ifdef GL_GLES - glReleaseShaderCompiler(); + evas_glReleaseShaderCompiler_th(); #else if (glsym_glReleaseShaderCompiler) glsym_glReleaseShaderCompiler(); @@ -875,17 +875,17 @@ evas_gl_common_shader_textures_bind(Evas_GL_Program *p) if (hastex) { - glUseProgram(p->prog); // is this necessary?? + evas_glUseProgram_th(p->prog); // is this necessary?? for (i = 0; textures[i].name; i++) { if (!textures[i].enabled) continue; - loc = glGetUniformLocation(p->prog, textures[i].name); + loc = evas_glGetUniformLocation_th(p->prog, textures[i].name); if (loc < 0) { ERR("Couldn't find uniform '%s' (shader: %08x)", textures[i].name, p->flags); } - glUniform1i(loc, p->tex_count++); + evas_glUniform1i_th(loc, p->tex_count++); } } } diff --git a/src/modules/evas/engines/gl_common/evas_gl_texture.c b/src/modules/evas/engines/gl_common/evas_gl_texture.c index ac0b162cfd..1c99fb86dd 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_texture.c +++ b/src/modules/evas/engines/gl_common/evas_gl_texture.c @@ -102,7 +102,7 @@ _tex_sub_2d(Evas_Engine_GL_Context *gc, int x, int y, int w, int h, int fmt, int { if ((w > gc->shared->info.max_texture_size) || (h > gc->shared->info.max_texture_size)) return; - glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, fmt, type, pix); + evas_glTexSubImage2D_th(GL_TEXTURE_2D, 0, x, y, w, h, fmt, type, pix); } static void @@ -110,7 +110,7 @@ _comp_tex_sub_2d(Evas_Engine_GL_Context *gc, int x, int y, int w, int h, int fmt { if ((w > gc->shared->info.max_texture_size) || (h > gc->shared->info.max_texture_size)) return; - glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, fmt, imgsize, pix); + evas_glCompressedTexSubImage2D_th(GL_TEXTURE_2D, 0, x, y, w, h, fmt, imgsize, pix); } #ifdef GL_TEXTURE_INTERNAL_FORMAT @@ -339,9 +339,9 @@ _tex_2d(Evas_Engine_GL_Context *gc, int intfmt, int w, int h, int fmt, int type) } sz = _evas_gl_texture_size_get(w, h, intfmt, &comp); if (!comp) - glTexImage2D(GL_TEXTURE_2D, 0, intfmt, w, h, 0, fmt, type, NULL); + evas_glTexImage2D_th(GL_TEXTURE_2D, 0, intfmt, w, h, 0, fmt, type, NULL); else - glCompressedTexImage2D(GL_TEXTURE_2D, 0, intfmt, w, h, 0, sz, NULL); + evas_glCompressedTexImage2D_th(GL_TEXTURE_2D, 0, intfmt, w, h, 0, sz, NULL); #ifdef GL_TEXTURE_INTERNAL_FORMAT # ifdef GL_GLES # else @@ -350,8 +350,8 @@ _tex_2d(Evas_Engine_GL_Context *gc, int intfmt, int w, int h, int fmt, int type) { int intfmtret = -1; - glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, - GL_TEXTURE_INTERNAL_FORMAT, &intfmtret); + evas_glGetTexLevelParameteriv_th(GL_TEXTURE_2D, 0, + GL_TEXTURE_INTERNAL_FORMAT, &intfmtret); if (!_evas_gl_texture_match(intfmt, intfmtret)) { ERR("Fail tex alloc %ix%i, intfmt: %X intfmtret: %X", w, h, intfmt, intfmtret); @@ -424,17 +424,17 @@ _pool_tex_new(Evas_Engine_GL_Context *gc, int w, int h, GLenum intformat, GLenum pt->references = 0; pt->eina_pool = eina_rectangle_pool_new(w, h); - glGenTextures(1, &(pt->texture)); - glBindTexture(GL_TEXTURE_2D, pt->texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + evas_glGenTextures_th(1, &(pt->texture)); + evas_glBindTexture_th(GL_TEXTURE_2D, pt->texture); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); ok = _tex_2d(gc, pt->intformat, w, h, pt->format, pt->dataformat); - glBindTexture(gc->state.current.tex_target, gc->state.current.cur_tex); + evas_glBindTexture_th(gc->state.current.tex_target, gc->state.current.cur_tex); if (!ok) { - glDeleteTextures(1, &(pt->texture)); + evas_glDeleteTextures_th(1, &(pt->texture)); if (pt->eina_pool) eina_rectangle_pool_free(pt->eina_pool); free(pt); @@ -646,13 +646,13 @@ _pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in # define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_EXT # endif #endif - glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fnum); - glGenTextures(1, &(pt->texture)); - glBindTexture(GL_TEXTURE_2D, pt->texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + evas_glGetIntegerv_th(GL_FRAMEBUFFER_BINDING, &fnum); + evas_glGenTextures_th(1, &(pt->texture)); + evas_glBindTexture_th(GL_TEXTURE_2D, pt->texture); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + evas_glTexParameteri_th(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); ok = _tex_2d(gc, pt->intformat, w, h, pt->format, pt->dataformat); if (ok) @@ -665,19 +665,19 @@ _pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in if (stencil) { - glGenRenderbuffers(1, &(pt->stencil)); - glBindRenderbuffer(GL_RENDERBUFFER, pt->stencil); - glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, pt->w, pt->h); - glBindRenderbuffer(GL_RENDERBUFFER, 0); - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, pt->stencil); + evas_glGenRenderbuffers_th(1, &(pt->stencil)); + evas_glBindRenderbuffer_th(GL_RENDERBUFFER, pt->stencil); + evas_glRenderbufferStorage_th(GL_RENDERBUFFER, GL_STENCIL_INDEX8, pt->w, pt->h); + evas_glBindRenderbuffer_th(GL_RENDERBUFFER, 0); + evas_glFramebufferRenderbuffer_th(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, pt->stencil); } glsym_glBindFramebuffer(GL_FRAMEBUFFER, fnum); - glBindTexture(gc->state.current.tex_target, gc->state.current.cur_tex); + evas_glBindTexture_th(gc->state.current.tex_target, gc->state.current.cur_tex); if (!ok) { - glDeleteTextures(1, &(pt->texture)); + evas_glDeleteTextures_th(1, &(pt->texture)); if (pt->eina_pool) eina_rectangle_pool_free(pt->eina_pool); free(pt); @@ -783,8 +783,8 @@ _pool_tex_native_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in pt->references = 0; pt->native = 1; pt->eina_pool = eina_rectangle_pool_new(w, h); - glGenTextures(1, &(pt->texture)); - glBindTexture(im->native.target, pt->texture); + evas_glGenTextures_th(1, &(pt->texture)); + evas_glBindTexture_th(im->native.target, pt->texture); #ifdef GL_GLES #else @@ -795,12 +795,12 @@ _pool_tex_native_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in } #endif - glTexParameteri(im->native.target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(im->native.target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(im->native.target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(im->native.target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glBindTexture(im->native.target, 0); - glBindTexture(gc->state.current.tex_target, gc->state.current.cur_tex); + evas_glTexParameteri_th(im->native.target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + evas_glTexParameteri_th(im->native.target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + evas_glTexParameteri_th(im->native.target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + evas_glTexParameteri_th(im->native.target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + evas_glBindTexture_th(im->native.target, 0); + evas_glBindTexture_th(gc->state.current.tex_target, gc->state.current.cur_tex); texinfo.n.num++; texinfo.n.pix += pt->w * pt->h; @@ -837,12 +837,12 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i pt->dyn.target = GL_TEXTURE_2D; - glGenTextures(1, &(pt->texture)); - glBindTexture(pt->dyn.target, pt->texture); - glTexParameteri(pt->dyn.target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(pt->dyn.target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(pt->dyn.target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(pt->dyn.target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + evas_glGenTextures_th(1, &(pt->texture)); + evas_glBindTexture_th(pt->dyn.target, pt->texture); + evas_glTexParameteri_th(pt->dyn.target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + evas_glTexParameteri_th(pt->dyn.target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + evas_glTexParameteri_th(pt->dyn.target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + evas_glTexParameteri_th(pt->dyn.target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); egldisplay = pt->gc->egldisp; @@ -945,7 +945,7 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i goto error; } - glBindTexture(gc->state.current.tex_target, gc->state.current.cur_tex); + evas_glBindTexture_th(gc->state.current.tex_target, gc->state.current.cur_tex); #else if (gc + w + h + intformat + format) return pt; #endif @@ -959,8 +959,8 @@ error: secsym_eglDestroyImage(egldisplay, pt->dyn.img); pt->dyn.img = NULL; } - glBindTexture(pt->dyn.target, 0); - glDeleteTextures(1, &(pt->texture)); + evas_glBindTexture_th(pt->dyn.target, 0); + evas_glDeleteTextures_th(1, &(pt->texture)); if (pt->eina_pool) eina_rectangle_pool_free(pt->eina_pool); free(pt); @@ -1031,12 +1031,12 @@ evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt) } #endif - glDeleteTextures(1, &(pt->texture)); + evas_glDeleteTextures_th(1, &(pt->texture)); if (pt->gc->state.current.cur_tex == pt->texture) pt->gc->state.current.cur_tex = 0; if (pt->stencil) { - glDeleteRenderbuffers(1, &(pt->stencil)); + evas_glDeleteRenderbuffers_th(1, &(pt->stencil)); pt->stencil = 0; } if (pt->fb) @@ -1190,10 +1190,10 @@ evas_gl_common_texture_upload(Evas_GL_Texture *tex, RGBA_Image *im, unsigned int GLuint fmt; fmt = tex->pt->format; - glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->pt->texture); if (tex->gc->shared->info.unpack_row_length) - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - glPixelStorei(GL_UNPACK_ALIGNMENT, bytes_count); + evas_glPixelStorei_th(GL_UNPACK_ROW_LENGTH, 0); + evas_glPixelStorei_th(GL_UNPACK_ALIGNMENT, bytes_count); // printf("tex upload %ix%i\n", im->cache_entry.w, im->cache_entry.h); // +-+ @@ -1248,7 +1248,7 @@ evas_gl_common_texture_upload(Evas_GL_Texture *tex, RGBA_Image *im, unsigned int im->image.data8 + (im->cache_entry.w - 1) * bytes_count); if (tex->gc->shared->info.unpack_row_length) { - glPixelStorei(GL_UNPACK_ROW_LENGTH, im->cache_entry.w); + evas_glPixelStorei_th(GL_UNPACK_ROW_LENGTH, im->cache_entry.w); // |xxx // |xxx // @@ -1304,7 +1304,7 @@ evas_gl_common_texture_upload(Evas_GL_Texture *tex, RGBA_Image *im, unsigned int } //glPixelStorei(GL_UNPACK_ALIGNMENT, 4); if (tex->pt->texture != tex->gc->state.current.cur_tex) - glBindTexture(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex); + evas_glBindTexture_th(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex); } void @@ -1366,22 +1366,22 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im) height = im->cache_entry.h + im->cache_entry.borders.t + im->cache_entry.borders.b; EINA_SAFETY_ON_FALSE_RETURN(!(width & 0x3) && !(height & 0x3)); - glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->pt->texture); if ((tex->gc->shared->info.etc1_subimage || (im->cache_entry.space != EVAS_COLORSPACE_ETC1)) && (tex->pt->w != width || tex->pt->h != height)) { int err; - err = glGetError(); + err = evas_glGetError_th(); - glCompressedTexSubImage2D(GL_TEXTURE_2D, 0, - x, y, width, height, - tex->pt->format, - ((width * height) >> 4) * bsize, - im->image.data); + evas_glCompressedTexSubImage2D_th(GL_TEXTURE_2D, 0, + x, y, width, height, + tex->pt->format, + ((width * height) >> 4) * bsize, + im->image.data); - err = glGetError(); + err = evas_glGetError_th(); if (err != GL_NO_ERROR) { __evas_gl_err(err, __FILE__, __FUNCTION__, __LINE__, @@ -1396,15 +1396,15 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im) } else { - glCompressedTexImage2D(GL_TEXTURE_2D, 0, tex->pt->format, - width, height, 0, - ((width * height) >> 4) * bsize, - im->image.data); + evas_glCompressedTexImage2D_th(GL_TEXTURE_2D, 0, tex->pt->format, + width, height, 0, + ((width * height) >> 4) * bsize, + im->image.data); } if (tex->pt->texture != tex->gc->state.current.cur_tex) { - glBindTexture(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex); + evas_glBindTexture_th(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex); } return; } @@ -1513,18 +1513,18 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im) // Bind and upload ! Vooom ! fmt = tex->ptt->format; - glBindTexture(GL_TEXTURE_2D, tex->ptt->texture); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->ptt->texture); if (tex->gc->shared->info.unpack_row_length) { - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + evas_glPixelStorei_th(GL_UNPACK_ROW_LENGTH, 0); } - glPixelStorei(GL_UNPACK_ALIGNMENT, bytes_count); + evas_glPixelStorei_th(GL_UNPACK_ALIGNMENT, bytes_count); _tex_sub_2d(tex->gc, u, tex->ty, EVAS_GL_TILE_SIZE, EVAS_GL_TILE_SIZE, fmt, tex->ptt->dataformat, out); // Switch back to current texture if (tex->ptt->texture != tex->gc->state.current.cur_tex) - glBindTexture(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex); + evas_glBindTexture_th(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex); // Now prepare uploading the main texture before returning; async = malloc(sizeof (Evas_GL_Texture_Async_Preload)); @@ -1660,16 +1660,16 @@ evas_gl_common_texture_alpha_update(Evas_GL_Texture *tex, DATA8 *pixels, unsigned int w, unsigned int h, int fh EINA_UNUSED) { if (!tex->pt) return; - glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->pt->texture); if (tex->gc->shared->info.unpack_row_length) { - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + evas_glPixelStorei_th(GL_UNPACK_ROW_LENGTH, 0); } - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + evas_glPixelStorei_th(GL_UNPACK_ALIGNMENT, 4); _tex_sub_2d(tex->gc, tex->x, tex->y, w, h, tex->pt->format, tex->pt->dataformat, pixels); if (tex->pt->texture != tex->gc->state.current.cur_tex) - glBindTexture(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex); + evas_glBindTexture_th(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex); } Evas_GL_Texture * @@ -1762,25 +1762,25 @@ evas_gl_common_texture_rgb_a_pair_update(Evas_GL_Texture *tex, if (!subimage || tex->gc->shared->info.unpack_row_length) { if (tex->gc->shared->info.unpack_row_length) - glPixelStorei(GL_UNPACK_ROW_LENGTH, w); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + evas_glPixelStorei_th(GL_UNPACK_ROW_LENGTH, w); + evas_glPixelStorei_th(GL_UNPACK_ALIGNMENT, 1); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->pt->texture); if (!_tex_2d(tex->gc, tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat)) goto on_error; if (upload) { if (comp) - glCompressedTexImage2D(GL_TEXTURE_2D, 0, tex->pt->intformat, w, h, 0, sz, data1); + evas_glCompressedTexImage2D_th(GL_TEXTURE_2D, 0, tex->pt->intformat, w, h, 0, sz, data1); else _tex_sub_2d(tex->gc, 0, 0, w, h, tex->pt->format, tex->pt->dataformat, data1); } - glBindTexture(GL_TEXTURE_2D, tex->pta->texture); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->pta->texture); if (!_tex_2d(tex->gc, tex->pta->intformat, w, h, tex->pta->format, tex->pta->dataformat)) goto on_error; if (upload) { if (comp) - glCompressedTexImage2D(GL_TEXTURE_2D, 0, tex->pta->intformat, w, h, 0, sz, data2); + evas_glCompressedTexImage2D_th(GL_TEXTURE_2D, 0, tex->pta->intformat, w, h, 0, sz, data2); else _tex_sub_2d(tex->gc, 0, 0, w, h, tex->pta->format, tex->pta->dataformat, data2); } @@ -1789,8 +1789,8 @@ evas_gl_common_texture_rgb_a_pair_update(Evas_GL_Texture *tex, { int y; - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + evas_glPixelStorei_th(GL_UNPACK_ALIGNMENT, 1); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->pt->texture); if (!_tex_2d(tex->gc, tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat)) goto on_error; @@ -1816,7 +1816,7 @@ evas_gl_common_texture_rgb_a_pair_update(Evas_GL_Texture *tex, } } - glBindTexture(GL_TEXTURE_2D, tex->pta->texture); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->pta->texture); if (!_tex_2d(tex->gc, tex->pta->intformat, w, h, tex->pta->format, tex->pta->dataformat)) goto on_error; @@ -1843,7 +1843,7 @@ evas_gl_common_texture_rgb_a_pair_update(Evas_GL_Texture *tex, } } on_error: - glBindTexture(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex); + evas_glBindTexture_th(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex); } Evas_GL_Texture * @@ -1970,19 +1970,19 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned i // FIXME: works on lowest size 4 pixel high buffers. must also be multiple of 2 if (tex->gc->shared->info.unpack_row_length) { - glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + evas_glPixelStorei_th(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]); + evas_glPixelStorei_th(GL_UNPACK_ALIGNMENT, 1); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->pt->texture); if (!_tex_2d(tex->gc, tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat)) return; _tex_sub_2d(tex->gc, 0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]); - glBindTexture(GL_TEXTURE_2D, tex->ptu->texture); - glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + 1] - rows[h]); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->ptu->texture); + evas_glPixelStorei_th(GL_UNPACK_ROW_LENGTH, rows[h + 1] - rows[h]); if (!_tex_2d(tex->gc, tex->ptu->intformat, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat)) return; _tex_sub_2d(tex->gc, 0, 0, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat, rows[h]); - glBindTexture(GL_TEXTURE_2D, tex->ptv->texture); - glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + (h / 2) + 1] - rows[h + (h / 2)]); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->ptv->texture); + evas_glPixelStorei_th(GL_UNPACK_ROW_LENGTH, rows[h + (h / 2) + 1] - rows[h + (h / 2)]); if (!_tex_2d(tex->gc, tex->ptv->intformat, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat)) return; _tex_sub_2d(tex->gc, 0, 0, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat, rows[h + (h / 2)]); @@ -1991,8 +1991,8 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned i { unsigned int y; - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + evas_glPixelStorei_th(GL_UNPACK_ALIGNMENT, 1); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->pt->texture); if (!_tex_2d(tex->gc, tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat)) return; if ((rows[1] - rows[0]) == (int)w) @@ -2003,7 +2003,7 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned i _tex_sub_2d(tex->gc, 0, y, w, 1, tex->pt->format, tex->pt->dataformat, rows[y]); } - glBindTexture(GL_TEXTURE_2D, tex->ptu->texture); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->ptu->texture); if (!_tex_2d(tex->gc, tex->ptu->intformat, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat)) return; if ((rows[h + 1] - rows[h]) == (int)(w / 2)) @@ -2014,7 +2014,7 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned i _tex_sub_2d(tex->gc, 0, y, w / 2, 1, tex->ptu->format, tex->ptu->dataformat, rows[h + y]); } - glBindTexture(GL_TEXTURE_2D, tex->ptv->texture); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->ptv->texture); if (!_tex_2d(tex->gc, tex->ptv->intformat, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat)) return; if ((rows[h + (h / 2) + 1] - rows[h + (h / 2)]) == (int)(w / 2)) @@ -2026,7 +2026,7 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned i } } if (tex->pt->texture != tex->gc->state.current.cur_tex) - glBindTexture(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex); + evas_glBindTexture_th(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex); } static Evas_GL_Texture * @@ -2165,8 +2165,8 @@ evas_gl_common_texture_yuy2_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned tex->pt = tex->double_buffer.pt[tex->double_buffer.source]; tex->ptuv = tex->double_buffer.ptuv[tex->double_buffer.source]; - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + evas_glPixelStorei_th(GL_UNPACK_ALIGNMENT, 1); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->pt->texture); if (!_tex_2d(tex->gc, tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat)) return; if ((rows[1] - rows[0]) == (int)w * 4) @@ -2177,7 +2177,7 @@ evas_gl_common_texture_yuy2_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned _tex_sub_2d(tex->gc, 0, y, w, 1, tex->pt->format, tex->pt->dataformat, rows[y]); } - glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->ptuv->texture); if (!_tex_2d(tex->gc, tex->ptuv->intformat, w / 2, h, tex->ptuv->format, tex->ptuv->dataformat)) return; #if 0 @@ -2195,7 +2195,7 @@ evas_gl_common_texture_yuy2_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned } if (tex->pt->texture != tex->gc->state.current.cur_tex) - glBindTexture(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex); + evas_glBindTexture_th(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex); } void @@ -2210,14 +2210,14 @@ evas_gl_common_texture_nv12_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned // FIXME: works on lowest size 4 pixel high buffers. must also be multiple of 2 if (tex->gc->shared->info.unpack_row_length) { - glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + evas_glPixelStorei_th(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]); + evas_glPixelStorei_th(GL_UNPACK_ALIGNMENT, 1); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->pt->texture); if (!_tex_2d(tex->gc, tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat)) return; _tex_sub_2d(tex->gc, 0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]); - glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture); - glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + 1] - rows[h]); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->ptuv->texture); + evas_glPixelStorei_th(GL_UNPACK_ROW_LENGTH, rows[h + 1] - rows[h]); if (!_tex_2d(tex->gc, tex->ptuv->intformat, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat)) return; _tex_sub_2d(tex->gc, 0, 0, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat, rows[h]); @@ -2226,8 +2226,8 @@ evas_gl_common_texture_nv12_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned { unsigned int y; - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + evas_glPixelStorei_th(GL_UNPACK_ALIGNMENT, 1); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->pt->texture); if (!_tex_2d(tex->gc, tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat)) return; if ((rows[1] - rows[0]) == (int)w) @@ -2238,7 +2238,7 @@ evas_gl_common_texture_nv12_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned _tex_sub_2d(tex->gc, 0, y, w, 1, tex->pt->format, tex->pt->dataformat, rows[y]); } - glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->ptuv->texture); if (!_tex_2d(tex->gc, tex->ptuv->intformat, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat)) return; if ((rows[h + 1] - rows[h]) == (int)(w / 2)) @@ -2250,7 +2250,7 @@ evas_gl_common_texture_nv12_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned } } if (tex->pt->texture != tex->gc->state.current.cur_tex) - glBindTexture(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex); + evas_glBindTexture_th(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex); } void @@ -2407,8 +2407,8 @@ evas_gl_common_texture_nv12tiled_update(Evas_GL_Texture *tex, DATA8 **rows, unsi } #endif - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + evas_glPixelStorei_th(GL_UNPACK_ALIGNMENT, 1); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->pt->texture); // We are telling the driver to not swizzle back the buffer as we are going to replace all pixel if (!_tex_2d(tex->gc, tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat)) @@ -2455,7 +2455,7 @@ evas_gl_common_texture_nv12tiled_update(Evas_GL_Texture *tex, DATA8 **rows, unsi _tex_sub_2d(tex->gc, x, ry, 64, 32, tex->pt->format, tex->pt->dataformat, rows[mb_y] + rmb_x); } - glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture); + evas_glBindTexture_th(GL_TEXTURE_2D, tex->ptuv->texture); if (!_tex_2d(tex->gc, tex->ptuv->intformat, w, h, tex->ptuv->format, tex->ptuv->dataformat)) return; |