diff options
author | Chris Forbes <chrisf@ijw.co.nz> | 2013-11-30 08:35:50 +1300 |
---|---|---|
committer | Chris Forbes <chrisf@ijw.co.nz> | 2014-04-06 07:18:31 +1200 |
commit | c5e0ee756348d5b3edf55185b203131e7aa787b5 (patch) | |
tree | fdceded6b7794b1343494947f0f767a4a87cfa90 /tests/spec/arb_gpu_shader5 | |
parent | 40189f2b93dbd21bf29a3fef07261604a14221d8 (diff) |
arb_gpu_shader5: add some compiler/linker tests for sample qualifier
V2: Various small tweaks suggested by Anuj
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Diffstat (limited to 'tests/spec/arb_gpu_shader5')
9 files changed, 192 insertions, 0 deletions
diff --git a/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/fs-sample-in-no-writes.frag b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/fs-sample-in-no-writes.frag new file mode 100644 index 000000000..f0d740035 --- /dev/null +++ b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/fs-sample-in-no-writes.frag @@ -0,0 +1,22 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// require_extensions: GL_ARB_gpu_shader5 +// [end config] + +// From the ARB_gpu_shader5 spec: +// "Variables declared as ..., or sample in may +// not be written to during shader execution." + +#version 150 +#extension GL_ARB_gpu_shader5: require + +sample in vec4 x; +out vec4 out_color; + +void main() +{ + x = vec4(0); /* not allowed */ + out_color = vec4(1); +} + diff --git a/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/fs-sample-in-qualifier.frag b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/fs-sample-in-qualifier.frag new file mode 100644 index 000000000..33bb55ad2 --- /dev/null +++ b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/fs-sample-in-qualifier.frag @@ -0,0 +1,17 @@ +// [config] +// expect_result: pass +// glsl_version: 1.50 +// require_extensions: GL_ARB_gpu_shader5 +// [end config] + +#version 150 +#extension GL_ARB_gpu_shader5: require + +sample in vec4 x; +out vec4 out_color; + +void main() +{ + out_color = x; +} + diff --git a/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/fs-sample-out-qualifier.frag b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/fs-sample-out-qualifier.frag new file mode 100644 index 000000000..16f94f236 --- /dev/null +++ b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/fs-sample-out-qualifier.frag @@ -0,0 +1,20 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// require_extensions: GL_ARB_gpu_shader5 +// [end config] + +// From the ARB_gpu_shader5 spec: +// "It is an error to use centroid out or sample out in a fragment shader" + +#version 150 +#extension GL_ARB_gpu_shader5: require + +sample out vec4 x; /* not allowed */ +out vec4 out_color; + +void main() +{ + out_color = x; +} + diff --git a/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/gs-sample-in-qualifier.geom b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/gs-sample-in-qualifier.geom new file mode 100644 index 000000000..c9d4ce68e --- /dev/null +++ b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/gs-sample-in-qualifier.geom @@ -0,0 +1,16 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// require_extensions: GL_ARB_gpu_shader5 +// [end config] + +#version 150 +#extension GL_ARB_gpu_shader5: require + +sample in vec4 x; /* not allowed */ + +void main() +{ + gl_Position = x; + EmitVertex(); +} diff --git a/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/gs-sample-out-qualifier.geom b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/gs-sample-out-qualifier.geom new file mode 100644 index 000000000..0e24b4d05 --- /dev/null +++ b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/gs-sample-out-qualifier.geom @@ -0,0 +1,21 @@ +// [config] +// expect_result: pass +// glsl_version: 1.50 +// require_extensions: GL_ARB_gpu_shader5 +// [end config] + +// From the ARB_gpu_shader5 spec: +// "Vertex and geometry output variables output per-vertex data and +// are declared using the ..., or sample out storage qualifiers, ..." + +#version 150 +#extension GL_ARB_gpu_shader5: require + +sample out vec4 x; + +void main() +{ + x = vec4(0); + gl_Position = vec4(1); + EmitVertex(); +} diff --git a/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/vs-sample-in-qualifier.vert b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/vs-sample-in-qualifier.vert new file mode 100644 index 000000000..23a9517c5 --- /dev/null +++ b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/vs-sample-in-qualifier.vert @@ -0,0 +1,16 @@ +// [config] +// expect_result: fail +// glsl_version: 1.50 +// require_extensions: GL_ARB_gpu_shader5 +// [end config] + +#version 150 +#extension GL_ARB_gpu_shader5: require + +in vec4 y; +sample in vec4 x; /* this is not allowed */ + +void main() +{ + gl_Position = y; +} diff --git a/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/vs-sample-out-qualifier.vert b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/vs-sample-out-qualifier.vert new file mode 100644 index 000000000..7615b9764 --- /dev/null +++ b/tests/spec/arb_gpu_shader5/compiler/sample-qualifier/vs-sample-out-qualifier.vert @@ -0,0 +1,17 @@ +// [config] +// expect_result: pass +// glsl_version: 1.50 +// require_extensions: GL_ARB_gpu_shader5 +// [end config] + +#version 150 +#extension GL_ARB_gpu_shader5: require + +in vec4 y; +sample out vec4 x; + +void main() +{ + x = y; + gl_Position = y; +} diff --git a/tests/spec/arb_gpu_shader5/linker/sample-qualifier-unqualified-vs-fs.shader_test b/tests/spec/arb_gpu_shader5/linker/sample-qualifier-unqualified-vs-fs.shader_test new file mode 100644 index 000000000..3a6545917 --- /dev/null +++ b/tests/spec/arb_gpu_shader5/linker/sample-qualifier-unqualified-vs-fs.shader_test @@ -0,0 +1,31 @@ +# Tests that the linking 'out' against 'sample in' produces an error + +[require] +GLSL >= 1.50 +GL_ARB_gpu_shader5 + +[vertex shader] + +#version 150 +#extension GL_ARB_gpu_shader5: require + +out vec4 per_sample_color; /* unqualified */ + +void main() { + per_sample_color = vec4(1); +} + +[fragment shader] + +#version 150 +#extension GL_ARB_gpu_shader5: require + +sample in vec4 per_sample_color; +out vec4 out_color; + +void main() { + out_color = per_sample_color; +} + +[test] +link error diff --git a/tests/spec/arb_gpu_shader5/linker/sample-qualifier-vs-fs.shader_test b/tests/spec/arb_gpu_shader5/linker/sample-qualifier-vs-fs.shader_test new file mode 100644 index 000000000..b43076a30 --- /dev/null +++ b/tests/spec/arb_gpu_shader5/linker/sample-qualifier-vs-fs.shader_test @@ -0,0 +1,32 @@ +# Tests that variables in the vertex shader can be qualified with 'sample out' +# and link against variables in the fragment shader qualified with 'sample in' + +[require] +GLSL >= 1.50 +GL_ARB_gpu_shader5 + +[vertex shader] + +#version 150 +#extension GL_ARB_gpu_shader5: require + +sample out vec4 per_sample_color; + +void main() { + per_sample_color = vec4(1); +} + +[fragment shader] + +#version 150 +#extension GL_ARB_gpu_shader5: require + +sample in vec4 per_sample_color; +out vec4 out_color; + +void main() { + out_color = per_sample_color; +} + +[test] +link success |