Evas gl: Add errors when using ETC1+Alpha as a normal texture

This commit is contained in:
Jean-Philippe Andre 2014-07-09 13:58:43 +09:00
parent ec9ffd0ae8
commit c65918eaed
1 changed files with 12 additions and 10 deletions

View File

@ -510,7 +510,6 @@ evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im)
case EVAS_COLORSPACE_ETC1: case EVAS_COLORSPACE_ETC1:
case EVAS_COLORSPACE_RGB8_ETC2: case EVAS_COLORSPACE_RGB8_ETC2:
case EVAS_COLORSPACE_RGBA8_ETC2_EAC: case EVAS_COLORSPACE_RGBA8_ETC2_EAC:
case EVAS_COLORSPACE_ETC1_ALPHA:
case EVAS_COLORSPACE_RGB_S3TC_DXT1: case EVAS_COLORSPACE_RGB_S3TC_DXT1:
case EVAS_COLORSPACE_RGBA_S3TC_DXT1: case EVAS_COLORSPACE_RGBA_S3TC_DXT1:
case EVAS_COLORSPACE_RGBA_S3TC_DXT2: case EVAS_COLORSPACE_RGBA_S3TC_DXT2:
@ -524,7 +523,10 @@ evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im)
xoffset = im->cache_entry.borders.l; xoffset = im->cache_entry.borders.l;
yoffset = im->cache_entry.borders.t; yoffset = im->cache_entry.borders.t;
break; break;
case EVAS_COLORSPACE_ETC1_ALPHA:
// One must call evas_gl_common_texture_rgb_a_pair_new() instead.
ERR("Trying to upload ETC1+Alpha texture as a normal texture. Abort.");
return NULL;
default: default:
// One pixel gap and two pixels for duplicated borders // One pixel gap and two pixels for duplicated borders
w = im->cache_entry.w + 3; w = im->cache_entry.w + 3;
@ -1182,7 +1184,6 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
case EVAS_COLORSPACE_RGB_S3TC_DXT1: case EVAS_COLORSPACE_RGB_S3TC_DXT1:
case EVAS_COLORSPACE_RGBA_S3TC_DXT1: case EVAS_COLORSPACE_RGBA_S3TC_DXT1:
case EVAS_COLORSPACE_ETC1: case EVAS_COLORSPACE_ETC1:
case EVAS_COLORSPACE_ETC1_ALPHA:
case EVAS_COLORSPACE_RGB8_ETC2: case EVAS_COLORSPACE_RGB8_ETC2:
{ {
/* /*
@ -1205,8 +1206,7 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if ((tex->gc->shared->info.etc1_subimage || if ((tex->gc->shared->info.etc1_subimage ||
((im->cache_entry.space != EVAS_COLORSPACE_ETC1) && (im->cache_entry.space != EVAS_COLORSPACE_ETC1))
(im->cache_entry.space != EVAS_COLORSPACE_ETC1_ALPHA)))
&& (tex->pt->w != width || tex->pt->h != height)) && (tex->pt->w != width || tex->pt->h != height))
{ {
int err; int err;
@ -1226,8 +1226,7 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
// FIXME: Changing settings on the fly. // FIXME: Changing settings on the fly.
// The first texture will be black. // The first texture will be black.
// How to fallback? We need a whole texture now. // How to fallback? We need a whole texture now.
if ((im->cache_entry.space == EVAS_COLORSPACE_ETC1) || if (im->cache_entry.space == EVAS_COLORSPACE_ETC1)
(im->cache_entry.space == EVAS_COLORSPACE_ETC1_ALPHA))
tex->gc->shared->info.etc1_subimage = EINA_FALSE; tex->gc->shared->info.etc1_subimage = EINA_FALSE;
} }
} }
@ -1245,12 +1244,15 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex); glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
return; return;
} }
case EVAS_COLORSPACE_ETC1_ALPHA:
// One must call evas_gl_common_texture_rgb_a_pair_update() instead.
ERR("Can't upload ETC1+Alpha texture as a normal texture. Abort.");
return;
default: default:
ERR("Don't know how to upload texture in colorspace %i.", im->cache_entry.space); ERR("Can't upload texture in colorspace %i.", im->cache_entry.space);
return; return;
} }
// if preloaded, then async push it in after uploading a miniature of it // if preloaded, then async push it in after uploading a miniature of it