Evas GL common: Fix shaders for GLX

Oops! There had to be a breakage somewhere. That's it :)
Thanks Oleksander Shcherbina for the report.

Fixes T2266.
This commit is contained in:
Jean-Philippe ANDRE 2015-04-03 17:55:12 +09:00
parent 676c10b153
commit 2748fae3f4
4 changed files with 34 additions and 25 deletions

View File

@ -3127,11 +3127,12 @@ static const char const tex_external_frag_glsl[] =
"# else\n" "# else\n"
"precision mediump float;\n" "precision mediump float;\n"
"# endif\n" "# endif\n"
"uniform samplerExternalOES tex;\n" "# define SAMPLER_EXTERNAL_OES samplerExternalOES\n"
"#else\n" "#else\n"
"uniform sampler2D tex;\n" "# define SAMPLER_EXTERNAL_OES sampler2D\n"
"#endif\n" "#endif\n"
"varying vec4 col;\n" "varying vec4 col;\n"
"uniform SAMPLER_EXTERNAL_OES tex;\n"
"varying vec2 tex_c;\n" "varying vec2 tex_c;\n"
"void main()\n" "void main()\n"
"{\n" "{\n"
@ -3162,6 +3163,7 @@ static const char const tex_external_vert_glsl[] =
"{\n" "{\n"
" gl_Position = mvp * vertex;\n" " gl_Position = mvp * vertex;\n"
" col = color;\n" " col = color;\n"
" tex_c = tex_coord;\n"
"}\n"; "}\n";
Evas_GL_Program_Source shader_tex_external_vert_src = Evas_GL_Program_Source shader_tex_external_vert_src =
{ {
@ -3177,11 +3179,12 @@ static const char const tex_external_afill_frag_glsl[] =
"# else\n" "# else\n"
"precision mediump float;\n" "precision mediump float;\n"
"# endif\n" "# endif\n"
"uniform samplerExternalOES tex;\n" "# define SAMPLER_EXTERNAL_OES samplerExternalOES\n"
"#else\n" "#else\n"
"uniform sampler2D tex;\n" "# define SAMPLER_EXTERNAL_OES sampler2D\n"
"#endif\n" "#endif\n"
"varying vec4 col;\n" "varying vec4 col;\n"
"uniform SAMPLER_EXTERNAL_OES tex;\n"
"varying vec2 tex_c;\n" "varying vec2 tex_c;\n"
"void main()\n" "void main()\n"
"{\n" "{\n"
@ -3213,6 +3216,7 @@ static const char const tex_external_afill_vert_glsl[] =
"{\n" "{\n"
" gl_Position = mvp * vertex;\n" " gl_Position = mvp * vertex;\n"
" col = color;\n" " col = color;\n"
" tex_c = tex_coord;\n"
"}\n"; "}\n";
Evas_GL_Program_Source shader_tex_external_afill_vert_src = Evas_GL_Program_Source shader_tex_external_afill_vert_src =
{ {
@ -3228,10 +3232,11 @@ static const char const tex_external_nomul_frag_glsl[] =
"# else\n" "# else\n"
"precision mediump float;\n" "precision mediump float;\n"
"# endif\n" "# endif\n"
"uniform samplerExternalOES tex;\n" "# define SAMPLER_EXTERNAL_OES samplerExternalOES\n"
"#else\n" "#else\n"
"uniform sampler2D tex;\n" "# define SAMPLER_EXTERNAL_OES sampler2D\n"
"#endif\n" "#endif\n"
"uniform SAMPLER_EXTERNAL_OES tex;\n"
"varying vec2 tex_c;\n" "varying vec2 tex_c;\n"
"void main()\n" "void main()\n"
"{\n" "{\n"
@ -3258,6 +3263,7 @@ static const char const tex_external_nomul_vert_glsl[] =
"void main()\n" "void main()\n"
"{\n" "{\n"
" gl_Position = mvp * vertex;\n" " gl_Position = mvp * vertex;\n"
" tex_c = tex_coord;\n"
"}\n"; "}\n";
Evas_GL_Program_Source shader_tex_external_nomul_vert_src = Evas_GL_Program_Source shader_tex_external_nomul_vert_src =
{ {
@ -3273,10 +3279,11 @@ static const char const tex_external_nomul_afill_frag_glsl[] =
"# else\n" "# else\n"
"precision mediump float;\n" "precision mediump float;\n"
"# endif\n" "# endif\n"
"uniform samplerExternalOES tex;\n" "# define SAMPLER_EXTERNAL_OES samplerExternalOES\n"
"#else\n" "#else\n"
"uniform sampler2D tex;\n" "# define SAMPLER_EXTERNAL_OES sampler2D\n"
"#endif\n" "#endif\n"
"uniform SAMPLER_EXTERNAL_OES tex;\n"
"varying vec2 tex_c;\n" "varying vec2 tex_c;\n"
"void main()\n" "void main()\n"
"{\n" "{\n"
@ -3304,6 +3311,7 @@ static const char const tex_external_nomul_afill_vert_glsl[] =
"void main()\n" "void main()\n"
"{\n" "{\n"
" gl_Position = mvp * vertex;\n" " gl_Position = mvp * vertex;\n"
" tex_c = tex_coord;\n"
"}\n"; "}\n";
Evas_GL_Program_Source shader_tex_external_nomul_afill_vert_src = Evas_GL_Program_Source shader_tex_external_nomul_afill_vert_src =
{ {
@ -3319,14 +3327,15 @@ static const char const tex_external_mask_frag_glsl[] =
"# else\n" "# else\n"
"precision mediump float;\n" "precision mediump float;\n"
"# endif\n" "# endif\n"
"uniform samplerExternalOES tex;\n" "# define SAMPLER_EXTERNAL_OES samplerExternalOES\n"
"#else\n" "#else\n"
"uniform sampler2D tex;\n" "# define SAMPLER_EXTERNAL_OES sampler2D\n"
"#endif\n" "#endif\n"
"varying vec4 col;\n" "varying vec4 col;\n"
"uniform SAMPLER_EXTERNAL_OES tex;\n"
"varying vec2 tex_c;\n"
"uniform sampler2D texm;\n" "uniform sampler2D texm;\n"
"varying vec2 tex_m;\n" "varying vec2 tex_m;\n"
"varying vec2 tex_c;\n"
"void main()\n" "void main()\n"
"{\n" "{\n"
" vec4 c;\n" " vec4 c;\n"
@ -3359,6 +3368,7 @@ static const char const tex_external_mask_vert_glsl[] =
"{\n" "{\n"
" gl_Position = mvp * vertex;\n" " gl_Position = mvp * vertex;\n"
" col = color;\n" " col = color;\n"
" tex_c = tex_coord;\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" " 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" " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
"}\n"; "}\n";
@ -3376,13 +3386,14 @@ static const char const tex_external_mask_nomul_frag_glsl[] =
"# else\n" "# else\n"
"precision mediump float;\n" "precision mediump float;\n"
"# endif\n" "# endif\n"
"uniform samplerExternalOES tex;\n" "# define SAMPLER_EXTERNAL_OES samplerExternalOES\n"
"#else\n" "#else\n"
"uniform sampler2D tex;\n" "# define SAMPLER_EXTERNAL_OES sampler2D\n"
"#endif\n" "#endif\n"
"uniform SAMPLER_EXTERNAL_OES tex;\n"
"varying vec2 tex_c;\n"
"uniform sampler2D texm;\n" "uniform sampler2D texm;\n"
"varying vec2 tex_m;\n" "varying vec2 tex_m;\n"
"varying vec2 tex_c;\n"
"void main()\n" "void main()\n"
"{\n" "{\n"
" vec4 c;\n" " vec4 c;\n"
@ -3411,6 +3422,7 @@ static const char const tex_external_mask_nomul_vert_glsl[] =
"void main()\n" "void main()\n"
"{\n" "{\n"
" gl_Position = mvp * vertex;\n" " gl_Position = mvp * vertex;\n"
" tex_c = tex_coord;\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" " 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" " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
"}\n"; "}\n";

View File

@ -16,7 +16,10 @@ precision mediump float;
varying vec4 col; varying vec4 col;
#endif #endif
#ifdef SHD_TEX #ifdef SHD_EXTERNAL
uniform SAMPLER_EXTERNAL_OES tex;
varying vec2 tex_c;
#elif defined(SHD_TEX)
uniform sampler2D tex; uniform sampler2D tex;
varying vec2 tex_c; varying vec2 tex_c;
#endif #endif
@ -52,12 +55,6 @@ uniform sampler2D texm;
varying vec2 tex_m; varying vec2 tex_m;
#endif #endif
#ifdef SHD_EXTERNAL
# define SHD_TEX
// uniform samplerExternalOES tex;
varying vec2 tex_c;
#endif
#ifdef SHD_ALPHA #ifdef SHD_ALPHA
# define SWZ aaaa # define SWZ aaaa
#else #else
@ -115,7 +112,7 @@ void main()
vec4 col11 = texture2D(tex, tex_c + tex_s[3]).SWZ; vec4 col11 = texture2D(tex, tex_c + tex_s[3]).SWZ;
c = (col00 + col01 + col10 + col11) / div_s; c = (col00 + col01 + col10 + col11) / div_s;
#elif defined(SHD_TEX) #elif defined(SHD_TEX) || defined(SHD_EXTERNAL)
c = texture2D(tex, tex_c).SWZ; c = texture2D(tex, tex_c).SWZ;
#else #else

View File

@ -29,9 +29,9 @@ precision highp float;
# else # else
precision mediump float; precision mediump float;
# endif # endif
uniform samplerExternalOES tex; # define SAMPLER_EXTERNAL_OES samplerExternalOES
#else #else
uniform sampler2D tex; # define SAMPLER_EXTERNAL_OES sampler2D
#endif #endif
" "

View File

@ -68,7 +68,7 @@ void main()
col = color; col = color;
#endif #endif
#ifdef SHD_TEX #if defined(SHD_TEX) || defined(SHD_EXTERNAL)
tex_c = tex_coord; tex_c = tex_coord;
#endif #endif