diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_common.h b/legacy/evas/src/modules/engines/gl_common/evas_gl_common.h index 80d4a8a37e..6fcf1d0af5 100644 --- a/legacy/evas/src/modules/engines/gl_common/evas_gl_common.h +++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_common.h @@ -128,6 +128,7 @@ struct _Evas_GL_Shared struct { GLint max_texture_units; GLint max_texture_size; + GLint max_vertex_elements; GLfloat anisotropic; Eina_Bool rgb : 1; Eina_Bool bgra : 1; diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_context.c b/legacy/evas/src/modules/engines/gl_common/evas_gl_context.c index 052643fe1f..d579b7a14f 100644 --- a/legacy/evas/src/modules/engines/gl_common/evas_gl_context.c +++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_context.c @@ -461,8 +461,8 @@ evas_gl_common_context_new(void) // FIXME: there should be an extension name/string to check for // not just symbols in the lib i = 0; - if (getenv("EVAS_GL_NO_MAP_IMAGE_SEC")) - i = atoi(getenv("EVAS_GL_NO_MAP_IMAGE_SEC")); + s = getenv("EVAS_GL_NO_MAP_IMAGE_SEC"); + if (s) i = atoi(s); if (!i) { // test for all needed symbols - be "conservative" and @@ -481,6 +481,15 @@ evas_gl_common_context_new(void) &(shared->info.max_texture_units)); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &(shared->info.max_texture_size)); + shared->info.max_vertex_elements = 6 * 10000; +#ifdef GL_MAX_ELEMENTS_VERTICES + glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, + &(shared->info.max_vertex_elements)); +#endif + s = getenv("EVAS_GL_VERTEX_MAX"); + if (s) shared->info.max_vertex_elements = atoi(s); + if (shared->info.max_vertex_elements < 6) + shared->info.max_vertex_elements = 6; // magic numbers that are a result of imperical testing and getting // "best case" performance across a range of systems @@ -531,6 +540,9 @@ evas_gl_common_context_new(void) "bgra : %i\n" "max ansiotropic filtering: %3.3f\n" "egl sec map image: %i\n" + "max vertex count: %i\n" + "\n" + "(can set EVAS_GL_VERTEX_MAX EVAS_GL_NO_MAP_IMAGE_SEC EVAS_GL_INFO EVAS_GL_MEMINFO )\n" "\n" "EVAS_GL_CUTOUT_MAX: %i\n" "EVAS_GL_PIPES_MAX: %i\n" @@ -546,6 +558,7 @@ evas_gl_common_context_new(void) (int)shared->info.bgra, (double)shared->info.anisotropic, (int)shared->info.sec_image_map, + (int)shared->info.max_vertex_elements, (int)shared->info.tune.cutout.max, (int)shared->info.tune.pipes.max, @@ -1005,6 +1018,19 @@ pipe_region_expand(Evas_GL_Context *gc, int n, gc->pipe[n].region.h = y2 - y1; } +static Eina_Bool +vertex_array_size_check(Evas_GL_Context *gc, int pn, int n) +{ + return 1; +// this fixup breaks for expedite test 32. why? + if ((gc->pipe[pn].array.num + n) > gc->shared->info.max_vertex_elements) + { + shader_array_flush(gc); + return 0; + } + return 1; +} + void evas_gl_common_context_line_push(Evas_GL_Context *gc, int x1, int y1, int x2, int y2, @@ -1020,6 +1046,7 @@ evas_gl_common_context_line_push(Evas_GL_Context *gc, if (gc->dc->render_op == EVAS_RENDER_COPY) blend = 0; shader_array_flush(gc); + vertex_array_size_check(gc, gc->state.top_pipe, 2); pn = gc->state.top_pipe; gc->pipe[pn].shader.cur_tex = 0; gc->pipe[pn].shader.cur_prog = prog; @@ -1040,7 +1067,7 @@ evas_gl_common_context_line_push(Evas_GL_Context *gc, pnum = gc->pipe[pn].array.num; nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nt = pnum * 4; - gc->pipe[pn].array.num += 1; + gc->pipe[pn].array.num += 2; array_alloc(gc, pn); PUSH_VERTEX(pn, x1, y1, 0); @@ -1074,6 +1101,7 @@ evas_gl_common_context_rectangle_push(Evas_GL_Context *gc, if (gc->dc->render_op == EVAS_RENDER_COPY) blend = 0; again: + vertex_array_size_check(gc, gc->state.top_pipe, 6); pn = gc->state.top_pipe; #ifdef GLPIPES if ((pn == 0) && (gc->pipe[pn].array.num == 0)) @@ -1246,6 +1274,7 @@ evas_gl_common_context_image_push(Evas_GL_Context *gc, } again: + vertex_array_size_check(gc, gc->state.top_pipe, 6); pn = gc->state.top_pipe; #ifdef GLPIPES if ((pn == 0) && (gc->pipe[pn].array.num == 0)) @@ -1445,6 +1474,7 @@ evas_gl_common_context_font_push(Evas_GL_Context *gc, int pn = 0; again: + vertex_array_size_check(gc, gc->state.top_pipe, 6); pn = gc->state.top_pipe; #ifdef GLPIPES if ((pn == 0) && (gc->pipe[pn].array.num == 0)) @@ -1613,6 +1643,7 @@ evas_gl_common_context_yuv_push(Evas_GL_Context *gc, prog = gc->shared->shader.yuv.prog; again: + vertex_array_size_check(gc, gc->state.top_pipe, 6); pn = gc->state.top_pipe; #ifdef GLPIPES if ((pn == 0) && (gc->pipe[pn].array.num == 0)) @@ -1881,6 +1912,7 @@ evas_gl_common_context_image_map4_push(Evas_GL_Context *gc, // /*xxx*/ shader_array_flush(gc); again: + vertex_array_size_check(gc, gc->state.top_pipe, 6); pn = gc->state.top_pipe; #ifdef GLPIPES if ((pn == 0) && (gc->pipe[pn].array.num == 0))