From 660a651e8b349a60f707847b4a3a57d0d26a9e58 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 26 Jan 2015 09:13:07 -0700 Subject: 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 --- .../glsl-1.20/linker/link-order-a-b.shader_test | 44 ++++++++++++++++++++++ .../glsl-1.20/linker/link-order-b-a.shader_test | 44 ++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 tests/spec/glsl-1.20/linker/link-order-a-b.shader_test create mode 100644 tests/spec/glsl-1.20/linker/link-order-b-a.shader_test 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 -- cgit v1.2.3