diff options
Diffstat (limited to 'tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-explicitly-sized.shader_test')
-rw-r--r-- | tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-explicitly-sized.shader_test | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-explicitly-sized.shader_test b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-explicitly-sized.shader_test new file mode 100644 index 00000000..00023c93 --- /dev/null +++ b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-explicitly-sized.shader_test @@ -0,0 +1,44 @@ +# From the GLSL 1.30 spec section 7.1 (Vertex Shader Special +# Variables): +# +# The gl_ClipDistance array is predeclared as unsized and must be +# sized by the shader either redeclaring it with a size or indexing +# it only with integral constant expressions. This needs to size the +# array to include all the clip planes that are enabled via the +# OpenGL API; if the size does not include all enabled planes, +# results are undefined. The size can be at most +# gl_MaxClipDistances. The number of varying components (see +# gl_MaxVaryingComponents) consumed by gl_ClipDistance will match +# the size of the array, no matter how many planes are enabled. The +# shader must also set all values in gl_ClipDistance that have been +# enabled via the OpenGL API, or results are undefined. Values +# written into gl_ClipDistance for planes that are not enabled have +# no effect. +# +# This test checks that the GLSL compiler respects the size of +# gl_ClipDistance when it is explicitly declared in the vertex shader. + +[require] +GLSL >= 1.30 + +[vertex shader] +#version 130 +out float gl_ClipDistance[3]; + +void main() +{ + gl_Position = gl_Vertex; + gl_FrontColor = (gl_ClipDistance.length() == 3) ? vec4(0.0, 1.0, 0.0, 1.0) + : vec4(1.0, 0.0, 0.0, 1.0); +} + +[fragment shader] +#version 130 +void main() +{ + gl_FragColor = gl_Color; +} + +[test] +draw rect -1 -1 2 2 +probe all rgba 0.0 1.0 0.0 1.0 |