diff options
author | Brian Paul <brianp@vmware.com> | 2015-01-26 09:13:07 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2015-01-27 17:38:06 -0700 |
commit | 660a651e8b349a60f707847b4a3a57d0d26a9e58 (patch) | |
tree | ec01d74e984374467fb22e40fda659c9a7c5def6 /tests | |
parent | 6dad8fb4602f0f10d6e1a34a460675c4cf90e6f2 (diff) |
Add a new shader attachment/link ordering test.
AFAICT, the GL and GLSL specs don't say anything about the significance
of the order in which shaders are attached to a program object. For
example, if there's two vertex shader A and B, it shouldn't matter if
they're attached in order A,B or B,A.
This pair of shader tests exercises that. Both pass with Mesa but
the "b-a" case fails with NVIDIA.
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/spec/glsl-1.20/linker/link-order-a-b.shader_test | 44 | ||||
-rw-r--r-- | tests/spec/glsl-1.20/linker/link-order-b-a.shader_test | 44 |
2 files changed, 88 insertions, 0 deletions
diff --git a/tests/spec/glsl-1.20/linker/link-order-a-b.shader_test b/tests/spec/glsl-1.20/linker/link-order-a-b.shader_test new file mode 100644 index 000000000..81406f5ac --- /dev/null +++ b/tests/spec/glsl-1.20/linker/link-order-a-b.shader_test @@ -0,0 +1,44 @@ +# Test linking two vertex shaders. +# The GLSL and GL specs don't say anything about the order of +# shaders attached to program objects being significant. +# So attaching shader 'A' and then attaching shader 'B' should be the +# same as attaching 'B' then 'A'. +# +# Derived from tests/shaders/glsl-link-array-01.shader_test +# +# See also link-order-b-a.shader_test + +[require] +GLSL >= 1.20 + +[vertex shader] +// Shader A +vec4 vals[]; + +void set_position() +{ + gl_Position = vals[1]; +} + +[vertex shader] +// Shader B +vec4 vals[2]; + +void set_position(); + +void main() +{ + vals[1] = gl_Vertex; + set_position(); +} + + +[fragment shader] +void main() +{ + gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0); +} + +[test] +draw rect -1 -1 2 2 +probe all rgba 0.0 1.0 0.0 0.0 diff --git a/tests/spec/glsl-1.20/linker/link-order-b-a.shader_test b/tests/spec/glsl-1.20/linker/link-order-b-a.shader_test new file mode 100644 index 000000000..24bfa7e0b --- /dev/null +++ b/tests/spec/glsl-1.20/linker/link-order-b-a.shader_test @@ -0,0 +1,44 @@ +# Test linking two vertex shaders. +# The GLSL and GL specs don't say anything about the order of +# shaders attached to program objects being significant. +# So attaching shader 'A' and then attaching shader 'B' should be the +# same as attaching 'B' then 'A'. +# +# Derived from tests/shaders/glsl-link-array-01.shader_test +# +# See also link-order-a-b.shader_test + +[require] +GLSL >= 1.20 + +[vertex shader] +// Shader B +vec4 vals[2]; + +void set_position(); + +void main() +{ + vals[1] = gl_Vertex; + set_position(); +} + +[vertex shader] +// Shader A +vec4 vals[]; + +void set_position() +{ + gl_Position = vals[1]; +} + + +[fragment shader] +void main() +{ + gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0); +} + +[test] +draw rect -1 -1 2 2 +probe all rgba 0.0 1.0 0.0 0.0 |