diff options
author | Anuj Phogat <anuj.phogat@gmail.com> | 2014-09-22 16:28:16 -0700 |
---|---|---|
committer | Anuj Phogat <anuj.phogat@gmail.com> | 2014-10-24 17:00:54 -0700 |
commit | b786e3d78c89f996e9142b43f7de03b0981bbca2 (patch) | |
tree | e47ef8e1ed5ce9c01554c327687a588e66a6e290 /tests/glslparsertest | |
parent | 58c432b416ad385e149c507d3edd78d1bb7e95a6 (diff) |
Add shader tests for out of bounds array index
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Diffstat (limited to 'tests/glslparsertest')
-rw-r--r-- | tests/glslparsertest/shaders/array01.vert | 15 | ||||
-rw-r--r-- | tests/glslparsertest/shaders/array02.vert | 16 | ||||
-rw-r--r-- | tests/glslparsertest/shaders/array12.frag | 16 | ||||
-rw-r--r-- | tests/glslparsertest/shaders/array13.frag | 16 |
4 files changed, 63 insertions, 0 deletions
diff --git a/tests/glslparsertest/shaders/array01.vert b/tests/glslparsertest/shaders/array01.vert new file mode 100644 index 000000000..d34d3e8cc --- /dev/null +++ b/tests/glslparsertest/shaders/array01.vert @@ -0,0 +1,15 @@ +// [config] +// expect_result: fail +// glsl_version: 1.20 +// check_link: false +// [end config] +// +// Verify that out-of-bounds access to an array using a constant expression +// results in to compile error. +float array[5]; +const int idx = 8; + +void main() +{ + gl_Position = vec4(0.0, 1.0, 0.0, array[idx]); +} diff --git a/tests/glslparsertest/shaders/array02.vert b/tests/glslparsertest/shaders/array02.vert new file mode 100644 index 000000000..0630ed2cd --- /dev/null +++ b/tests/glslparsertest/shaders/array02.vert @@ -0,0 +1,16 @@ +// [config] +// expect_result: fail +// glsl_version: 1.20 +// check_link: false +// [end config] +// +// Verify that out-of-bounds access to an array using a constant expression +// results in to compile error. + +float array[5]; +const int idx = -2; + +void main() +{ + gl_Position = vec4(0.0, 1.0, 0.0, array[idx]); +} diff --git a/tests/glslparsertest/shaders/array12.frag b/tests/glslparsertest/shaders/array12.frag new file mode 100644 index 000000000..6a1534e03 --- /dev/null +++ b/tests/glslparsertest/shaders/array12.frag @@ -0,0 +1,16 @@ +// [config] +// expect_result: fail +// glsl_version: 1.20 +// check_link: false +// [end config] +// +// Verify that out-of-bounds access to an array using a constant expression +// results in to compile error. + +float array[5]; +const int idx = 8; + +void main() +{ + gl_FragColor = vec4(0.0, 1.0, 0.0, array[idx]); +} diff --git a/tests/glslparsertest/shaders/array13.frag b/tests/glslparsertest/shaders/array13.frag new file mode 100644 index 000000000..b1e2c377f --- /dev/null +++ b/tests/glslparsertest/shaders/array13.frag @@ -0,0 +1,16 @@ +// [config] +// expect_result: fail +// glsl_version: 1.20 +// check_link: false +// [end config] +// +// Verify that out-of-bounds access to an array using a constant expression +// results in to compile error. + +float array[5]; +const int idx = -2; + +void main() +{ + gl_FragColor = vec4(0.0, 1.0, 0.0, array[idx]); +} |