summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-04-26 16:22:06 -0700
committerEric Anholt <eric@anholt.net>2010-06-03 17:08:42 -0700
commit462b8bc95efaa89b33c0edd0207efd8333bfb4b1 (patch)
tree6947c41b7caaf4fbf41897ab4c93bfada0bfa4c3
parent3698065a7549c97870cf9cd70fbbcb2bc49ed78f (diff)
gstgldisplay: Consolidate sampling of textures with the same coordinates.
This further reduces the download_YUY2_UYVY shader from 42 to 38 Mesa instructions. Runtime was not significantly impacted.
-rw-r--r--gst-libs/gst/gl/gstgldisplay.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/gst-libs/gst/gl/gstgldisplay.c b/gst-libs/gst/gl/gstgldisplay.c
index ad0fba2..8d22b26 100644
--- a/gst-libs/gst/gl/gstgldisplay.c
+++ b/gst-libs/gst/gl/gstgldisplay.c
@@ -360,14 +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"
- " 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"
+ " vec3 sample = texture2DRect(tex, vec2(fx * 2.0, fy)).rgb;\n"
+ " vec3 sample2 = texture2DRect(tex, vec2(fx * 2.0 + 1.0, fy)).rgb;\n"
+ " r=sample.r;\n"
+ " g=sample.g;\n"
+ " b=sample.b;\n"
+ " r2=sample2.r;\n"
+ " g2=sample2.g;\n"
+ " b2=sample2.b;\n"
#else
" fx = v_texCoord.x;\n"
" fy = v_texCoord.y;\n"