[Piglit] [PATCH 09/11] arb_shading_language_420pack: Test that global const vars cannot be non-const expressions.

Matt Turner mattst88 at gmail.com
Fri May 24 18:28:06 PDT 2013


---
 .../compiler/global-const-var-non-const-expr.frag  | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 tests/spec/arb_shading_language_420pack/compiler/global-const-var-non-const-expr.frag

diff --git a/tests/spec/arb_shading_language_420pack/compiler/global-const-var-non-const-expr.frag b/tests/spec/arb_shading_language_420pack/compiler/global-const-var-non-const-expr.frag
new file mode 100644
index 0000000..5cae90d
--- /dev/null
+++ b/tests/spec/arb_shading_language_420pack/compiler/global-const-var-non-const-expr.frag
@@ -0,0 +1,26 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * require_extensions: GL_ARB_shading_language_420pack
+ * [end config]
+ */
+
+#version 130
+#extension GL_ARB_shading_language_420pack: enable
+
+/* The ARB_shading_language_420pack spec allows const-qualified variables to be
+ * initialized with non-constant expressions in local scope, but it says:
+ *
+ *     "Initializers for *const* declarations at global scope must be
+ *      constant expressions..."
+ *
+ * Verify that non-constant expressions may not be initializers of const-
+ * qualified global variables.
+ */
+
+uniform float a_uniform;
+const float a_var = a_uniform + 1.0;
+
+void main() {
+    gl_FragColor = vec4(a_var);
+}
-- 
1.8.1.5



More information about the Piglit mailing list