eglglessink: GLSL: Assorted fixes to optimized code
authorReynaldo H. Verdejo Pinochet <reynaldo@collabora.com>
Wed, 10 Oct 2012 15:18:27 +0000 (12:18 -0300)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Thu, 18 Oct 2012 12:35:18 +0000 (14:35 +0200)
- Don't copy over opos as it's already a vec2
- Fix index order access at frag_YUY2_YVYU_UYVY_prog

ext/eglgles/gsteglglessink.c

index c549520..43b67e6 100644 (file)
@@ -225,7 +225,7 @@ static const char *frag_AYUV_prog = {
       "void main(void) {"
       "  float r,g,b;"
       "  vec3 yuv;"
-      "  yuv  = texture2D(tex,opos.xy).gba;"
+      "  yuv  = texture2D(tex,opos).gba;"
       "  yuv += offset;"
       "  r = dot(yuv, rcoeff);"
       "  g = dot(yuv, gcoeff);"
@@ -246,9 +246,8 @@ static const char *frag_YUY2_YVYU_UYVY_prog = {
       "void main(void) {"
       "  float r, g, b;"
       "  vec3 yuv;"
-      "  vec2 oposxy = vec2(opos.x, opos.y);"
-      "  yuv.x = texture2D(Ytex,oposxy).x;"
-      "  yuv.yz = texture2D(UVtex,oposxy).yz;"
+      "  yuv.x = texture2D(Ytex,opos).%c;"
+      "  yuv.yz = texture2D(UVtex,opos).%c%c;"
       "  yuv += offset;"
       "  r = dot(yuv, rcoeff);"
       "  g = dot(yuv, gcoeff);"
@@ -271,10 +270,9 @@ static const char *frag_PLANAR_YUV_prog = {
       "void main(void) {"
       "  float r,g,b;"
       "  vec3 yuv;"
-      "  vec2 nxy = opos.xy;"
-      "  yuv.x=texture2D(Ytex,nxy).r;"
-      "  yuv.y=texture2D(Utex,nxy).r;"
-      "  yuv.z=texture2D(Vtex,nxy).r;"
+      "  yuv.x=texture2D(Ytex,opos).r;"
+      "  yuv.y=texture2D(Utex,opos).r;"
+      "  yuv.z=texture2D(Vtex,opos).r;"
       "  yuv += offset;"
       "  r = dot(yuv, rcoeff);"
       "  g = dot(yuv, gcoeff);"
@@ -295,10 +293,9 @@ static const char *frag_NV12_NV21_prog = {
       "void main(void) {"
       "  float r,g,b;"
       "  vec3 yuv;"
-      "  vec2 nxy = opos.xy;"
-      "  yuv.x=texture2D(Ytex,nxy).r;"
-      "  yuv.y=texture2D(UVtex,nxy).%c;"
-      "  yuv.z=texture2D(UVtex,nxy).%c;"
+      "  yuv.x=texture2D(Ytex,opos).r;"
+      "  yuv.y=texture2D(UVtex,opos).%c;"
+      "  yuv.z=texture2D(UVtex,opos).%c;"
       "  yuv += offset;"
       "  r = dot(yuv, rcoeff);"
       "  g = dot(yuv, gcoeff);"