[Piglit] [PATCH] Add additional tests for the GLSL 1.30 textureSize() function.

Kenneth Graunke kenneth at whitecape.org
Wed Jan 4 04:02:25 PST 2012


From: Ouping Zhang <ouping.zhang at intel.com>

(Imported from Bugzilla; unnecessary precision qualifiers removed.)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44339
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 .../execution/fs-textureSize-compare.shader_test   |   20 +++++++++++++++++++
 .../execution/vs-textureSize-compare.shader_test   |   21 ++++++++++++++++++++
 2 files changed, 41 insertions(+), 0 deletions(-)
 create mode 100644 tests/spec/glsl-1.30/execution/fs-textureSize-compare.shader_test
 create mode 100644 tests/spec/glsl-1.30/execution/vs-textureSize-compare.shader_test

Forwarding some shader_runner tests from Ouping; I didn't write them, but
can confirm that vs-textureSize-compare caught a bug in my driver code.

My existing textureSize() tests apparently didn't catch this since it only
shows up when you do additional operations on the textureSize() result, and
my tests simply splat the result to the screen.

diff --git a/tests/spec/glsl-1.30/execution/fs-textureSize-compare.shader_test b/tests/spec/glsl-1.30/execution/fs-textureSize-compare.shader_test
new file mode 100644
index 0000000..2ba5863
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/fs-textureSize-compare.shader_test
@@ -0,0 +1,20 @@
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+void main() { gl_Position = gl_Vertex; }
+
+[fragment shader]
+#version 130
+uniform sampler2D tex;
+void main()
+{
+    gl_FragColor = vec4(0,(textureSize(tex, 0)==ivec2(1024, 1024)),0,1);
+}
+
+[test]
+texture checkerboard 0 0 (1024, 1024) (0.0, 0.0, 0.0, 0.0) (0.0, 0.0, 0.0, 0.0)
+uniform int tex 0
+draw rect -1 -1 2 2
+relative probe rgb (0.75, 0.75) (0.0, 1.0, 0.0)
diff --git a/tests/spec/glsl-1.30/execution/vs-textureSize-compare.shader_test b/tests/spec/glsl-1.30/execution/vs-textureSize-compare.shader_test
new file mode 100644
index 0000000..a7c0d46
--- /dev/null
+++ b/tests/spec/glsl-1.30/execution/vs-textureSize-compare.shader_test
@@ -0,0 +1,21 @@
+[require]
+GLSL >= 1.30
+
+[fragment shader]
+#version 130
+void main() { gl_FragColor = gl_Color; }
+
+[vertex shader]
+#version 130
+uniform sampler2D tex;
+void main()
+{
+    gl_Position = gl_Vertex;
+    gl_FrontColor = vec4(0,(textureSize(tex, 0)==ivec2(1024, 1024)),0,1);
+}
+
+[test]
+texture checkerboard 0 0 (1024, 1024) (0.0, 0.0, 0.0, 0.0) (0.0, 0.0, 0.0, 0.0)
+uniform int tex 0
+draw rect -1 -1 2 2
+relative probe rgb (0.75, 0.75) (0.0, 1.0, 0.0)
-- 
1.7.8.1



More information about the Piglit mailing list