Evas GL common: Fix shaders for GLX
authorJean-Philippe ANDRE <jpeg@videolan.org>
Fri, 3 Apr 2015 08:55:12 +0000 (17:55 +0900)
committerJean-Philippe ANDRE <jpeg@videolan.org>
Fri, 3 Apr 2015 08:57:07 +0000 (17:57 +0900)
Oops! There had to be a breakage somewhere. That's it :)
Thanks Oleksander Shcherbina for the report.

Fixes T2266.

src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x
src/modules/evas/engines/gl_common/shader/fragment.glsl
src/modules/evas/engines/gl_common/shader/gen_shaders.sh
src/modules/evas/engines/gl_common/shader/vertex.glsl

index a40d663..f5dd596 100644 (file)
@@ -3127,11 +3127,12 @@ static const char const tex_external_frag_glsl[] =
    "# else\n"
    "precision mediump float;\n"
    "# endif\n"
-   "uniform samplerExternalOES tex;\n"
+   "# define SAMPLER_EXTERNAL_OES samplerExternalOES\n"
    "#else\n"
-   "uniform sampler2D tex;\n"
+   "# define SAMPLER_EXTERNAL_OES sampler2D\n"
    "#endif\n"
    "varying vec4 col;\n"
+   "uniform SAMPLER_EXTERNAL_OES tex;\n"
    "varying vec2 tex_c;\n"
    "void main()\n"
    "{\n"
@@ -3162,6 +3163,7 @@ static const char const tex_external_vert_glsl[] =
    "{\n"
    "   gl_Position = mvp * vertex;\n"
    "   col = color;\n"
