[Piglit] [PATCH] blit-scaled-linear: minor shader code improvements

Brian Paul brianp at vmware.com
Tue Jul 11 20:09:29 UTC 2017


Use vector operations instead of scalar.
Simplify vec2 constructor usage.
---
 tests/spec/arb_framebuffer_object/blit-scaled-linear.cpp | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/tests/spec/arb_framebuffer_object/blit-scaled-linear.cpp b/tests/spec/arb_framebuffer_object/blit-scaled-linear.cpp
index bdc6cd8..37ed7c4 100644
--- a/tests/spec/arb_framebuffer_object/blit-scaled-linear.cpp
+++ b/tests/spec/arb_framebuffer_object/blit-scaled-linear.cpp
@@ -80,17 +80,15 @@ compile_shader(void)
 		"{\n"
 		"  vec2 f;\n"
 		"  vec4 c0, c1, c2, c3;\n"
-		"  vec2 tex_coord = textureCoord - vec2(0.5, 0.5);\n"
+		"  vec2 tex_coord = textureCoord - vec2(0.5);\n"
 		"\n"
 		"  tex_coord.xy = clamp(tex_coord.xy,\n"
-		"                      vec2(0.0, 0.0),\n"
-		"                      vec2 (xmax - 1.0, ymax - 1.0));\n"
+		"                       vec2(0.0),\n"
+		"                       vec2(xmax, ymax) - vec2(1.0));\n"
 		"\n"
-		"  f.x = fract(tex_coord.x);\n"
-		"  f.y = fract(tex_coord.y);\n"
+		"  f = fract(tex_coord);\n"
 		"\n"
-		"  tex_coord.x = tex_coord.x - f.x;\n"
-		"  tex_coord.y = tex_coord.y - f.y;\n"
+		"  tex_coord = tex_coord - f;\n"
 		"\n"
 		"    c0 = texture2DRect(tex2d, tex_coord.xy + vec2(0, 0));\n"
 		"    c1 = texture2DRect(tex2d, tex_coord.xy + vec2(1, 0));\n"
-- 
1.9.1



More information about the Piglit mailing list