Add tests for gl_ClipDistance and gl_ClipVertex.
This patch is a preparation for work I'm about to do to add gl_ClipDistance support to Mesa, and future work that I hope to do to fix bugs in gl_ClipVertex in Mesa. It adds a thorough set of tests for the following behaviors of gl_ClipDistance and gl_ClipVertex: For gl_ClipVertex: - It behaves properly when equal to gl_Position. - It behaves properly when not equal to gl_Position. - It falls back to gl_Position when it is not set. - Its homogeneous coordinate is respected. - The homogeneous coordinate is respected when falling back to gl_Position. For gl_ClipDistance: - It works when all 6 clip planes are enabled. - Its behavior is properly affected by clip plane enable flags. - It can be explicitly or implicitly sized in the vertex shader. - It can be sized up to gl_MaxClipDistances but no higher. - In the fragment shader, it contains properly interpolated values. For the interaction between the two: - It is an error to assign to both gl_ClipDistance and gl_ClipVertex. In addition, this patch renames a few of the existing clipping tests so that their names more clearly reflect what they're testing. All of these tests have been validated on the proprietary nVidia driver for Linux, except the following: - fs-clip-distance-interpolated: this fails with the error message "gl_ClipDistance is not accessible in this profile". Based on a google search for this error message, I suspect this is an nVidia driver bug. If I replace the fragment shader's reference to gl_ClipDistance with a reference to a user-defined vertex shader output that contains the same data, the test passes. - vs-clip-based-on-position and vs-clip-based-on-position-homogeneity: these tests fail--no clipping occurs. But they pass if I add the line "gl_ClipVertex = gl_Position;" to the end of the vertex shader. The GLSL 1.30 spec clearly states that if neither gl_ClipVertex nor gl_ClipDistance is statically written by the vertex shader, then gl_Position should be used for clipping, so I conclude that this is an nVidia driver bug. - mixing-clip-distance-and-clip-vertex-disallowed: the nVidia driver fails to detect this error condition, in spite of clear language in the GLSL 1.30 spec. I conclude that this is an nVidia driver bug.
Showing with 831 additions and 0 deletions
tests/spec/glsl-1.20/execution/vs-clip-vertex-02.shader_test → tests/spec/glsl-1.20/execution/clipping/vs-clip-vertex-different-from-position.shader_test
tests/spec/glsl-1.20/execution/vs-clip-vertex-01.shader_test → tests/spec/glsl-1.20/execution/clipping/vs-clip-vertex-equal-to-position.shader_test
tests/spec/glsl-1.30/execution/clipping/vs-clip-based-on-position-homogeneity.shader_test 0 → 100644
tests/spec/glsl-1.30/execution/vs-clip-distance-01.shader_test → tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-all-planes-enabled.shader_test