+   "   tex_c = tex_coord;\n"
    "}\n";
 Evas_GL_Program_Source shader_tex_external_vert_src =
 {
@@ -3177,11 +3179,12 @@ static const char const tex_external_afill_frag_glsl[] =
    "# else\n"
    "precision mediump float;\n"
    "# endif\n"
-   "uniform samplerExternalOES tex;\n"
+   "# define SAMPLER_EXTERNAL_OES samplerExternalOES\n"
    "#else\n"
-   "uniform sampler2D tex;\n"
+   "# define SAMPLER_EXTERNAL_OES sampler2D\n"
    "#endif\n"
    "varying vec4 col;\n"
+   "uniform SAMPLER_EXTERNAL_OES tex;\n"
    "varying vec2 tex_c;\n"
    "void main()\n"
    "{\n"
@@ -3213,6 +3216,7 @@ static const char const tex_external_afill_vert_glsl[] =
    "{\n"
    "   gl_Position = mvp * vertex;\n"
    "   col = color;\n"
+   "   tex_c = tex_coord;\n"
    "}\n";
 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"
    "precision mediump float;\n"
    "# endif\n"
-   "uniform samplerExternalOES tex;\n"
+   "# define SAMPLER_EXTERNAL_OES samplerExternalOES\n"
    "#else\n"
-   "uniform sampler2D tex;\n"
+   "# define SAMPLER_EXTERNAL_OES sampler2D\n"
    "#endif\n"
+   "uniform SAMPLER_EXTERNAL_OES tex;\n"
    "varying vec2 tex_c;\n"
    "void main()\n"
    "{\n"
@@ -3258,6 +3263,7 @@ static const char const tex_external_nomul_vert_glsl[] =
    "void main()\n"
    "{\n"
    "   gl_Position = mvp * vertex;\n"
+   "   tex_c = tex_coord;\n"
    "}\n";
 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"
    "precision mediump float;\n"
    "# endif\n"
-   "uniform samplerExternalOES tex;\n"
+   "# define SAMPLER_EXTERNAL_OES samplerExternalOES\n"
    "#else\n"
-   "uniform sampler2D tex;\n"
+   "# define SAMPLER_EXTERNAL_OES sampler2D\n"
    "#endif\n"
+   "uniform SAMPLER_EXTERNAL_OES tex;\n"
    "varying vec2 tex_c;\n"
    "void main()\n"
    "{\n"
@@ -3304,6 +3311,7 @@ static const char const tex_external_nomul_afill_vert_glsl[] =
    "void main()\n"
    "{\n"
    "   gl_Position = mvp * vertex;\n"
+   "   tex_c = tex_coord;\n"
    "}\n";
 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"
    "precision mediump float;\n"
    "# endif\n"
-   "uniform samplerExternalOES tex;\n"
+   "# define SAMPLER_EXTERNAL_OES samplerExternalOES\n"
    "#else\n"
-   "uniform sampler2D tex;\n"
+   "# define SAMPLER_EXTERNAL_OES sampler2D\n"
    "#endif\n"
    "varying vec4 col;\n"
+   "uniform SAMPLER_EXTERNAL_OES tex;\n"
+   "varying vec2 tex_c;\n"
    "uniform sampler2D texm;\n"
    "varying vec2 tex_m;\n"
-   "varying vec2 tex_c;\n"
    "void main()\n"
    "{\n"
    "   vec4 c;\n"
@@ -3359,6 +3368,7 @@ static const char const tex_external_mask_vert_glsl[] =
    "{\n"
    "   gl_Position = mvp * vertex;\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"
    "   tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
    "}\n";
@@ -3376,13 +3386,14 @@ static const char const tex_external_mask_nomul_frag_glsl[] =
    "# else\n"
    "precision mediump float;\n"
    "# endif\n"
-   "uniform samplerExternalOES tex;\n"
+   "# define SAMPLER_EXTERNAL_OES samplerExternalOES\n"
    "#else\n"
-   "uniform sampler2D tex;\n"
+   "# define SAMPLER_EXTERNAL_OES sampler2D\n"
    "#endif\n"
+   "uniform SAMPLER_EXTERNAL_OES tex;\n"
+   "varying vec2 tex_c;\n"
    "uniform sampler2D texm;\n"
    "varying vec2 tex_m;\n"
-   "varying vec2 tex_c;\n"
    "void main()\n"
    "{\n"
    "   vec4 c;\n"
@@ -3411,6 +3422,7 @@ static const char const tex_external_mask_nomul_vert_glsl[] =
    "void main()\n"
    "{\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"
    "   tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
    "}\n";
index 1ebecbb..26be33c 100644 (file)
@@ -16,7 +16,10 @@ precision mediump float;
 varying vec4 col;
 #endif
 
-#ifdef SHD_TEX
+#ifdef SHD_EXTERNAL
+uniform SAMPLER_EXTERNAL_OES tex;
+varying vec2 tex_c;
+#elif defined(SHD_TEX)
 uniform sampler2D tex;
 varying vec2 tex_c;
 #endif
@@ -52,12 +55,6 @@ uniform sampler2D texm;
 varying vec2 tex_m;
 #endif
 
-#ifdef SHD_EXTERNAL
-# define SHD_TEX
-// uniform samplerExternalOES tex;
-varying vec2 tex_c;
-#endif
-
 #ifdef SHD_ALPHA
 # define SWZ aaaa
 #else
@@ -115,7 +112,7 @@ void main()
    vec4 col11 = texture2D(tex, tex_c + tex_s[3]).SWZ;
    c = (col00 + col01 + col10 + col11) / div_s;
 
-#elif defined(SHD_TEX)
+#elif defined(SHD_TEX) || defined(SHD_EXTERNAL)
    c = texture2D(tex, tex_c).SWZ;
 
 #else
index 815ef57..7010206 100755 (executable)
@@ -29,9 +29,9 @@ precision highp float;
 # else
 precision mediump float;
 # endif
-uniform samplerExternalOES tex;
+# define SAMPLER_EXTERNAL_OES samplerExternalOES
 #else
-uniform sampler2D tex;
+# define SAMPLER_EXTERNAL_OES sampler2D
 #endif
 "
 
index fda6a00..04b2144 100644 (file)
@@ -68,7 +68,7 @@ void main()
    col = color;
 #endif
 
-#ifdef SHD_TEX
+#if defined(SHD_TEX) || defined(SHD_EXTERNAL)
    tex_c = tex_coord;
 #endif