From d45aa6509bf752cb964306ba8c4ccb97a1b1bad5 Mon Sep 17 00:00:00 2001 From: raster Date: Wed, 17 Feb 2010 04:21:59 +0000 Subject: [PATCH] lots of gl error catching.. if gl errors happen. it's a #defined macro so it can be removed. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@46233 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/modules/engines/gl_common/Makefile.am | 5 - src/modules/engines/gl_common/evas_gl_common.h | 8 + src/modules/engines/gl_common/evas_gl_context.c | 110 +++++++++- src/modules/engines/gl_common/evas_gl_gradient.c | 256 ----------------------- src/modules/engines/gl_common/evas_gl_image.c | 2 - src/modules/engines/gl_common/evas_gl_misc.c | 14 -- src/modules/engines/gl_common/evas_gl_shader.c | 17 ++ src/modules/engines/gl_common/evas_gl_texture.c | 67 +++++- src/modules/engines/gl_x11/evas_engine.c | 110 ++++++++-- src/modules/engines/gl_x11/evas_x_main.c | 9 +- 10 files changed, 289 insertions(+), 309 deletions(-) delete mode 100644 src/modules/engines/gl_common/evas_gl_gradient.c delete mode 100644 src/modules/engines/gl_common/evas_gl_misc.c diff --git a/src/modules/engines/gl_common/Makefile.am b/src/modules/engines/gl_common/Makefile.am index 217b97e..48c124b 100644 --- a/src/modules/engines/gl_common/Makefile.am +++ b/src/modules/engines/gl_common/Makefile.am @@ -43,11 +43,6 @@ evas_gl_font.c \ evas_gl_polygon.c \ evas_gl_line.c -#evas_gl_misc.c \ -#evas_gl_gradient.c \ -#evas_gl_polygon.c \ -# - libevas_engine_gl_common_la_LIBADD = @EINA_LIBS@ @evas_engine_gl_common_libs@ @dlopen_libs@ endif diff --git a/src/modules/engines/gl_common/evas_gl_common.h b/src/modules/engines/gl_common/evas_gl_common.h index e37ac2d..cc3da2f 100644 --- a/src/modules/engines/gl_common/evas_gl_common.h +++ b/src/modules/engines/gl_common/evas_gl_common.h @@ -340,4 +340,12 @@ void (*glsym_glBindFramebuffer) (GLenum a, GLuint b); void (*glsym_glFramebufferTexture2D) (GLenum a, GLenum b, GLenum c, GLuint d, GLint e); void (*glsym_glDeleteFramebuffers) (GLsizei a, const GLuint *b); +#define GL_ERRORS 1 + +#ifdef GL_ERRORS +# define GLERR(fn, fl, ln, op) if (glGetError()) glerr(fn, fl, ln, op) +#else +# define GLERR(fn, fl, ln, op) +#endif + #endif diff --git a/src/modules/engines/gl_common/evas_gl_context.c b/src/modules/engines/gl_common/evas_gl_context.c index 87ae505..d9f15cf 100644 --- a/src/modules/engines/gl_common/evas_gl_context.c +++ b/src/modules/engines/gl_common/evas_gl_context.c @@ -137,27 +137,39 @@ _evas_gl_common_viewport_set(Evas_GL_Context *gc) gc->change.size = 0; glViewport(0, 0, w, h); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); matrix_ident(proj); if (m == 1) matrix_ortho(proj, 0, w, 0, h, -1.0, 1.0); else matrix_ortho(proj, 0, w, h, 0, -1.0, 1.0); glUseProgram(gc->shared->shader.rect.prog); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.rect.prog, "mvp"), 1, GL_FALSE, proj); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUseProgram(gc->shared->shader.img.prog); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.img.prog, "mvp"), 1, GL_FALSE, proj); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUseProgram(gc->shared->shader.font.prog); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.font.prog, "mvp"), 1, GL_FALSE, proj); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUseProgram(gc->shared->shader.yuv.prog); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.yuv.prog, "mvp"), 1, GL_FALSE, proj); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUseProgram(gc->shared->shader.tex.prog); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader.tex.prog, "mvp"), 1, GL_FALSE, proj); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUseProgram(gc->shader.cur_prog); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } Evas_GL_Context * @@ -219,24 +231,36 @@ evas_gl_common_context_new(void) ); glDisable(GL_DEPTH_TEST); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glEnable(GL_DITHER); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glDisable(GL_BLEND); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); // no dest alpha // glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // dest alpha // glBlendFunc(GL_SRC_ALPHA, GL_ONE); // ??? glDepthMask(GL_FALSE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); #endif glEnableVertexAttribArray(SHAD_VERTEX); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glEnableVertexAttribArray(SHAD_COLOR); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); evas_gl_common_shader_program_init(&(shared->shader.rect), &(shader_rect_vert_src), @@ -259,10 +283,15 @@ evas_gl_common_context_new(void) &(shader_tex_frag_src), "tex"); glUseProgram(shared->shader.yuv.prog); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUniform1i(glGetUniformLocation(shared->shader.yuv.prog, "tex"), 0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUniform1i(glGetUniformLocation(shared->shader.yuv.prog, "texu"), 1); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUniform1i(glGetUniformLocation(shared->shader.yuv.prog, "texv"), 2); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glUseProgram(gc->shader.cur_prog); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); // in shader: // uniform sampler2D tex[8]; // @@ -363,9 +392,15 @@ evas_gl_common_context_target_surface_set(Evas_GL_Context *gc, # endif #endif if (gc->shader.surface == gc->def_surface) - glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0); + { + glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } else - glsym_glBindFramebuffer(GL_FRAMEBUFFER, surface->tex->pt->fb); + { + glsym_glBindFramebuffer(GL_FRAMEBUFFER, surface->tex->pt->fb); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } _evas_gl_common_viewport_set(gc); } @@ -914,14 +949,27 @@ shader_array_flush(Evas_GL_Context *gc) // fprintf(stderr, " flush array %i\n", gc->array.num); if (gc->shader.cur_prog != gc->shader.current.cur_prog) - glUseProgram(gc->shader.cur_prog); + { + glUseProgram(gc->shader.cur_prog); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } if (gc->shader.cur_tex != gc->shader.current.cur_tex) { - if (gc->shader.cur_tex) glEnable(GL_TEXTURE_2D); - else glDisable(GL_TEXTURE_2D); + if (gc->shader.cur_tex) + { + glEnable(GL_TEXTURE_2D); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } + else + { + glDisable(GL_TEXTURE_2D); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } glActiveTexture(GL_TEXTURE0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } if (gc->array.im) { @@ -938,10 +986,12 @@ shader_array_flush(Evas_GL_Context *gc) { case EVAS_RENDER_BLEND: /**< default op: d = d*(1-sa) + s */ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); break; case EVAS_RENDER_COPY: /**< d = s */ gc->shader.blend = 0; glBlendFunc(GL_ONE, GL_ONE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); break; // FIXME: fix blend funcs below! case EVAS_RENDER_BLEND_REL: /**< d = d*(1 - sa) + s*da */ @@ -956,13 +1006,22 @@ shader_array_flush(Evas_GL_Context *gc) case EVAS_RENDER_MUL: /**< d = d*s */ default: glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); break; } } if (gc->shader.blend != gc->shader.current.blend) { - if (gc->shader.blend) glEnable(GL_BLEND); - else glDisable(GL_BLEND); + if (gc->shader.blend) + { + glEnable(GL_BLEND); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } + else + { + glDisable(GL_BLEND); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } } if (gc->shader.smooth != gc->shader.current.smooth) { @@ -970,21 +1029,31 @@ shader_array_flush(Evas_GL_Context *gc) { #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); #endif glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } else { #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); #endif glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } } /* hmmm this breaks things. must find out why! @@ -1018,48 +1087,73 @@ shader_array_flush(Evas_GL_Context *gc) } */ glVertexAttribPointer(SHAD_VERTEX, 3, GL_SHORT, GL_FALSE, 0, gc->array.vertex); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glVertexAttribPointer(SHAD_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, gc->array.color); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); if (gc->array.use_texuv) { glEnableVertexAttribArray(SHAD_TEXUV); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glVertexAttribPointer(SHAD_TEXUV, 2, GL_FLOAT, GL_FALSE, 0, gc->array.texuv); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } else - glDisableVertexAttribArray(SHAD_TEXUV); + { + glDisableVertexAttribArray(SHAD_TEXUV); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } if (gc->array.line) { glDisableVertexAttribArray(SHAD_TEXUV); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glDisableVertexAttribArray(SHAD_TEXUV2); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glDisableVertexAttribArray(SHAD_TEXUV3); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glDrawArrays(GL_LINES, 0, gc->array.num); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } else { if ((gc->array.use_texuv2) && (gc->array.use_texuv3)) { glEnableVertexAttribArray(SHAD_TEXUV2); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glEnableVertexAttribArray(SHAD_TEXUV3); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glVertexAttribPointer(SHAD_TEXUV2, 2, GL_FLOAT, GL_FALSE, 0, gc->array.texuv2); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glVertexAttribPointer(SHAD_TEXUV3, 2, GL_FLOAT, GL_FALSE, 0, gc->array.texuv3); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glActiveTexture(GL_TEXTURE1); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, gc->shader.cur_texu); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glActiveTexture(GL_TEXTURE2); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, gc->shader.cur_texv); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glActiveTexture(GL_TEXTURE0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } else if (gc->array.use_texuv2) { glEnableVertexAttribArray(SHAD_TEXUV2); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glVertexAttribPointer(SHAD_TEXUV2, 2, GL_FLOAT, GL_FALSE, 0, gc->array.texuv2); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } else { glDisableVertexAttribArray(SHAD_TEXUV2); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glDisableVertexAttribArray(SHAD_TEXUV3); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } glDrawArrays(GL_TRIANGLES, 0, gc->array.num); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } if (gc->array.im) { diff --git a/src/modules/engines/gl_common/evas_gl_gradient.c b/src/modules/engines/gl_common/evas_gl_gradient.c deleted file mode 100644 index 72c75d8..0000000 --- a/src/modules/engines/gl_common/evas_gl_gradient.c +++ /dev/null @@ -1,256 +0,0 @@ -#include "evas_gl_private.h" - -Evas_GL_Gradient * -evas_gl_common_gradient_new(void) -{ - Evas_GL_Gradient *gr; - - gr = calloc(1, sizeof(Evas_GL_Gradient)); - if (!gr) return NULL; - gr->grad = evas_common_gradient_new(); - if (!gr->grad) { free(gr); return NULL; } - gr->changed = 1; - return gr; -} - -void -evas_gl_common_gradient_free(Evas_GL_Gradient *gr) -{ - if (!gr) return; - if (gr->grad) evas_common_gradient_free(gr->grad); - if (gr->tex) evas_gl_common_texture_free(gr->tex); - free(gr); -} - -void -evas_gl_common_gradient_color_stop_add(Evas_GL_Gradient *gr, int r, int g, int b, int a, int delta) -{ - if (!gr) return; - evas_common_gradient_color_stop_add(gr->grad, r, g, b, a, delta); - gr->changed = 1; -} - -void -evas_gl_common_gradient_alpha_stop_add(Evas_GL_Gradient *gr, int a, int delta) -{ - if (!gr) return; - evas_common_gradient_alpha_stop_add(gr->grad, a, delta); - gr->changed = 1; -} - -void -evas_gl_common_gradient_color_data_set(Evas_GL_Gradient *gr, void * map, int len, int has_alpha) -{ - if (!gr) return; - evas_common_gradient_color_data_set(gr->grad, map, len, has_alpha); - gr->changed = 1; -} - -void -evas_gl_common_gradient_alpha_data_set(Evas_GL_Gradient *gr, void * alpha_map, int len) -{ - if (!gr) return; - evas_common_gradient_alpha_data_set(gr->grad, alpha_map, len); - gr->changed = 1; -} - -void -evas_gl_common_gradient_clear(Evas_GL_Gradient *gr) -{ - if (!gr) return; - evas_common_gradient_clear(gr->grad); - gr->changed = 1; -} - -void -evas_gl_common_gradient_fill_set(Evas_GL_Gradient *gr, int x, int y, int w, int h) -{ - if (!gr) return; - evas_common_gradient_fill_set(gr->grad, x, y, w, h); - gr->changed = 1; -} - -void -evas_gl_common_gradient_fill_angle_set(Evas_GL_Gradient *gr, double angle) -{ - if (!gr) return; - evas_common_gradient_fill_angle_set(gr->grad, angle); - gr->changed = 1; -} - -void -evas_gl_common_gradient_fill_spread_set(Evas_GL_Gradient *gr, int spread) -{ - if (!gr) return; - evas_common_gradient_fill_spread_set(gr->grad, spread); - gr->changed = 1; -} - -void -evas_gl_common_gradient_map_angle_set(Evas_GL_Gradient *gr, double angle) -{ - if (!gr) return; - evas_common_gradient_map_angle_set(gr->grad, angle); - gr->changed = 1; -} - -void -evas_gl_common_gradient_map_offset_set(Evas_GL_Gradient *gr, float offset) -{ - if (!gr) return; - evas_common_gradient_map_offset_set(gr->grad, offset); - gr->changed = 1; -} - -void -evas_gl_common_gradient_map_direction_set(Evas_GL_Gradient *gr, int direction) -{ - if (!gr) return; - evas_common_gradient_map_direction_set(gr->grad, direction); - gr->changed = 1; -} - -void -evas_gl_common_gradient_type_set(Evas_GL_Gradient *gr, char *name, char *params) -{ - if (!gr) return; - evas_common_gradient_type_set(gr->grad, name, params); - gr->changed = 1; -} - -int -evas_gl_common_gradient_is_opaque(Evas_GL_Context *gc, Evas_GL_Gradient *gr, - int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) -{ - RGBA_Draw_Context *dc; - - if (!gc || !gc->dc || !gr || !gr->grad || !gr->grad->type.geometer) return 0; - dc = gc->dc; - return !(gr->grad->type.geometer->has_alpha(gr->grad, dc->render_op) | - gr->grad->type.geometer->has_mask(gr->grad, dc->render_op)); -} - -int -evas_gl_common_gradient_is_visible(Evas_GL_Context *gc, Evas_GL_Gradient *gr, - int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) -{ - if (!gc || !gr) return 0; - return 1; -} - -void -evas_gl_common_gradient_render_pre(Evas_GL_Context *gc, Evas_GL_Gradient *gr) -{ - int len; - RGBA_Draw_Context *dc; - RGBA_Gradient *grad; - - if (!gr || !gc || !gr->grad || !gc->dc) return; - grad = gr->grad; - dc = gc->dc; - if (!grad->type.geometer) return; - grad->type.geometer->geom_set(grad); - len = grad->type.geometer->get_map_len(grad); - evas_common_gradient_map(dc, grad, len); - gr->changed = 1; -} - -void -evas_gl_common_gradient_render_post(Evas_GL_Gradient *gr __UNUSED__) -{ -} - -void -evas_gl_common_gradient_draw(Evas_GL_Context *gc, - Evas_GL_Gradient *gr, - int x, int y, int w, int h) -{ - int r, g, b, a; - RGBA_Draw_Context *dc; - double tx2, ty2; - - if ((w < 1) || (h < 1)) return; - if (!gr || !gc || !gc->dc) return; - if (!gr->grad || !gr->grad->type.geometer) return; - - dc = gc->dc; - if (dc->mul.use) - { - a = (dc->mul.col >> 24) & 0xff; - r = (dc->mul.col >> 16) & 0xff; - g = (dc->mul.col >> 8 ) & 0xff; - b = (dc->mul.col ) & 0xff; - } - else - { - r = g = b = a = 255; - } - evas_gl_common_context_color_set(gc, r, g, b, a); - - a = !evas_gl_common_gradient_is_opaque(gc, gr, x, y, w, h); - evas_gl_common_context_blend_set(gc, a); - - if (dc->clip.use) - evas_gl_common_context_clip_set(gc, 1, - dc->clip.x, dc->clip.y, - dc->clip.w, dc->clip.h); - else - evas_gl_common_context_clip_set(gc, 0, - 0, 0, 0, 0); - - if (!gr->tex) gr->changed = 1; - if (((w != gr->tw) || (h != gr->th)) && gr->tex) - { - evas_gl_common_texture_free(gr->tex); - gr->tex = NULL; - gr->changed = 1; - } - if (gr->changed) - { - RGBA_Image *im; - int op = dc->render_op, cuse = dc->clip.use; - - im = (RGBA_Image *) evas_cache_image_empty(evas_common_image_cache_get()); - if (!im) return; - im = (RGBA_Image *) evas_cache_image_size_set(&im->cache_entry, w, h); - dc->render_op = _EVAS_RENDER_FILL; - dc->clip.use = 0; - evas_common_gradient_draw(im, dc, 0, 0, w, h, gr->grad); - if (!gr->tex) - gr->tex = evas_gl_common_texture_new(gc, im, 0); - else - evas_gl_common_texture_update(gr->tex, im, 0); - - evas_cache_image_drop(&im->cache_entry); - - dc->render_op = op; - dc->clip.use = cuse; - if (!gr->tex) return; - } - - if (gr->tex->rectangle) - { - tx2 = w; - ty2 = h; - } - else - { - tx2 = (double)w / (double)(gr->tex->w); - ty2 = (double)h / (double)(gr->tex->h); - } - - evas_gl_common_context_texture_set(gc, gr->tex, 0, - gr->tex->tw, gr->tex->th); - - evas_gl_common_context_read_buf_set(gc, GL_BACK); - evas_gl_common_context_write_buf_set(gc, GL_BACK); - - glBegin(GL_QUADS); - glTexCoord2d(0.0, 0.0); glVertex2i(x, y); - glTexCoord2d(tx2, 0.0); glVertex2i(x + w, y); - glTexCoord2d(tx2, ty2); glVertex2i(x + w, y + h); - glTexCoord2d(0.0, ty2); glVertex2i(x, y + h); - glEnd(); - gr->changed = 0; - gr->tw = w; gr->th = h; -} diff --git a/src/modules/engines/gl_common/evas_gl_image.c b/src/modules/engines/gl_common/evas_gl_image.c index 0a839da..8833ab3 100644 --- a/src/modules/engines/gl_common/evas_gl_image.c +++ b/src/modules/engines/gl_common/evas_gl_image.c @@ -363,8 +363,6 @@ evas_gl_common_image_map4_draw(Evas_GL_Context *gc, Evas_GL_Image *im, _evas_gl_common_image_update(gc, im); - glFlush(); - c = gc->dc->clip.use; cx = gc->dc->clip.x; cy = gc->dc->clip.y; cw = gc->dc->clip.w; ch = gc->dc->clip.h; diff --git a/src/modules/engines/gl_common/evas_gl_misc.c b/src/modules/engines/gl_common/evas_gl_misc.c deleted file mode 100644 index 66483c7..0000000 --- a/src/modules/engines/gl_common/evas_gl_misc.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "evas_gl_private.h" - -void -evas_gl_common_swap_rect(Evas_GL_Context *gc, int x, int y, int w, int h) -{ - evas_gl_common_context_read_buf_set(gc, GL_BACK); - evas_gl_common_context_write_buf_set(gc, GL_FRONT); - evas_gl_common_context_blend_set(gc, 0); - evas_gl_common_context_clip_set(gc, 0, 0, 0, 0, 0); - evas_gl_common_context_dither_set(gc, 0); - y = gc->h - y - h; - glRasterPos2i(x, gc->h - y); - glCopyPixels(x, y, w, h, GL_COLOR); -} diff --git a/src/modules/engines/gl_common/evas_gl_shader.c b/src/modules/engines/gl_common/evas_gl_shader.c index 4ef99ca..bc136ab 100644 --- a/src/modules/engines/gl_common/evas_gl_shader.c +++ b/src/modules/engines/gl_common/evas_gl_shader.c @@ -235,12 +235,17 @@ evas_gl_common_shader_program_init(Evas_GL_Program *p, p->frag = glCreateShader(GL_FRAGMENT_SHADER); #if defined (GLES_VARIETY_S3C6410) glShaderBinary(1, &(p->vert), 0, vert->bin, vert->bin_size); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glShaderBinary(1, &(p->frag), 0, frag->bin, frag->bin_size); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); #else glShaderSource(p->vert, 1, (const char **)&(vert->src), NULL); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glCompileShader(p->vert); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glGetShaderiv(p->vert, GL_COMPILE_STATUS, &ok); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); if (!ok) { gl_compile_link_error(p->vert, "compile vertex shader"); @@ -249,8 +254,11 @@ evas_gl_common_shader_program_init(Evas_GL_Program *p, } glShaderSource(p->frag, 1, (const char **)&(frag->src), NULL); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glCompileShader(p->frag); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glGetShaderiv(p->frag, GL_COMPILE_STATUS, &ok); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); if (!ok) { gl_compile_link_error(p->frag, "compile fragment shader"); @@ -260,16 +268,25 @@ evas_gl_common_shader_program_init(Evas_GL_Program *p, #endif p->prog = glCreateProgram(); glAttachShader(p->prog, p->vert); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glAttachShader(p->prog, p->frag); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindAttribLocation(p->prog, SHAD_VERTEX, "vertex"); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindAttribLocation(p->prog, SHAD_COLOR, "color"); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindAttribLocation(p->prog, SHAD_TEXUV, "tex_coord"); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindAttribLocation(p->prog, SHAD_TEXUV2, "tex_coord2"); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindAttribLocation(p->prog, SHAD_TEXUV3, "tex_coord3"); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glLinkProgram(p->prog); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glGetProgramiv(p->prog, GL_LINK_STATUS, &ok); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); if (!ok) { gl_compile_link_error(p->prog, "link fragment and vertex shaders"); diff --git a/src/modules/engines/gl_common/evas_gl_texture.c b/src/modules/engines/gl_common/evas_gl_texture.c index 6a34d88..b700e07 100644 --- a/src/modules/engines/gl_common/evas_gl_texture.c +++ b/src/modules/engines/gl_common/evas_gl_texture.c @@ -91,12 +91,14 @@ static void _tex_2d(int intfmt, int w, int h, int fmt, int type) { glTexImage2D(GL_TEXTURE_2D, 0, intfmt, w, h, 0, fmt, type, NULL); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } static void _tex_sub_2d(int x, int y, int w, int h, int fmt, int type, const void *pix) { glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, fmt, type, pix); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); } static Evas_GL_Texture_Pool * @@ -116,13 +118,20 @@ _pool_tex_new(Evas_GL_Context *gc, int w, int h, int intformat, int format) pt->dataformat = GL_UNSIGNED_BYTE; pt->references = 0; glGenTextures(1, &(pt->texture)); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, pt->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); _tex_2d(pt->intformat, w, h, pt->format, pt->dataformat); glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); return pt; } @@ -295,19 +304,30 @@ _pool_tex_render_new(Evas_GL_Context *gc, int w, int h, int intformat, int forma # endif #endif glGenTextures(1, &(pt->texture)); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, pt->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); _tex_2d(pt->intformat, w, h, pt->format, pt->dataformat); glsym_glGenFramebuffers(1, &(pt->fb)); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glsym_glBindFramebuffer(GL_FRAMEBUFFER, pt->fb); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glsym_glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, pt->texture, 0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); return pt; } @@ -337,7 +357,9 @@ _pool_tex_native_new(Evas_GL_Context *gc, int w, int h, int intformat, int forma pt->references = 0; pt->native = 1; glGenTextures(1, &(pt->texture)); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(im->native.target, pt->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #else @@ -349,11 +371,17 @@ _pool_tex_native_new(Evas_GL_Context *gc, int w, int h, int intformat, int forma #endif glTexParameteri(im->native.target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(im->native.target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(im->native.target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glTexParameteri(im->native.target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(im->native.target, 0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(im->native.target, gc->shader.cur_tex); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); return pt; } @@ -372,7 +400,12 @@ pt_unref(Evas_GL_Texture_Pool *pt) } glDeleteTextures(1, &(pt->texture)); - if (pt->fb) glsym_glDeleteFramebuffers(1, &(pt->fb)); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + if (pt->fb) + { + glsym_glDeleteFramebuffers(1, &(pt->fb)); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } memset(pt, 0x22, sizeof(Evas_GL_Texture_Pool)); // mark as freed free(pt); } @@ -454,10 +487,13 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im) } if (!tex->pt) return; glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); #ifdef GL_UNPACK_ROW_LENGTH glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); #endif glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); // +-+ // +-+ @@ -508,7 +544,10 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im) rgba_fmt, tex->pt->dataformat, im->image.data + ((im->cache_entry.h - 1) * im->cache_entry.w) + (im->cache_entry.w - 1)); if (tex->pt->texture != tex->gc->shader.cur_tex) - glBindTexture(GL_TEXTURE_2D, tex->gc->shader.cur_tex); + { + glBindTexture(GL_TEXTURE_2D, tex->gc->shader.cur_tex); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } } void @@ -574,14 +613,20 @@ evas_gl_common_texture_alpha_update(Evas_GL_Texture *tex, DATA8 *pixels, { if (!tex->pt) return; glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); #ifdef GL_UNPACK_ROW_LENGTH glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); #endif glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); _tex_sub_2d(tex->x, tex->y, w, h, tex->pt->format, tex->pt->dataformat, pixels); if (tex->pt->texture != tex->gc->shader.cur_tex) - glBindTexture(GL_TEXTURE_2D, tex->gc->shader.cur_tex); + { + glBindTexture(GL_TEXTURE_2D, tex->gc->shader.cur_tex); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } } Evas_GL_Texture * @@ -655,18 +700,27 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, int w, int // FIXME: works on lowest size 4 pixel high buffers. must also be multiple of 2 #ifdef GL_UNPACK_ROW_LENGTH glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); _tex_sub_2d(0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]); glBindTexture(GL_TEXTURE_2D, tex->ptu->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + 1] - rows[h]); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); _tex_sub_2d(0, 0, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat, rows[h]); glBindTexture(GL_TEXTURE_2D, tex->ptv->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + (h / 2) + 1] - rows[h + (h / 2)]); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); _tex_sub_2d(0, 0, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat, rows[h + (h / 2)]); #else glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, tex->pt->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); if ((rows[1] - rows[0]) == w) _tex_sub_2d(0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]); else @@ -676,6 +730,7 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, int w, int } glBindTexture(GL_TEXTURE_2D, tex->ptu->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); if ((rows[h + 1] - rows[h]) == (w / 2)) _tex_sub_2d(0, 0, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat, rows[h]); else @@ -685,6 +740,7 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, int w, int } glBindTexture(GL_TEXTURE_2D, tex->ptv->texture); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); if ((rows[h + (h / 2) + 1] - rows[h + (h / 2)]) == (w / 2)) _tex_sub_2d(0, 0, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat, rows[h + (h / 2)]); else @@ -694,5 +750,8 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, int w, int } #endif if (tex->pt->texture != tex->gc->shader.cur_tex) - glBindTexture(GL_TEXTURE_2D, tex->gc->shader.cur_tex); + { + glBindTexture(GL_TEXTURE_2D, tex->gc->shader.cur_tex); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } } diff --git a/src/modules/engines/gl_x11/evas_engine.c b/src/modules/engines/gl_x11/evas_engine.c index 124cd8d..3fd8b8e 100644 --- a/src/modules/engines/gl_x11/evas_engine.c +++ b/src/modules/engines/gl_x11/evas_engine.c @@ -417,6 +417,10 @@ eng_output_redraws_next_update_push(void *data, void *surface __UNUSED__, int x // this is needed to make sure all previous rendering is flushed to // buffers/surfaces eglWaitNative(EGL_CORE_NATIVE_ENGINE); // previous rendering should be done and swapped + if (eglGetError() != EGL_SUCCESS) + { + printf("Error: eglWaitNative(EGL_CORE_NATIVE_ENGINE) fail.\n"); + } #else glXWaitGL(); #endif @@ -436,6 +440,10 @@ eng_output_flush(void *data) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) eglSwapBuffers(re->win->egl_disp, re->win->egl_surface[0]); + if (eglGetError() != EGL_SUCCESS) + { + printf("Error: eglSwapBuffers() fail.\n"); + } #else #ifdef VSYNC_TO_SCREEN if ((re->info->vsync)/* || (1)*/) @@ -1117,13 +1125,30 @@ _native_bind_cb(void *data, void *image) if (n->egl_surface) { if (glsym_glEGLImageTargetTexture2DOES) - glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->egl_surface); + { + glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->egl_surface); + if (eglGetError() != EGL_SUCCESS) + { + printf("Error: glEGLImageTargetTexture2DOES() fail.\n"); + } + } + else + { + printf("Try glEGLImageTargetTexture2DOES on EGL with no support\n"); + } } #else # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT if (glsym_glXBindTexImage) - glsym_glXBindTexImage(re->win->disp, n->glx_pixmap, - GLX_FRONT_LEFT_EXT, NULL); + { + glsym_glXBindTexImage(re->win->disp, n->glx_pixmap, + GLX_FRONT_LEFT_EXT, NULL); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } + else + { + printf("Try glXBindTexImage on GLX with no support\n"); + } # endif #endif } @@ -1140,8 +1165,15 @@ _native_unbind_cb(void *data, void *image) #else # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT if (glsym_glXReleaseTexImage) - glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap, - GLX_FRONT_LEFT_EXT); + { + glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap, + GLX_FRONT_LEFT_EXT); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } + else + { + printf("Try glXReleaseTexImage on GLX with no support\n"); + } # endif #endif } @@ -1157,8 +1189,18 @@ _native_free_cb(void *data, void *image) if (n->egl_surface) { if (glsym_eglDestroyImage) - glsym_eglDestroyImage(re->win->egl_disp, - n->egl_surface); + { + glsym_eglDestroyImage(re->win->egl_disp, + n->egl_surface); + if (eglGetError() != EGL_SUCCESS) + { + printf("Error: eglDestroyImage() fail.\n"); + } + } + else + { + printf("Try eglDestroyImage on EGL with no support\n"); + } } #else # ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT @@ -1167,12 +1209,25 @@ _native_free_cb(void *data, void *image) if (im->native.loose) { if (glsym_glXReleaseTexImage) - glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap, - GLX_FRONT_LEFT_EXT); + { + glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap, + GLX_FRONT_LEFT_EXT); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } + else + { + printf("Try glXReleaseTexImage on GLX with no support\n"); + } } -// printf("free glx pixmap %p\n", n->glx_pixmap); if (glsym_glXDestroyPixmap) - glsym_glXDestroyPixmap(re->win->disp, n->glx_pixmap); + { + glsym_glXDestroyPixmap(re->win->disp, n->glx_pixmap); + GLERR(__FUNCTION__, __FILE__, __LINE__, ""); + } + else + { + printf("Try glXDestroyPixmap on GLX with no support\n"); + } n->glx_pixmap = 0; } # endif @@ -1264,11 +1319,17 @@ eng_image_native_set(void *data, void *image, void *native) im->native.target = GL_TEXTURE_2D; im->native.mipmap = 0; if (glsym_eglCreateImage) - n->egl_surface = glsym_eglCreateImage(re->win->egl_disp, - EGL_NO_CONTEXT, - EGL_NATIVE_PIXMAP_KHR, - (void *)pm, - NULL); + { + n->egl_surface = glsym_eglCreateImage(re->win->egl_disp, + EGL_NO_CONTEXT, + EGL_NATIVE_PIXMAP_KHR, + (void *)pm, + NULL); + } + else + { + printf("Try eglCreateImage on EGL with no support\n"); + } if (!n->egl_surface) { printf("ERROR: eglCreatePixmapSurface() for 0x%x failed\n", (unsigned int)pm); @@ -1290,7 +1351,8 @@ eng_image_native_set(void *data, void *image, void *native) unsigned int w, h, depth = 32, border; Window wdummy; Native *n; - + + // fixme: round trip :( XGetGeometry(re->win->disp, pm, &wdummy, &dummy, &dummy, &w, &h, &border, &depth); n = calloc(1, sizeof(Native)); @@ -1355,8 +1417,14 @@ eng_image_native_set(void *data, void *image, void *native) im->native.func.unbind = _native_unbind_cb; im->native.func.free = _native_free_cb; if (glsym_glXCreatePixmap) - n->glx_pixmap = glsym_glXCreatePixmap(re->win->disp, n->fbc, - n->pixmap, pixmap_att); + { + n->glx_pixmap = glsym_glXCreatePixmap(re->win->disp, n->fbc, + n->pixmap, pixmap_att); + } + else + { + printf("Try glXCreatePixmap on GLX with no support\n"); + } if (n->glx_pixmap) { // printf("new native texture for %x | %4i x %4i @ %2i = %p\n", @@ -1386,6 +1454,10 @@ eng_image_native_set(void *data, void *image, void *native) printf("still unknown target\n"); } } + else + { + printf("ERROR: GLX Pixmap create fail\n"); + } evas_gl_common_image_native_enable(im); } diff --git a/src/modules/engines/gl_x11/evas_x_main.c b/src/modules/engines/gl_x11/evas_x_main.c index 2bfd4a9..c1d41fa 100644 --- a/src/modules/engines/gl_x11/evas_x_main.c +++ b/src/modules/engines/gl_x11/evas_x_main.c @@ -179,6 +179,10 @@ eng_window_new(Display *disp, } fbc = glXGetFBConfigs(disp, 0/* FIXME: assume screen 0 */, &num); + if (!fbc) + { + printf("ERROR: glXGetFBConfigs() returned no fb configs\n"); + } for (i = 0; i <= 32; i++) { for (j = 0; j < num; j++) @@ -364,6 +368,10 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo) configs = glXChooseFBConfig(einfo->info.display, einfo->info.screen, config_attrs, &num); + if ((!configs) || (num < 1)) + { + printf("ERROR: glXChooseFBConfig returned no configs\n"); + } for (i = 0; i < num; i++) { XVisualInfo *visinfo; @@ -395,7 +403,6 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo) } XFree(visinfo); } - printf("ecore_evas_gl_x11_new = %p\n", _evas_gl_x11_vi); #else int _evas_gl_x11_configuration[] = { -- 2.7.4