summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-04-26 16:11:27 -0700
committerEric Anholt <eric@anholt.net>2010-06-03 17:08:42 -0700
commit3698065a7549c97870cf9cd70fbbcb2bc49ed78f (patch)
tree343ecff2a48ff0029b4c3220fd5422c8f2dc1d20
parentc7629d8d71bd8a508f667da07c79ff9f8931b180 (diff)
gstgldisplay: Move a constant subexpression out of texture2DRect() args.
Reduces the download_YUY2_UYVY shader from 53 to 42 Mesa instructions. Runtime wasn't significantly impacted.
-rw-r--r--gst-libs/gst/gl/gstgldisplay.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/gst-libs/gst/gl/gstgldisplay.c b/gst-libs/gst/gl/gstgldisplay.c
index 0445cbf..ad0fba2 100644
--- a/gst-libs/gst/gl/gstgldisplay.c
+++ b/gst-libs/gst/gl/gstgldisplay.c
@@ -360,12 +360,14 @@ gst_gl_display_init (GstGLDisplay * display, GstGLDisplayClass * klass)
#ifndef OPENGL_ES2
" fx = gl_TexCoord[0].x;\n"
" fy = gl_TexCoord[0].y;\n"
- " r=texture2DRect(tex,vec2(fx*2.0,fy)).r;\n"
- " g=texture2DRect(tex,vec2(fx*2.0,fy)).g;\n"
- " b=texture2DRect(tex,vec2(fx*2.0,fy)).b;\n"
- " r2=texture2DRect(tex,vec2(fx*2.0+1.0,fy)).r;\n"
- " g2=texture2DRect(tex,vec2(fx*2.0+1.0,fy)).g;\n"
- " b2=texture2DRect(tex,vec2(fx*2.0+1.0,fy)).b;\n"
+ " vec2 texcoords = vec2(fx * 2.0, fy);\n"
+ " vec2 texcoords2 = vec2(fx * 2.0 + 1.0, fy);\n"
+ " r=texture2DRect(tex, texcoords).r;\n"
+ " g=texture2DRect(tex, texcoords).g;\n"
+ " b=texture2DRect(tex, texcoords).b;\n"
+ " r2=texture2DRect(tex, texcoords2).r;\n"
+ " g2=texture2DRect(tex, texcoords2).g;\n"
+ " b2=texture2DRect(tex, texcoords2).b;\n"
#else
" fx = v_texCoord.x;\n"
" fy = v_texCoord.y;\n"