Evas GL common: Fix RGB+A textures

Since the shaders system rewrite, RGB+A (used for ETC1+Alpha encoding)
did not work anymore.
This commit is contained in:
Jean-Philippe Andre 2015-04-13 21:49:45 +09:00
parent 99347e9178
commit 404ecdd8d7
3 changed files with 36 additions and 10 deletions

View File

@ -119,8 +119,14 @@ static struct {
{ SHADER_IMG_21_BGRA_MASK_NOMUL, "texm" },
{ SHADER_IMG_22_BGRA_MASK_NOMUL, "tex" },
{ SHADER_IMG_22_BGRA_MASK_NOMUL, "texm" },
{ SHADER_RGB_A_PAIR, "tex" },
{ SHADER_RGB_A_PAIR, "texa" },
{ SHADER_RGB_A_PAIR_MASK, "tex" },
{ SHADER_RGB_A_PAIR_MASK, "texa" },
{ SHADER_RGB_A_PAIR_MASK, "texm" },
{ SHADER_RGB_A_PAIR_NOMUL, "tex" },
{ SHADER_RGB_A_PAIR_NOMUL, "texa" },
{ SHADER_RGB_A_PAIR_MASK_NOMUL, "tex" },
{ SHADER_RGB_A_PAIR_MASK_NOMUL, "texa" },
{ SHADER_RGB_A_PAIR_MASK_NOMUL, "texm" },
{ SHADER_YUV, "tex" },

View File

@ -2928,12 +2928,14 @@ static const char const rgb_a_pair_frag_glsl[] =
"#endif\n"
"#endif\n"
"varying vec4 col;\n"
"uniform sampler2D tex;\n"
"varying vec2 tex_c;\n"
"uniform sampler2D texa;\n"
"varying vec2 tex_a;\n"
"void main()\n"
"{\n"
" vec4 c;\n"
" c = vec4(1, 1, 1, 1);\n"
" c = texture2D(tex, tex_c).bgra;\n"
" gl_FragColor =\n"
" c\n"
" * col\n"
@ -2954,12 +2956,15 @@ static const char const rgb_a_pair_vert_glsl[] =
"uniform mat4 mvp;\n"
"attribute vec4 color;\n"
"varying vec4 col;\n"
"attribute vec2 tex_coord;\n"
"varying vec2 tex_c;\n"
"attribute vec2 tex_coorda;\n"
"varying vec2 tex_a;\n"
"void main()\n"
"{\n"
" gl_Position = mvp * vertex;\n"
" col = color;\n"
" tex_c = tex_coord;\n"
" tex_a = tex_coorda;\n"
"}\n";
Evas_GL_Program_Source shader_rgb_a_pair_vert_src =
@ -2977,6 +2982,8 @@ static const char const rgb_a_pair_mask_frag_glsl[] =
"#endif\n"
"#endif\n"
"varying vec4 col;\n"
"uniform sampler2D tex;\n"
"varying vec2 tex_c;\n"
"uniform sampler2D texa;\n"
"varying vec2 tex_a;\n"
"uniform sampler2D texm;\n"
@ -2984,7 +2991,7 @@ static const char const rgb_a_pair_mask_frag_glsl[] =
"void main()\n"
"{\n"
" vec4 c;\n"
" c = vec4(1, 1, 1, 1);\n"
" c = texture2D(tex, tex_c).bgra;\n"
" gl_FragColor =\n"
" c\n"
" * col\n"
@ -3006,6 +3013,8 @@ static const char const rgb_a_pair_mask_vert_glsl[] =
"uniform mat4 mvp;\n"
"attribute vec4 color;\n"
"varying vec4 col;\n"
"attribute vec2 tex_coord;\n"
"varying vec2 tex_c;\n"
"attribute vec2 tex_coorda;\n"
"varying vec2 tex_a;\n"
"attribute vec4 mask_coord;\n"
@ -3014,6 +3023,7 @@ static const char const rgb_a_pair_mask_vert_glsl[] =
"{\n"
" gl_Position = mvp * vertex;\n"
" col = color;\n"
" tex_c = tex_coord;\n"
" tex_a = tex_coorda;\n"
" vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
" tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
@ -3032,12 +3042,14 @@ static const char const rgb_a_pair_nomul_frag_glsl[] =
"precision mediump float;\n"
"#endif\n"
"#endif\n"
"uniform sampler2D tex;\n"
"varying vec2 tex_c;\n"
"uniform sampler2D texa;\n"
"varying vec2 tex_a;\n"
"void main()\n"
"{\n"
" vec4 c;\n"
" c = vec4(1, 1, 1, 1);\n"
" c = texture2D(tex, tex_c).bgra;\n"
" gl_FragColor =\n"
" c\n"
" * texture2D(texa, tex_a).r\n"
@ -3055,11 +3067,14 @@ static const char const rgb_a_pair_nomul_vert_glsl[] =
"#endif\n"
"attribute vec4 vertex;\n"
"uniform mat4 mvp;\n"
"attribute vec2 tex_coord;\n"
"varying vec2 tex_c;\n"
"attribute vec2 tex_coorda;\n"
"varying vec2 tex_a;\n"
"void main()\n"
"{\n"
" gl_Position = mvp * vertex;\n"
" tex_c = tex_coord;\n"
" tex_a = tex_coorda;\n"
"}\n";
Evas_GL_Program_Source shader_rgb_a_pair_nomul_vert_src =
@ -3076,6 +3091,8 @@ static const char const rgb_a_pair_mask_nomul_frag_glsl[] =
"precision mediump float;\n"
"#endif\n"
"#endif\n"
"uniform sampler2D tex;\n"
"varying vec2 tex_c;\n"
"uniform sampler2D texa;\n"
"varying vec2 tex_a;\n"
"uniform sampler2D texm;\n"
@ -3083,7 +3100,7 @@ static const char const rgb_a_pair_mask_nomul_frag_glsl[] =
"void main()\n"
"{\n"
" vec4 c;\n"
" c = vec4(1, 1, 1, 1);\n"
" c = texture2D(tex, tex_c).bgra;\n"
" gl_FragColor =\n"
" c\n"
" * texture2D(texm, tex_m).a\n"
@ -3102,6 +3119,8 @@ static const char const rgb_a_pair_mask_nomul_vert_glsl[] =
"#endif\n"
"attribute vec4 vertex;\n"
"uniform mat4 mvp;\n"
"attribute vec2 tex_coord;\n"
"varying vec2 tex_c;\n"
"attribute vec2 tex_coorda;\n"
"varying vec2 tex_a;\n"
"attribute vec4 mask_coord;\n"
@ -3109,6 +3128,7 @@ static const char const rgb_a_pair_mask_nomul_vert_glsl[] =
"void main()\n"
"{\n"
" gl_Position = mvp * vertex;\n"
" tex_c = tex_coord;\n"
" tex_a = tex_coorda;\n"
" vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
" tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"

View File

@ -77,12 +77,12 @@ img_22_bgra_nomul_afill:tex,sam22,bgra,nomul,afill
# RGB+A. We can add more!
rgb_a_pair:texa
rgb_a_pair_mask:texa,mask
rgb_a_pair_nomul:texa,nomul
rgb_a_pair_mask_nomul:texa,mask,nomul
#rgb_a_pair_afill:texa,afill
#rgb_a_pair_nomul_afill:texa,nomul,afill
rgb_a_pair:tex,texa
rgb_a_pair_mask:tex,texa,mask
rgb_a_pair_nomul:tex,texa,nomul
rgb_a_pair_mask_nomul:tex,texa,mask,nomul
#rgb_a_pair_afill:tex,texa,afill
#rgb_a_pair_nomul_afill:tex,texa,nomul,afill