summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/gl_common/evas_gl_texture.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2014-07-09 10:09:03 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2014-07-09 10:18:34 +0900
commit698f7f17709064cbcfc9b04425131f5d7fbe7699 (patch)
tree4c176ba7181e70f453eba4edc38b0915e35f08d0 /src/modules/evas/engines/gl_common/evas_gl_texture.c
parentcb0eef29c8d8b4a275d448a4a87352092efddb30 (diff)
Evas gl: Don't use glCompressedTexSubImage2D for ETC1
Eeeeh. Not only we don't support atlasses with this RGB+A thing yet, but ETC1 does not even support SubImage2D (according to the current spec). Also, fix a few typos in that same function.
Diffstat (limited to '')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_texture.c40
1 files changed, 23 insertions, 17 deletions
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 3d9ac62eb0..791dafbd40 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_texture.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_texture.c
@@ -1517,10 +1517,10 @@ evas_gl_common_texture_rgb_a_pair_new(Evas_Engine_GL_Context *gc,
1517 1517
1518void 1518void
1519evas_gl_common_texture_rgb_a_pair_update(Evas_GL_Texture *tex, 1519evas_gl_common_texture_rgb_a_pair_update(Evas_GL_Texture *tex,
1520 RGBA_Image *im) 1520 RGBA_Image *im)
1521{ 1521{
1522 DATA8 *data1, *data2; 1522 DATA8 *data1, *data2;
1523 Eina_Bool comp, upload; 1523 Eina_Bool comp, upload, subimage = EINA_TRUE;
1524 int w, h, sz, rowlen, ystep = 1; 1524 int w, h, sz, rowlen, ystep = 1;
1525 1525
1526 if (!tex->pt) return; 1526 if (!tex->pt) return;
@@ -1530,6 +1530,10 @@ evas_gl_common_texture_rgb_a_pair_update(Evas_GL_Texture *tex,
1530 ((int) im->cache_entry.space <= (int) EVAS_COLORSPACE_RGBA_S3TC_DXT5)) 1530 ((int) im->cache_entry.space <= (int) EVAS_COLORSPACE_RGBA_S3TC_DXT5))
1531 ystep = 4; 1531 ystep = 4;
1532 1532
1533 if ((im->cache_entry.space == EVAS_COLORSPACE_ETC1) ||
1534 (im->cache_entry.space == EVAS_COLORSPACE_ETC1_ALPHA))
1535 subimage = tex->gc->shared->info.etc1_subimage;
1536
1533 w = im->cache_entry.w + im->cache_entry.borders.l + im->cache_entry.borders.r; 1537 w = im->cache_entry.w + im->cache_entry.borders.l + im->cache_entry.borders.r;
1534 h = im->cache_entry.h + im->cache_entry.borders.t + im->cache_entry.borders.b; 1538 h = im->cache_entry.h + im->cache_entry.borders.t + im->cache_entry.borders.b;
1535 rowlen = _evas_gl_texture_size_get(w, ystep, tex->pt->intformat, NULL); 1539 rowlen = _evas_gl_texture_size_get(w, ystep, tex->pt->intformat, NULL);
@@ -1538,9 +1542,15 @@ evas_gl_common_texture_rgb_a_pair_update(Evas_GL_Texture *tex,
1538 data2 = data1 + sz; 1542 data2 = data1 + sz;
1539 upload = !!data1; 1543 upload = !!data1;
1540 1544
1541 if (tex->gc->shared->info.unpack_row_length) 1545 if ((w == tex->pt->w) && (h == tex->pt->h))
1546 subimage = EINA_FALSE;
1547
1548 if (!subimage || tex->gc->shared->info.unpack_row_length)
1542 { 1549 {
1543 glPixelStorei(GL_UNPACK_ROW_LENGTH, w); GLERRLOG(); 1550 if (tex->gc->shared->info.unpack_row_length)
1551 {
1552 glPixelStorei(GL_UNPACK_ROW_LENGTH, w); GLERRLOG();
1553 }
1544 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); GLERRLOG(); 1554 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); GLERRLOG();
1545 glBindTexture(GL_TEXTURE_2D, tex->pt->texture); GLERRLOG(); 1555 glBindTexture(GL_TEXTURE_2D, tex->pt->texture); GLERRLOG();
1546 if (!_tex_2d(tex->gc, tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat)) 1556 if (!_tex_2d(tex->gc, tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat))
@@ -1548,7 +1558,7 @@ evas_gl_common_texture_rgb_a_pair_update(Evas_GL_Texture *tex,
1548 if (upload) 1558 if (upload)
1549 { 1559 {
1550 if (comp) 1560 if (comp)
1551 _comp_tex_sub_2d(tex->gc, 0, 0, w, h, tex->pt->format, sz, data1); 1561 glCompressedTexImage2D(GL_TEXTURE_2D, 0, tex->pt->intformat, w, h, 0, sz, data1);
1552 else 1562 else
1553 _tex_sub_2d(tex->gc, 0, 0, w, h, tex->pt->format, tex->pt->dataformat, data1); 1563 _tex_sub_2d(tex->gc, 0, 0, w, h, tex->pt->format, tex->pt->dataformat, data1);
1554 } 1564 }
@@ -1558,9 +1568,9 @@ evas_gl_common_texture_rgb_a_pair_update(Evas_GL_Texture *tex,
1558 if (upload) 1568 if (upload)
1559 { 1569 {
1560 if (comp) 1570 if (comp)
1561 _comp_tex_sub_2d(tex->gc, 0, 0, w, h, tex->pt->format, sz, data2); 1571 glCompressedTexImage2D(GL_TEXTURE_2D, 0, tex->pta->intformat, w, h, 0, sz, data2);
1562 else 1572 else
1563 _tex_sub_2d(tex->gc, 0, 0, w, h, tex->pt->format, tex->pt->dataformat, data2); 1573 _tex_sub_2d(tex->gc, 0, 0, w, h, tex->pta->format, tex->pta->dataformat, data2);
1564 } 1574 }
1565 } 1575 }
1566 else 1576 else
@@ -1603,29 +1613,25 @@ evas_gl_common_texture_rgb_a_pair_update(Evas_GL_Texture *tex,
1603 if (w == tex->w) 1613 if (w == tex->w)
1604 { 1614 {
1605 if (comp) 1615 if (comp)
1606 _comp_tex_sub_2d(tex->gc, 0, 0, w, h, tex->pt->format, sz, data2); 1616 _comp_tex_sub_2d(tex->gc, 0, 0, w, h, tex->pta->format, sz, data2);
1607 else 1617 else
1608 _tex_sub_2d(tex->gc, 0, 0, w, h, tex->pt->format, tex->pt->dataformat, data2); 1618 _tex_sub_2d(tex->gc, 0, 0, w, h, tex->pta->format, tex->pta->dataformat, data2);
1609 } 1619 }
1610 else 1620 else
1611 { 1621 {
1612 for (y = 0; y < h; y += ystep) 1622 for (y = 0; y < h; y += ystep)
1613 { 1623 {
1614 if (comp) 1624 if (comp)
1615 _comp_tex_sub_2d(tex->gc, 0, 0, w, h, tex->pt->format, sz, data2); 1625 _comp_tex_sub_2d(tex->gc, 0, 0, w, h, tex->pta->format, sz, data2);
1616 else 1626 else
1617 _tex_sub_2d(tex->gc, 0, y, w, ystep, tex->pt->format, 1627 _tex_sub_2d(tex->gc, 0, y, w, ystep, tex->pta->format,
1618 tex->pt->dataformat, data2 + rowlen * y / ystep); 1628 tex->pta->dataformat, data2 + rowlen * y / ystep);
1619 } 1629 }
1620 } 1630 }
1621 } 1631 }
1622 } 1632 }
1623on_error: 1633on_error:
1624 if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex) 1634 glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex); GLERRLOG();
1625 {
1626 glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
1627 GLERRLOG();
1628 }
1629} 1635}
1630 1636
1631Evas_GL_Texture * 1637Evas_GL_Texture *