From 0f6d101ad5ec8327088e448c347e1f4054a5c8d7 Mon Sep 17 00:00:00 2001 From: Oleksandr Shcherbina Date: Wed, 22 Apr 2015 15:15:08 +0200 Subject: [PATCH] evas: add to Evas_GL_Image flag disable generate atlas. Summary: It is need in case Evas_3D_Mesh created with not normileze texture coordinate and flag repeat mode for Evas_3D_Texture Additional info see here https://phab.enlightenment.org/conpherence/54/ Use Evas_GL_Image for generation texture unit for Evas_3D_Texture see here https://phab.enlightenment.org/D2371 Reviewers: jpeg, cedric Reviewed By: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2375 Signed-off-by: Cedric BAIL --- .../evas/engines/gl_common/evas_gl_common.h | 4 +++- .../evas/engines/gl_common/evas_gl_image.c | 8 ++++---- .../evas/engines/gl_common/evas_gl_texture.c | 17 +++++++++++------ .../evas/engines/gl_generic/evas_engine.c | 2 +- 4 files changed, 19 insertions(+), 12 deletions(-) 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 d4ca68d0b9..4460835255 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_common.h +++ b/src/modules/evas/engines/gl_common/evas_gl_common.h @@ -654,6 +654,8 @@ struct _Evas_GL_Image unsigned char tex_only : 1; unsigned char locked : 1; // gl_surface_lock/unlock unsigned char direct : 1; // evas gl direct renderable + /*Disable generate atlas for texture unit, EINA_FALSE by default*/ + Eina_Bool disable_atlas : 1; }; struct _Evas_GL_Font_Texture @@ -811,7 +813,7 @@ int evas_gl_common_file_cache_save(Evas_GL_Shared *shared); void evas_gl_common_rect_draw(Evas_Engine_GL_Context *gc, int x, int y, int w, int h); void evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt); -Evas_GL_Texture *evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im); +Evas_GL_Texture *evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im, Eina_Bool disable_atlas); Evas_GL_Texture *evas_gl_common_texture_native_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, Evas_GL_Image *im); Evas_GL_Texture *evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha); Evas_GL_Texture *evas_gl_common_texture_dynamic_new(Evas_Engine_GL_Context *gc, Evas_GL_Image *im); diff --git a/src/modules/evas/engines/gl_common/evas_gl_image.c b/src/modules/evas/engines/gl_common/evas_gl_image.c index 09d999bf5e..3a4ad546bc 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_image.c +++ b/src/modules/evas/engines/gl_common/evas_gl_image.c @@ -516,7 +516,7 @@ evas_gl_common_image_alpha_set(Evas_GL_Image *im, int alpha) } else { - im->tex = evas_gl_common_texture_new(im->gc, im->im); + im->tex = evas_gl_common_texture_new(im->gc, im->im, EINA_FALSE); if (im->tex) evas_gl_common_texture_update(im->tex, im->im); } return im; @@ -679,7 +679,7 @@ evas_gl_common_image_content_hint_set(Evas_GL_Image *im, int hint) evas_cache_image_colorspace(&im->im->cache_entry, im->cs.space); im->im = (RGBA_Image *)evas_cache_image_size_set(&im->im->cache_entry, im->w, im->h); if (!im->tex) - im->tex = evas_gl_common_texture_new(im->gc, im->im); + im->tex = evas_gl_common_texture_new(im->gc, im->im, EINA_FALSE); } } @@ -841,14 +841,14 @@ evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im) if (evas_cache2_image_cached(ie)) { evas_cache2_image_load_data(ie); - im->tex = evas_gl_common_texture_new(gc, im->im); + im->tex = evas_gl_common_texture_new(gc, im->im, im->disable_atlas); evas_cache2_image_unload_data(ie); } else #endif { evas_cache_image_load_data(ie); - im->tex = evas_gl_common_texture_new(gc, im->im); + im->tex = evas_gl_common_texture_new(gc, im->im, im->disable_atlas); evas_cache_image_unload_data(ie); } } 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 f65784d9b3..5c1c07f247 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_texture.c +++ b/src/modules/evas/engines/gl_common/evas_gl_texture.c @@ -439,13 +439,18 @@ _pool_tex_alloc(Evas_GL_Texture_Pool *pt, int w, int h, int *u, int *v) static Evas_GL_Texture_Pool * _pool_tex_find(Evas_Engine_GL_Context *gc, int w, int h, GLenum intformat, GLenum format, int *u, int *v, - Eina_Rectangle **apt, int atlas_w) + Eina_Rectangle **apt, int atlas_w, Eina_Bool disable_atlas) { Evas_GL_Texture_Pool *pt = NULL; Eina_List *l; int th2; int pool_h; - + /*Return texture unit without atlas*/ + if (disable_atlas) + { + pt = _pool_tex_new(gc, w, h, intformat, format); + return pt ? pt : NULL; + } if (atlas_w > gc->shared->info.max_texture_size) atlas_w = gc->shared->info.max_texture_size; if ((w > gc->shared->info.tune.atlas.max_w) || @@ -490,7 +495,7 @@ _pool_tex_find(Evas_Engine_GL_Context *gc, int w, int h, } Evas_GL_Texture * -evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im) +evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im, Eina_Bool disable_atlas) { Evas_GL_Texture *tex; GLsizei w, h; @@ -535,7 +540,7 @@ evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im) *matching_format[lformat].intformat, *matching_format[lformat].format, &u, &v, &tex->apt, - gc->shared->info.tune.atlas.max_alloc_size); + gc->shared->info.tune.atlas.max_alloc_size, disable_atlas); if (!tex->pt) { evas_gl_common_texture_light_free(tex); @@ -1350,7 +1355,7 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im) *matching_format[lformat].intformat, *matching_format[lformat].format, &u, &v, &tex->aptt, - tex->gc->shared->info.tune.atlas.max_alloc_size); + tex->gc->shared->info.tune.atlas.max_alloc_size, EINA_FALSE); if (!tex->ptt) goto upload; @@ -1470,7 +1475,7 @@ evas_gl_common_texture_alpha_new(Evas_Engine_GL_Context *gc, DATA8 *pixels, tex->pt = _pool_tex_find(gc, w + 3, fh, alpha_ifmt, alpha_fmt, &u, &v, &tex->apt, - gc->shared->info.tune.atlas.max_alloc_alpha_size); + gc->shared->info.tune.atlas.max_alloc_alpha_size, EINA_FALSE); if (!tex->pt) { evas_gl_common_texture_light_free(tex); diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c index 0167703a83..2597753e7a 100644 --- a/src/modules/evas/engines/gl_generic/evas_engine.c +++ b/src/modules/evas/engines/gl_generic/evas_engine.c @@ -966,7 +966,7 @@ eng_image_data_preload_request(void *data, void *image, const Eo *target) re->window_use(re->software.ob); gl_context = re->window_gl_context_get(re->software.ob); - gim->tex = evas_gl_common_texture_new(gl_context, gim->im); + gim->tex = evas_gl_common_texture_new(gl_context, gim->im, EINA_FALSE); } evas_gl_preload_target_register(gim->tex, (Eo*) target); }