diff options
author | Paul Berry <stereotype441@gmail.com> | 2011-08-01 15:54:43 -0700 |
---|---|---|
committer | Paul Berry <stereotype441@gmail.com> | 2011-08-03 13:03:35 -0700 |
commit | 1bcb3df696a2cac936d1bb3f2588ff9c34a7bce4 (patch) | |
tree | ed4a5492dbfb516e41700bc1bb4705865f96082b /tests | |
parent | 68fd61f7ba51721b7d2dc98f47ba9670ac7c9e6a (diff) |
Add two new tests of non-const array sizes.
These tests exercise a bug that I'm fixing in Mesa: there should be a
compilation error (but not a crash) if an array size is specified by
an expression involving either:
- a call to a non-builtin function
- or an expression with side effects (such as an assignment).
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'tests')
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-non-builtin-function.vert b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-non-builtin-function.vert new file mode 100644 index 00000000..fc15e889 --- /dev/null +++ b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-non-builtin-function.vert @@ -0,0 +1,18 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.20 + * [end config] + * + * From page 19 (page 25 of the PDF) of the GLSL 1.20 spec: + * + * "When an array size is specified in a declaration, it must be an + * integral constant expression (see Section 4.3.3 "Constant Expressions") + * greater than zero." + */ +#version 120 + +int foo() { return 3; } + +uniform vec4 [foo()] a; + +void main() { gl_Position = vec4(0.0); } diff --git a/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-with-side-effect.vert b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-with-side-effect.vert new file mode 100644 index 00000000..ccb23888 --- /dev/null +++ b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-with-side-effect.vert @@ -0,0 +1,19 @@ +/* [config] + * expect_result: fail + * glsl_version: 1.20 + * [end config] + * + * From page 19 (page 25 of the PDF) of the GLSL 1.20 spec: + * + * "When an array size is specified in a declaration, it must be an + * integral constant expression (see Section 4.3.3 "Constant Expressions") + * greater than zero." + */ +#version 120 + +void main() +{ + int x; + vec4[(x = 3)] a; + gl_Position = vec4(0.0); +} |