summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-01-14 16:30:29 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-01-14 16:37:06 +0900
commit80fe4b1673d34370caa63da8881478a1f0b4460b (patch)
tree63ec0a8cb0e8175f04bf0d6f3f4b4dc7149f311f /src/modules
parent1874ea9890f16d4a9f23c8d92099b9e083ea37db (diff)
Evas GL common: Add shader ID as debug info in the pipe
Simplifies code readability a bit and helps for debugging (with GDB).
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_common.h3
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_context.c186
2 files changed, 108 insertions, 81 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 b5a72c9568..e3fb112fdd 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -419,6 +419,7 @@ struct _Evas_Engine_GL_Context
419 struct { 419 struct {
420 int top_pipe; 420 int top_pipe;
421 struct { 421 struct {
422 Evas_GL_Shader id; // debug info
422 GLuint cur_prog; 423 GLuint cur_prog;
423 GLuint cur_tex, cur_texu, cur_texv, cur_texa, cur_texm; 424 GLuint cur_tex, cur_texu, cur_texv, cur_texa, cur_texm;
424 int render_op; 425 int render_op;
@@ -446,7 +447,7 @@ struct _Evas_Engine_GL_Context
446 Eina_Bool active : 1; 447 Eina_Bool active : 1;
447 } clip; 448 } clip;
448 struct { 449 struct {
449 Evas_GL_Shader id; 450 Evas_GL_Shader id; // debug info
450 Evas_GL_Image *surface; 451 Evas_GL_Image *surface;
451 GLuint cur_prog; 452 GLuint cur_prog;
452 GLuint cur_tex, cur_texu, cur_texv, cur_texa, cur_texm; 453 GLuint cur_tex, cur_texu, cur_texv, cur_texa, cur_texm;
diff --git a/src/modules/evas/engines/gl_common/evas_gl_context.c b/src/modules/evas/engines/gl_common/evas_gl_context.c
index 381872f3cc..8e659e567d 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_context.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_context.c
@@ -1020,6 +1020,7 @@ evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc)
1020// fprintf(stderr, "------------------------\n"); 1020// fprintf(stderr, "------------------------\n");
1021 1021
1022 gc->flushnum = 0; 1022 gc->flushnum = 0;
1023 gc->state.current.id = SHADER_LAST;
1023 gc->state.current.cur_prog = 0; 1024 gc->state.current.cur_prog = 0;
1024 gc->state.current.cur_tex = 0; 1025 gc->state.current.cur_tex = 0;
1025 gc->state.current.cur_texu = 0; 1026 gc->state.current.cur_texu = 0;
@@ -1048,6 +1049,7 @@ evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc)
1048 gc->pipe[i].clip.w = 0; 1049 gc->pipe[i].clip.w = 0;
1049 gc->pipe[i].clip.h = 0; 1050 gc->pipe[i].clip.h = 0;
1050 gc->pipe[i].shader.surface = NULL; 1051 gc->pipe[i].shader.surface = NULL;
1052 gc->pipe[i].shader.id = SHADER_LAST;
1051 gc->pipe[i].shader.cur_prog = 0; 1053 gc->pipe[i].shader.cur_prog = 0;
1052 gc->pipe[i].shader.cur_tex = 0; 1054 gc->pipe[i].shader.cur_tex = 0;
1053 gc->pipe[i].shader.cur_texu = 0; 1055 gc->pipe[i].shader.cur_texu = 0;
@@ -1184,7 +1186,8 @@ evas_gl_common_context_target_surface_set(Evas_Engine_GL_Context *gc,
1184 1186
1185 evas_gl_common_context_flush(gc); 1187 evas_gl_common_context_flush(gc);
1186 evas_gl_common_context_done(gc); 1188 evas_gl_common_context_done(gc);
1187 1189
1190 gc->state.current.id = SHADER_LAST;
1188 gc->state.current.cur_prog = PRG_INVALID; 1191 gc->state.current.cur_prog = PRG_INVALID;
1189 gc->state.current.cur_tex = -1; 1192 gc->state.current.cur_tex = -1;
1190 gc->state.current.cur_texu = -1; 1193 gc->state.current.cur_texu = -1;
@@ -1523,7 +1526,8 @@ evas_gl_common_context_line_push(Evas_Engine_GL_Context *gc,
1523 int r, int g, int b, int a) 1526 int r, int g, int b, int a)
1524{ 1527{
1525 Eina_Bool blend = EINA_FALSE; 1528 Eina_Bool blend = EINA_FALSE;
1526 GLuint prog = gc->shared->shader[SHADER_RECT].prog; 1529 Evas_GL_Shader shader = SHADER_RECT;
1530 GLuint prog = gc->shared->shader[shader].prog;
1527 int pn = 0, i; 1531 int pn = 0, i;
1528 1532
1529 // FIXME: Line masking is not implemented 1533 // FIXME: Line masking is not implemented
@@ -1534,6 +1538,7 @@ evas_gl_common_context_line_push(Evas_Engine_GL_Context *gc,
1534 shader_array_flush(gc); 1538 shader_array_flush(gc);
1535 vertex_array_size_check(gc, gc->state.top_pipe, 2); 1539 vertex_array_size_check(gc, gc->state.top_pipe, 2);
1536 pn = gc->state.top_pipe; 1540 pn = gc->state.top_pipe;
1541 gc->pipe[pn].shader.id = shader;
1537 gc->pipe[pn].shader.cur_tex = 0; 1542 gc->pipe[pn].shader.cur_tex = 0;
1538 gc->pipe[pn].shader.cur_prog = prog; 1543 gc->pipe[pn].shader.cur_prog = prog;
1539 gc->pipe[pn].shader.blend = blend; 1544 gc->pipe[pn].shader.blend = blend;
@@ -1585,7 +1590,8 @@ evas_gl_common_context_rectangle_push(Evas_Engine_GL_Context *gc,
1585 int mx, int my, int mw, int mh) 1590 int mx, int my, int mw, int mh)
1586{ 1591{
1587 Eina_Bool blend = EINA_FALSE; 1592 Eina_Bool blend = EINA_FALSE;
1588 GLuint prog = gc->shared->shader[SHADER_RECT].prog; 1593 Evas_GL_Shader shader = SHADER_RECT;
1594 GLuint prog;
1589 GLuint mtexid = 0; 1595 GLuint mtexid = 0;
1590 int pn = 0; 1596 int pn = 0;
1591 1597
@@ -1596,8 +1602,9 @@ evas_gl_common_context_rectangle_push(Evas_Engine_GL_Context *gc,
1596 { 1602 {
1597 blend = EINA_TRUE; 1603 blend = EINA_TRUE;
1598 mtexid = mtex->pt->texture; 1604 mtexid = mtex->pt->texture;
1599 prog = gc->shared->shader[SHADER_RECT_MASK].prog; 1605 shader = SHADER_RECT_MASK;
1600 } 1606 }
1607 prog = gc->shared->shader[shader].prog;
1601 1608
1602again: 1609again:
1603 vertex_array_size_check(gc, gc->state.top_pipe, 6); 1610 vertex_array_size_check(gc, gc->state.top_pipe, 6);
@@ -1606,6 +1613,7 @@ again:
1606 if ((pn == 0) && (gc->pipe[pn].array.num == 0)) 1613 if ((pn == 0) && (gc->pipe[pn].array.num == 0))
1607 { 1614 {
1608 gc->pipe[pn].region.type = RTYPE_RECT; 1615 gc->pipe[pn].region.type = RTYPE_RECT;
1616 gc->pipe[pn].shader.id = shader;
1609 gc->pipe[pn].shader.cur_tex = 0; 1617 gc->pipe[pn].shader.cur_tex = 0;
1610 gc->pipe[pn].shader.cur_texm = mtexid; 1618 gc->pipe[pn].shader.cur_texm = mtexid;
1611 gc->pipe[pn].shader.cur_prog = prog; 1619 gc->pipe[pn].shader.cur_prog = prog;
@@ -1657,6 +1665,7 @@ again:
1657 } 1665 }
1658 gc->state.top_pipe = pn; 1666 gc->state.top_pipe = pn;
1659 gc->pipe[pn].region.type = RTYPE_RECT; 1667 gc->pipe[pn].region.type = RTYPE_RECT;
1668 gc->pipe[pn].shader.id = shader;
1660 gc->pipe[pn].shader.cur_tex = 0; 1669 gc->pipe[pn].shader.cur_tex = 0;
1661 gc->pipe[pn].shader.cur_texm = mtexid; 1670 gc->pipe[pn].shader.cur_texm = mtexid;
1662 gc->pipe[pn].shader.cur_prog = prog; 1671 gc->pipe[pn].shader.cur_prog = prog;
@@ -1689,6 +1698,7 @@ again:
1689 { 1698 {
1690 shader_array_flush(gc); 1699 shader_array_flush(gc);
1691 pn = gc->state.top_pipe; 1700 pn = gc->state.top_pipe;
1701 gc->pipe[pn].shader.id = shader;
1692 gc->pipe[pn].shader.cur_tex = 0; 1702 gc->pipe[pn].shader.cur_tex = 0;
1693 gc->pipe[pn].shader.cur_texm = mtexid; 1703 gc->pipe[pn].shader.cur_texm = mtexid;
1694 gc->pipe[pn].shader.cur_prog = prog; 1704 gc->pipe[pn].shader.cur_prog = prog;
@@ -1742,7 +1752,8 @@ evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
1742 GLfloat tx1, tx2, ty1, ty2; 1752 GLfloat tx1, tx2, ty1, ty2;
1743 GLfloat offsetx, offsety; 1753 GLfloat offsetx, offsety;
1744 Eina_Bool blend = EINA_FALSE; 1754 Eina_Bool blend = EINA_FALSE;
1745 GLuint prog = gc->shared->shader[SHADER_IMG].prog; 1755 Evas_GL_Shader shader = SHADER_IMG;
1756 GLuint prog = gc->shared->shader[shader].prog;
1746 int pn = 0, sam = 0; 1757 int pn = 0, sam = 0;
1747 1758
1748 if (!(gc->dc->render_op == EVAS_RENDER_COPY) && 1759 if (!(gc->dc->render_op == EVAS_RENDER_COPY) &&
@@ -1758,30 +1769,30 @@ evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
1758 { 1769 {
1759 if ((smooth) && ((sw >= (w * 2)) && (sh >= (h * 2)))) 1770 if ((smooth) && ((sw >= (w * 2)) && (sh >= (h * 2))))
1760 { 1771 {
1761 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 1772 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1762 SHADER_IMG_22_BGRA_NOMUL, SHADER_IMG_22_BGRA, 1773 SHADER_IMG_22_BGRA_NOMUL, SHADER_IMG_22_BGRA,
1763 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA)].prog; 1774 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA);
1764 sam = 1; 1775 sam = 1;
1765 } 1776 }
1766 else if ((smooth) && (sw >= (w * 2))) 1777 else if ((smooth) && (sw >= (w * 2)))
1767 { 1778 {
1768 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 1779 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1769 SHADER_IMG_21_BGRA_NOMUL, SHADER_IMG_21_BGRA, 1780 SHADER_IMG_21_BGRA_NOMUL, SHADER_IMG_21_BGRA,
1770 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA)].prog; 1781 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA);
1771 sam = 1; 1782 sam = 1;
1772 } 1783 }
1773 else if ((smooth) && (sh >= (h * 2))) 1784 else if ((smooth) && (sh >= (h * 2)))
1774 { 1785 {
1775 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 1786 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1776 SHADER_IMG_12_BGRA_NOMUL, SHADER_IMG_12_BGRA, 1787 SHADER_IMG_12_BGRA_NOMUL, SHADER_IMG_12_BGRA,
1777 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA)].prog; 1788 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA);
1778 sam = 1; 1789 sam = 1;
1779 } 1790 }
1780 else 1791 else
1781 { 1792 {
1782 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 1793 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1783 SHADER_IMG_BGRA_NOMUL, SHADER_IMG_BGRA, 1794 SHADER_IMG_BGRA_NOMUL, SHADER_IMG_BGRA,
1784 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA)].prog; 1795 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA);
1785 } 1796 }
1786 } 1797 }
1787 else 1798 else
@@ -1789,49 +1800,49 @@ evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
1789 if ((smooth) && ((sw >= (w * 2)) && (sh >= (h * 2)))) 1800 if ((smooth) && ((sw >= (w * 2)) && (sh >= (h * 2))))
1790 { 1801 {
1791 if ((!tex->alpha) && (tex->pt->native)) 1802 if ((!tex->alpha) && (tex->pt->native))
1792 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 1803 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1793 SHADER_TEX_22_NOMUL_AFILL, SHADER_TEX_22_AFILL, 1804 SHADER_TEX_22_NOMUL_AFILL, SHADER_TEX_22_AFILL,
1794 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog; 1805 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK);
1795 else 1806 else
1796 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 1807 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1797 SHADER_TEX_22_NOMUL, SHADER_TEX_22, 1808 SHADER_TEX_22_NOMUL, SHADER_TEX_22,
1798 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog; 1809 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK);
1799 sam = 1; 1810 sam = 1;
1800 } 1811 }
1801 else if ((smooth) && (sw >= (w * 2))) 1812 else if ((smooth) && (sw >= (w * 2)))
1802 { 1813 {
1803 if ((!tex->alpha) && (tex->pt->native)) 1814 if ((!tex->alpha) && (tex->pt->native))
1804 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 1815 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1805 SHADER_TEX_21_NOMUL_AFILL, SHADER_TEX_21_AFILL, 1816 SHADER_TEX_21_NOMUL_AFILL, SHADER_TEX_21_AFILL,
1806 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog; 1817 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK);
1807 else 1818 else
1808 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 1819 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1809 SHADER_TEX_21_NOMUL, SHADER_TEX_21, 1820 SHADER_TEX_21_NOMUL, SHADER_TEX_21,
1810 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog; 1821 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK);
1811 sam = 1; 1822 sam = 1;
1812 } 1823 }
1813 else if ((smooth) && (sh >= (h * 2))) 1824 else if ((smooth) && (sh >= (h * 2)))
1814 { 1825 {
1815 if ((!tex->alpha) && (tex->pt->native)) 1826 if ((!tex->alpha) && (tex->pt->native))
1816 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 1827 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1817 SHADER_TEX_12_NOMUL_AFILL, SHADER_TEX_12_AFILL, 1828 SHADER_TEX_12_NOMUL_AFILL, SHADER_TEX_12_AFILL,
1818 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog; 1829 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK);
1819 else 1830 else
1820 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 1831 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1821 SHADER_TEX_12_NOMUL, SHADER_TEX_12, 1832 SHADER_TEX_12_NOMUL, SHADER_TEX_12,
1822 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog; 1833 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK);
1823 sam = 1; 1834 sam = 1;
1824 } 1835 }
1825 else 1836 else
1826 { 1837 {
1827 if ((!tex->alpha) && (tex->pt->native)) 1838 if ((!tex->alpha) && (tex->pt->native))
1828 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 1839 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1829 SHADER_TEX_NOMUL_AFILL, SHADER_TEX_AFILL, 1840 SHADER_TEX_NOMUL_AFILL, SHADER_TEX_AFILL,
1830 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog; 1841 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK);
1831 else 1842 else
1832 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 1843 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1833 SHADER_TEX_NOMUL, SHADER_TEX, 1844 SHADER_TEX_NOMUL, SHADER_TEX,
1834 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog; 1845 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK);
1835 } 1846 }
1836 } 1847 }
1837 } 1848 }
@@ -1841,63 +1852,64 @@ evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
1841 { 1852 {
1842 if ((smooth) && ((sw >= (w * 2)) && (sh >= (h * 2)))) 1853 if ((smooth) && ((sw >= (w * 2)) && (sh >= (h * 2))))
1843 { 1854 {
1844 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 1855 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1845 SHADER_IMG_22_BGRA_NOMUL, SHADER_IMG_22_BGRA, 1856 SHADER_IMG_22_BGRA_NOMUL, SHADER_IMG_22_BGRA,
1846 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA)].prog; 1857 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA);
1847 sam = 1; 1858 sam = 1;
1848 } 1859 }
1849 else if ((smooth) && (sw >= (w * 2))) 1860 else if ((smooth) && (sw >= (w * 2)))
1850 { 1861 {
1851 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 1862 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1852 SHADER_IMG_21_BGRA_NOMUL, SHADER_IMG_21_BGRA, 1863 SHADER_IMG_21_BGRA_NOMUL, SHADER_IMG_21_BGRA,
1853 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA)].prog; 1864 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA);
1854 sam = 1; 1865 sam = 1;
1855 } 1866 }
1856 else if ((smooth) && (sh >= (h * 2))) 1867 else if ((smooth) && (sh >= (h * 2)))
1857 { 1868 {
1858 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 1869 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1859 SHADER_IMG_12_BGRA_NOMUL, SHADER_IMG_12_BGRA, 1870 SHADER_IMG_12_BGRA_NOMUL, SHADER_IMG_12_BGRA,
1860 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA)].prog; 1871 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA);
1861 sam = 1; 1872 sam = 1;
1862 } 1873 }
1863 else 1874 else
1864 { 1875 {
1865 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 1876 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1866 SHADER_IMG_BGRA_NOMUL, SHADER_IMG_BGRA, 1877 SHADER_IMG_BGRA_NOMUL, SHADER_IMG_BGRA,
1867 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA)].prog; 1878 SHADER_IMG_MASK_BGRA_NOMUL, SHADER_IMG_MASK_BGRA);
1868 } 1879 }
1869 } 1880 }
1870 else 1881 else
1871 { 1882 {
1872 if ((smooth) && ((sw >= (w * 2)) && (sh >= (h * 2)))) 1883 if ((smooth) && ((sw >= (w * 2)) && (sh >= (h * 2))))
1873 { 1884 {
1874 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 1885 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1875 SHADER_IMG_22_NOMUL, SHADER_IMG_22, 1886 SHADER_IMG_22_NOMUL, SHADER_IMG_22,
1876 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog; 1887 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK);
1877 sam = 1; 1888 sam = 1;
1878 } 1889 }
1879 else if ((smooth) && (sw >= (w * 2))) 1890 else if ((smooth) && (sw >= (w * 2)))
1880 { 1891 {
1881 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 1892 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1882 SHADER_IMG_21_NOMUL, SHADER_IMG_21, 1893 SHADER_IMG_21_NOMUL, SHADER_IMG_21,
1883 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog; 1894 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK);
1884 sam = 1; 1895 sam = 1;
1885 } 1896 }
1886 else if ((smooth) && (sh >= (h * 2))) 1897 else if ((smooth) && (sh >= (h * 2)))
1887 { 1898 {
1888 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 1899 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1889 SHADER_IMG_12_NOMUL, SHADER_IMG_12, 1900 SHADER_IMG_12_NOMUL, SHADER_IMG_12,
1890 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog; 1901 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK);
1891 sam = 1; 1902 sam = 1;
1892 } 1903 }
1893 else 1904 else
1894 { 1905 {
1895 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 1906 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
1896 SHADER_IMG_NOMUL, SHADER_IMG, 1907 SHADER_IMG_NOMUL, SHADER_IMG,
1897 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK)].prog; 1908 SHADER_IMG_MASK_NOMUL, SHADER_IMG_MASK);
1898 } 1909 }
1899 } 1910 }
1900 } 1911 }
1912 prog = gc->shared->shader[shader].prog;
1901 1913
1902 if (tex->ptt) 1914 if (tex->ptt)
1903 { 1915 {
@@ -1927,6 +1939,7 @@ evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
1927 0, 0, 0, 0, 0); 1939 0, 0, 0, 0, 0);
1928 1940
1929 gc->pipe[pn].region.type = RTYPE_IMAGE; 1941 gc->pipe[pn].region.type = RTYPE_IMAGE;
1942 gc->pipe[pn].shader.id = shader;
1930 gc->pipe[pn].shader.cur_tex = pt->texture; 1943 gc->pipe[pn].shader.cur_tex = pt->texture;
1931 gc->pipe[pn].shader.cur_texm = mtex ? mtex->pt->texture : 0; 1944 gc->pipe[pn].shader.cur_texm = mtex ? mtex->pt->texture : 0;
1932 gc->pipe[pn].shader.cur_prog = prog; 1945 gc->pipe[pn].shader.cur_prog = prog;
@@ -2011,13 +2024,12 @@ evas_gl_common_context_font_push(Evas_Engine_GL_Context *gc,
2011 int r, int g, int b, int a) 2024 int r, int g, int b, int a)
2012{ 2025{
2013 GLfloat tx1, tx2, ty1, ty2; 2026 GLfloat tx1, tx2, ty1, ty2;
2027 Evas_GL_Shader shader;
2014 GLuint prog; 2028 GLuint prog;
2015 int pn = 0; 2029 int pn = 0;
2016 2030
2017 if (!mtex) 2031 shader = (!mtex) ? SHADER_FONT : SHADER_FONT_MASK;
2018 prog = gc->shared->shader[SHADER_FONT].prog; 2032 prog = gc->shared->shader[shader].prog;
2019 else
2020 prog = gc->shared->shader[SHADER_FONT_MASK].prog;
2021 2033
2022 pn = _evas_gl_common_context_push(RTYPE_FONT, 2034 pn = _evas_gl_common_context_push(RTYPE_FONT,
2023 gc, tex, mtex, 2035 gc, tex, mtex,
@@ -2028,6 +2040,7 @@ evas_gl_common_context_font_push(Evas_Engine_GL_Context *gc,
2028 0, 0, 0, 0, 0); 2040 0, 0, 0, 0, 0);
2029 2041
2030 gc->pipe[pn].region.type = RTYPE_FONT; 2042 gc->pipe[pn].region.type = RTYPE_FONT;
2043 gc->pipe[pn].shader.id = shader;
2031 gc->pipe[pn].shader.cur_tex = tex->pt->texture; 2044 gc->pipe[pn].shader.cur_tex = tex->pt->texture;
2032 gc->pipe[pn].shader.cur_texm = mtex ? mtex->pt->texture : 0; 2045 gc->pipe[pn].shader.cur_texm = mtex ? mtex->pt->texture : 0;
2033 gc->pipe[pn].shader.cur_prog = prog; 2046 gc->pipe[pn].shader.cur_prog = prog;
@@ -2098,15 +2111,17 @@ evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc,
2098{ 2111{
2099 GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2; 2112 GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2;
2100 Eina_Bool blend = 0; 2113 Eina_Bool blend = 0;
2114 Evas_GL_Shader shader;
2101 GLuint prog; 2115 GLuint prog;
2102 int pn = 0; 2116 int pn = 0;
2103 2117
2104 if ((a < 255) || (!!mtex)) 2118 if ((a < 255) || (!!mtex))
2105 blend = 1; 2119 blend = 1;
2106 2120
2107 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 2121 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
2108 SHADER_YUV_NOMUL, SHADER_YUV, 2122 SHADER_YUV_NOMUL, SHADER_YUV,
2109 SHADER_YUV_MASK, SHADER_YUV_MASK)].prog; 2123 SHADER_YUV_MASK, SHADER_YUV_MASK);
2124 prog = gc->shared->shader[shader].prog;
2110 2125
2111 pn = _evas_gl_common_context_push(RTYPE_YUV, 2126 pn = _evas_gl_common_context_push(RTYPE_YUV,
2112 gc, tex, mtex, 2127 gc, tex, mtex,
@@ -2117,6 +2132,7 @@ evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc,
2117 0, 0, 0, 0, 0); 2132 0, 0, 0, 0, 0);
2118 2133
2119 gc->pipe[pn].region.type = RTYPE_YUV; 2134 gc->pipe[pn].region.type = RTYPE_YUV;
2135 gc->pipe[pn].shader.id = shader;
2120 gc->pipe[pn].shader.cur_tex = tex->pt->texture; 2136 gc->pipe[pn].shader.cur_tex = tex->pt->texture;
2121 gc->pipe[pn].shader.cur_texu = tex->ptu->texture; 2137 gc->pipe[pn].shader.cur_texu = tex->ptu->texture;
2122 gc->pipe[pn].shader.cur_texv = tex->ptv->texture; 2138 gc->pipe[pn].shader.cur_texv = tex->ptv->texture;
@@ -2200,15 +2216,17 @@ evas_gl_common_context_yuy2_push(Evas_Engine_GL_Context *gc,
2200{ 2216{
2201 GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2; 2217 GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2;
2202 Eina_Bool blend = 0; 2218 Eina_Bool blend = 0;
2219 Evas_GL_Shader shader;
2203 GLuint prog; 2220 GLuint prog;
2204 int pn = 0; 2221 int pn = 0;
2205 2222
2206 if ((a < 255) || (!!mtex)) 2223 if ((a < 255) || (!!mtex))
2207 blend = 1; 2224 blend = 1;
2208 2225
2209 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 2226 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
2210 SHADER_YUY2_NOMUL, SHADER_YUY2, 2227 SHADER_YUY2_NOMUL, SHADER_YUY2,
2211 SHADER_YUY2_MASK, SHADER_YUY2_MASK)].prog; 2228 SHADER_YUY2_MASK, SHADER_YUY2_MASK);
2229 prog = gc->shared->shader[shader].prog;
2212 2230
2213 pn = _evas_gl_common_context_push(RTYPE_YUY2, 2231 pn = _evas_gl_common_context_push(RTYPE_YUY2,
2214 gc, tex, mtex, 2232 gc, tex, mtex,
@@ -2219,6 +2237,7 @@ evas_gl_common_context_yuy2_push(Evas_Engine_GL_Context *gc,
2219 0, 0, 0, 0, 0); 2237 0, 0, 0, 0, 0);
2220 2238
2221 gc->pipe[pn].region.type = RTYPE_YUY2; 2239 gc->pipe[pn].region.type = RTYPE_YUY2;
2240 gc->pipe[pn].shader.id = shader;
2222 gc->pipe[pn].shader.cur_tex = tex->pt->texture; 2241 gc->pipe[pn].shader.cur_tex = tex->pt->texture;
2223 gc->pipe[pn].shader.cur_texu = tex->ptuv->texture; 2242 gc->pipe[pn].shader.cur_texu = tex->ptuv->texture;
2224 gc->pipe[pn].shader.cur_texm = mtex ? mtex->pt->texture : 0; 2243 gc->pipe[pn].shader.cur_texm = mtex ? mtex->pt->texture : 0;
@@ -2293,15 +2312,17 @@ evas_gl_common_context_nv12_push(Evas_Engine_GL_Context *gc,
2293{ 2312{
2294 GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2; 2313 GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2;
2295 Eina_Bool blend = 0; 2314 Eina_Bool blend = 0;
2315 Evas_GL_Shader shader;
2296 GLuint prog; 2316 GLuint prog;
2297 int pn = 0; 2317 int pn = 0;
2298 2318
2299 if ((a < 255) || (!!mtex)) 2319 if ((a < 255) || (!!mtex))
2300 blend = 1; 2320 blend = 1;
2301 2321
2302 prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex, 2322 shader = evas_gl_common_shader_choice(0, NULL, r, g, b, a, !!mtex,
2303 SHADER_NV12_NOMUL, SHADER_NV12, 2323 SHADER_NV12_NOMUL, SHADER_NV12,
2304 SHADER_NV12_MASK, SHADER_NV12_MASK)].prog; 2324 SHADER_NV12_MASK, SHADER_NV12_MASK);
2325 prog = gc->shared->shader[shader].prog;
2305 2326
2306 pn = _evas_gl_common_context_push(RTYPE_NV12, 2327 pn = _evas_gl_common_context_push(RTYPE_NV12,
2307 gc, tex, mtex, 2328 gc, tex, mtex,
@@ -2312,6 +2333,7 @@ evas_gl_common_context_nv12_push(Evas_Engine_GL_Context *gc,
2312 0, 0, 0, 0, 0); 2333 0, 0, 0, 0, 0);
2313 2334
2314 gc->pipe[pn].region.type = RTYPE_NV12; 2335 gc->pipe[pn].region.type = RTYPE_NV12;
2336 gc->pipe[pn].shader.id = shader;
2315 gc->pipe[pn].shader.cur_tex = tex->pt->texture; 2337 gc->pipe[pn].shader.cur_tex = tex->pt->texture;
2316 gc->pipe[pn].shader.cur_tex_dyn = tex->pt->dyn.img; 2338 gc->pipe[pn].shader.cur_tex_dyn = tex->pt->dyn.img;
2317 gc->pipe[pn].shader.cur_texu = tex->ptuv->texture; 2339 gc->pipe[pn].shader.cur_texu = tex->ptuv->texture;
@@ -2396,13 +2418,15 @@ evas_gl_common_context_rgb_a_pair_push(Evas_Engine_GL_Context *gc,
2396 */ 2418 */
2397 2419
2398 GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2; 2420 GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2;
2421 Evas_GL_Shader shader;
2399 GLuint prog; 2422 GLuint prog;
2400 int pn; 2423 int pn;
2401 2424
2402 prog = gc->shared->shader[evas_gl_common_shader_choice 2425 shader = evas_gl_common_shader_choice
2403 (0, NULL, r, g, b, a, !!mtex, 2426 (0, NULL, r, g, b, a, !!mtex,
2404 SHADER_RGB_A_PAIR_NOMUL, SHADER_RGB_A_PAIR, 2427 SHADER_RGB_A_PAIR_NOMUL, SHADER_RGB_A_PAIR,
2405 SHADER_RGB_A_PAIR_MASK, SHADER_RGB_A_PAIR_MASK)].prog; 2428 SHADER_RGB_A_PAIR_MASK, SHADER_RGB_A_PAIR_MASK);
2429 prog = gc->shared->shader[shader].prog;
2406 2430
2407 pn = _evas_gl_common_context_push(RTYPE_IMAGE, 2431 pn = _evas_gl_common_context_push(RTYPE_IMAGE,
2408 gc, tex, mtex, 2432 gc, tex, mtex,
@@ -2413,6 +2437,7 @@ evas_gl_common_context_rgb_a_pair_push(Evas_Engine_GL_Context *gc,
2413 EINA_FALSE, 0, 0, 0, 0); 2437 EINA_FALSE, 0, 0, 0, 0);
2414 2438
2415 gc->pipe[pn].region.type = RTYPE_IMAGE; 2439 gc->pipe[pn].region.type = RTYPE_IMAGE;
2440 gc->pipe[pn].shader.id = shader;
2416 gc->pipe[pn].shader.cur_tex = tex->pt->texture; 2441 gc->pipe[pn].shader.cur_tex = tex->pt->texture;
2417 gc->pipe[pn].shader.cur_texa = tex->pta->texture; 2442 gc->pipe[pn].shader.cur_texa = tex->pta->texture;
2418 gc->pipe[pn].shader.cur_texm = mtex ? mtex->pt->texture : 0; 2443 gc->pipe[pn].shader.cur_texm = mtex ? mtex->pt->texture : 0;
@@ -3493,6 +3518,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
3493 gc->pipe[i].array.im = NULL; 3518 gc->pipe[i].array.im = NULL;
3494 } 3519 }
3495 3520
3521 gc->state.current.id = gc->pipe[i].shader.id;
3496 gc->state.current.cur_prog = gc->pipe[i].shader.cur_prog; 3522 gc->state.current.cur_prog = gc->pipe[i].shader.cur_prog;
3497 gc->state.current.cur_tex = gc->pipe[i].shader.cur_tex; 3523 gc->state.current.cur_tex = gc->pipe[i].shader.cur_tex;
3498 gc->state.current.render_op = gc->pipe[i].shader.render_op; 3524 gc->state.current.render_op = gc->pipe[i].shader.render_op;