[Piglit] [PATCH] glsl-1.10: test that redeclaring a variable with a different type is illegal

Brian Paul brianp at vmware.com
Wed Nov 6 09:05:32 PST 2013


This passes w/ Mesa but crashes NVIDIA's driver.
---
 .../declarations/bad-variable-redeclaration.frag   |   29 ++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 tests/spec/glsl-1.10/compiler/declarations/bad-variable-redeclaration.frag

diff --git a/tests/spec/glsl-1.10/compiler/declarations/bad-variable-redeclaration.frag b/tests/spec/glsl-1.10/compiler/declarations/bad-variable-redeclaration.frag
new file mode 100644
index 0000000..1354f14
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/declarations/bad-variable-redeclaration.frag
@@ -0,0 +1,29 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.10
+ * [end config]
+ */
+
+
+// This test checks that the compiler generates an error if we try
+// declare two variables and a function with the same name.
+// NVIDIA's 325.15 driver crashes on this.
+
+varying float color;
+
+float foo;
+
+// Redeclaring foo here should generate an error
+int foo;
+
+// This causes NVIDIA's driver to crash:
+vec4 foo(float v)
+{
+   return vec4(v);
+}
+
+void main()
+{
+	gl_FragColor = color;
+}
+
-- 
1.7.10.4



More information about the Piglit mailing list