Tested-by: Marek Olšák <marek.ol...@amd.com> Acked-by: Marek Olšák <marek.ol...@amd.com>
Marek On Mon, May 21, 2018 at 10:29 PM, Timothy Arceri <tarc...@itsqueeze.com> wrote: > These tests have been adapted from the glsl-1.20 clipping tests. > > This tests both setting gl_ClipVertex in the geometry shader and > using the gs to passthrough the gl_ClipVertex value from the > vertex shader. > > I tested these on NVIDIA 384.111 binary driver but some of these > get a cryptic error message: > > variable "gl_ClipVertex" domain conflicts with semantics "CLPV" > > However I believe the tests are correct and this is a driver bug. > --- > .../gs-clip-vertex-const-accept.shader_test | 68 +++++++ > .../gs-clip-vertex-const-reject.shader_test | 58 ++++++ > ...vertex-different-from-position.shader_test | 79 ++++++++ > .../gs-clip-vertex-enables.shader_test | 163 ++++++++++++++++ > ...-clip-vertex-equal-to-position.shader_test | 73 ++++++++ > .../gs-clip-vertex-homogeneity.shader_test | 86 +++++++++ > ...s-clip-vertex-primitives-lines.shader_test | 72 +++++++ > ...-clip-vertex-primitives-points.shader_test | 72 +++++++ > ...rtex-primitives-triangle-strip.shader_test | 72 +++++++ > ...vs-gs-clip-vertex-const-accept.shader_test | 70 +++++++ > ...vs-gs-clip-vertex-const-reject.shader_test | 70 +++++++ > ...vertex-different-from-position.shader_test | 90 +++++++++ > .../vs-gs-clip-vertex-enables.shader_test | 175 ++++++++++++++++++ > ...-clip-vertex-equal-to-position.shader_test | 85 +++++++++ > .../vs-gs-clip-vertex-homogeneity.shader_test | 97 ++++++++++ > ...rtex-primitives-triangle-strip.shader_test | 83 +++++++++ > 16 files changed, 1413 insertions(+) > create mode 100644 tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-const-accept.shader_test > create mode 100644 tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-const-reject.shader_test > create mode 100644 tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-different-from-position.shader_test > create mode 100644 tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-enables.shader_test > create mode 100644 tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-equal-to-position.shader_test > create mode 100644 tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-homogeneity.shader_test > create mode 100644 tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-primitives-lines.shader_test > create mode 100644 tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-primitives-points.shader_test > create mode 100644 tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-primitives-triangle-strip.shader_test > create mode 100644 tests/spec/glsl-1.50/execution/compatibility/ > clipping/vs-gs-clip-vertex-const-accept.shader_test > create mode 100644 tests/spec/glsl-1.50/execution/compatibility/ > clipping/vs-gs-clip-vertex-const-reject.shader_test > create mode 100644 tests/spec/glsl-1.50/execution/compatibility/ > clipping/vs-gs-clip-vertex-different-from-position.shader_test > create mode 100644 tests/spec/glsl-1.50/execution/compatibility/ > clipping/vs-gs-clip-vertex-enables.shader_test > create mode 100644 tests/spec/glsl-1.50/execution/compatibility/ > clipping/vs-gs-clip-vertex-equal-to-position.shader_test > create mode 100644 tests/spec/glsl-1.50/execution/compatibility/ > clipping/vs-gs-clip-vertex-homogeneity.shader_test > create mode 100644 tests/spec/glsl-1.50/execution/compatibility/ > clipping/vs-gs-clip-vertex-primitives-triangle-strip.shader_test > > diff --git a/tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-const-accept.shader_test b/tests/spec/glsl-1.50/ > execution/compatibility/clipping/gs-clip-vertex-const-accept.shader_test > new file mode 100644 > index 000000000..a59fbd98a > --- /dev/null > +++ b/tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-const-accept.shader_test > @@ -0,0 +1,68 @@ > +# From the GL 2.1 spec, section 2.17 (Clipping): > +# > +# All points with eye coordinates (x_e y_e z_e w_e)^T that satisfy > +# > +# (x_e) > +# (p_1' p_2' p_3' p_4')(y_e) >= 0 > +# (z_e) > +# (w_e) > +# > +# lie in the half-space defined by the plane; points that do not > +# satisfy this condition do not lie in the half-space. > +# > +# This test checks that gl_ClipVertex works properly for the trivial > +# case where gl_ClipVertex is a constant value satisfying the above > +# inequality. > + > +[require] > +GL COMPAT >= 3.2 > +GLSL >= 1.50 > + > +[vertex shader] > +#version 150 compatibility > + > +out gl_PerVertex { > + vec4 gl_Position; > + vec4 gl_ClipVertex; > +}; > + > +void main(void) > +{ > + gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; > +} > + > +[geometry shader] > +#version 150 compatibility > + > +layout(triangles) in; > +layout(triangle_strip, max_vertices = 3) out; > + > +in gl_PerVertex { > + vec4 gl_Position; > + vec4 gl_ClipVertex; > +} gl_in[]; > + > +void main() > +{ > + for (int i = 0; i < 3; i++) { > + gl_Position = gl_in[i].gl_Position; > + gl_ClipVertex = vec4(1.0, 0.0, 0.0, 0.0); > + > + EmitVertex(); > + } > +} > + > +[fragment shader] > +#version 120 > +void main(void) > +{ > + gl_FragColor = vec4(1.0); > +} > + > +[test] > +clear color 0.0 0.0 0.0 0.0 > +clear > +clip plane 0 1.0 0.0 0.0 0.0 # accept points where gl_ClipVertex.x >= 0 > +enable GL_CLIP_PLANE0 > +draw rect -1 -1 2 2 > +probe all rgba 1.0 1.0 1.0 1.0 > diff --git a/tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-const-reject.shader_test b/tests/spec/glsl-1.50/ > execution/compatibility/clipping/gs-clip-vertex-const-reject.shader_test > new file mode 100644 > index 000000000..3e4930494 > --- /dev/null > +++ b/tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-const-reject.shader_test > @@ -0,0 +1,58 @@ > +# From the GL 2.1 spec, section 2.17 (Clipping): > +# > +# All points with eye coordinates (x_e y_e z_e w_e)^T that satisfy > +# > +# (x_e) > +# (p_1' p_2' p_3' p_4')(y_e) >= 0 > +# (z_e) > +# (w_e) > +# > +# lie in the half-space defined by the plane; points that do not > +# satisfy this condition do not lie in the half-space. > +# > +# This test checks that gl_ClipVertex works properly for the trivial > +# case where gl_ClipVertex is a constant value not satisfying the > +# above inequality. > + > +[require] > +GL COMPAT >= 3.2 > +GLSL >= 1.50 > + > +[vertex shader] > +#version 120 > + > +void main(void) > +{ > + gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; > +} > + > +[geometry shader] > +#version 150 compatibility > + > +layout(triangles) in; > +layout(triangle_strip, max_vertices = 3) out; > + > +void main() > +{ > + for (int i = 0; i < 3; i++) { > + gl_Position = gl_in[i].gl_Position; > + gl_ClipVertex = vec4(-1.0, 0.0, 0.0, 0.0); > + > + EmitVertex(); > + } > +} > + > +[fragment shader] > +#version 120 > +void main(void) > +{ > + gl_FragColor = vec4(1.0); > +} > + > +[test] > +clear color 0.0 0.0 0.0 0.0 > +clear > +clip plane 0 1.0 0.0 0.0 0.0 # accept points where gl_ClipVertex.x >= 0 > +enable GL_CLIP_PLANE0 > +draw rect -1 -1 2 2 > +probe all rgba 0.0 0.0 0.0 0.0 > diff --git a/tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-different-from-position.shader_test > b/tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex- > different-from-position.shader_test > new file mode 100644 > index 000000000..5568c9782 > --- /dev/null > +++ b/tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-different-from-position.shader_test > @@ -0,0 +1,79 @@ > +# [description] > +# Use all 6 clip planes to clip a rectangle to a hexagon shape. > +# > +# In this test, gl_Position and gl_ClipVertex are different to verify > +# that gl_Position determines screen position and gl_ClipVertex > +# determines clipping. > + > +[require] > +GL COMPAT >= 3.2 > +GLSL >= 1.50 > + > +[vertex shader] > +#version 120 > + > +void main(void) > +{ > + gl_Position = gl_Vertex; > +} > + > +[geometry shader] > +#version 150 compatibility > + > +layout(triangles) in; > +layout(triangle_strip, max_vertices = 3) out; > + > +void main() > +{ > + for (int i = 0; i < 3; i++) { > + gl_Position = gl_ModelViewProjectionMatrix * > gl_in[i].gl_Position; > + > + // Transform gl_ClipVertex in an arbitrary way so that > + // we can verify it is being used for clipping instead of > + // gl_Position. > + gl_ClipVertex = gl_in[i].gl_Position * vec4(10.0, 10.0, > 1.0, 1.0); > + > + EmitVertex(); > + } > +} > + > +[fragment shader] > +#version 120 > +void main(void) > +{ > + gl_FragColor = vec4(1, 1, 1, 1); > +} > + > +[test] > +clear color 0.0 0.0 0.0 0.0 > +clear > +ortho 0 1 0 1 > +clip plane 0 0 1 0 -2.5 > +clip plane 1 -1 1 0 4 > +clip plane 2 -1 -1 0 14 > +clip plane 3 0 -1 0 7.5 > +clip plane 4 1 -1 0 4 > +clip plane 5 1 1 0 -6 > +enable GL_CLIP_PLANE0 > +enable GL_CLIP_PLANE1 > +enable GL_CLIP_PLANE2 > +enable GL_CLIP_PLANE3 > +enable GL_CLIP_PLANE4 > +enable GL_CLIP_PLANE5 > +draw rect 0.1 0.1 0.8 0.8 > + > +# Test points inside each hexagon edge > +relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0) > + > +# Test points outside each hexagon edge > +relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.5, 0.8) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) > diff --git a/tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-enables.shader_test b/tests/spec/glsl-1.50/ > execution/compatibility/clipping/gs-clip-vertex-enables.shader_test > new file mode 100644 > index 000000000..d5ef9cd98 > --- /dev/null > +++ b/tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-enables.shader_test > @@ -0,0 +1,163 @@ > +# This test sets up 6 clipping planes using gl_ClipVertex, which clip > +# a rectangle to a hexagon shape. Then it tests various combinations > +# of enables for the 6 clipping planes, and verifies that they all > +# create the correct shape. > +# > +# To verify that each enable works, the combinations of enables were > +# chosen such that: > +# - Every plane is enabled at least once and disbled at least once. > +# - Every plane is enabled and disabled in a different pattern. > +# > +# Note: Some implementations have bugs related to improper coordinate > +# transformations of clip planes (which are already adequately tested > +# by the clip-plane-transformation test), so to avoid those bugs > +# contaminating the results of this test, we don't do any coordinate > +# transformation in this test. > + > +[require] > +GL COMPAT >= 3.2 > +GLSL >= 1.50 > + > +[vertex shader] > +#version 120 > + > +void main(void) > +{ > + gl_Position = gl_Vertex; > +} > + > +[geometry shader] > +#version 150 compatibility > + > +layout(triangles) in; > +layout(triangle_strip, max_vertices = 3) out; > + > +void main() > +{ > + for (int i = 0; i < 3; i++) { > + gl_Position = gl_in[i].gl_Position; > + gl_ClipVertex = gl_in[i].gl_Position; > + > + EmitVertex(); > + } > +} > + > +[fragment shader] > +#version 120 > +void main(void) > +{ > + gl_FragColor = vec4(1, 1, 1, 1); > +} > + > +[test] > +clip plane 0 0 1 0 0.5 > +clip plane 1 -1 1 0 0.8 > +clip plane 2 -1 -1 0 0.8 > +clip plane 3 0 -1 0 0.5 > +clip plane 4 1 -1 0 0.8 > +clip plane 5 1 1 0 0.8 > +clear color 0.0 0.0 0.0 0.0 > + > +# Test with planes 0, 2, and 4 enabled. > +enable GL_CLIP_PLANE0 > +disable GL_CLIP_PLANE1 > +enable GL_CLIP_PLANE2 > +disable GL_CLIP_PLANE3 > +enable GL_CLIP_PLANE4 > +disable GL_CLIP_PLANE5 > +clear > +draw rect -1 -1 2 2 > + > +# Test points inside each hexagon edge > +relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0) > + > +# Test points outside each hexagon edge > +relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0 > +relative probe rgba (0.8, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 1 > +relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 2 > +relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3 > +relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4 > +relative probe rgba (0.2, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 5 > + > +# Test with planes 0, 1, 4, and 5 enabled. > +enable GL_CLIP_PLANE0 > +enable GL_CLIP_PLANE1 > +disable GL_CLIP_PLANE2 > +disable GL_CLIP_PLANE3 > +enable GL_CLIP_PLANE4 > +enable GL_CLIP_PLANE5 > +clear > +draw rect -1 -1 2 2 > + > +# Test points inside each hexagon edge > +relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0) > + > +# Test points outside each hexagon edge > +relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0 > +relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 1 > +relative probe rgba (0.8, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 2 > +relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3 > +relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4 > +relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 5 > + > +# Test with planes 0, 1, 2, and 3 enabled. > +enable GL_CLIP_PLANE0 > +enable GL_CLIP_PLANE1 > +enable GL_CLIP_PLANE2 > +enable GL_CLIP_PLANE3 > +disable GL_CLIP_PLANE4 > +disable GL_CLIP_PLANE5 > +clear > +draw rect -1 -1 2 2 > + > +# Test points inside each hexagon edge > +relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0) > + > +# Test points outside each hexagon edge > +relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0 > +relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 1 > +relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 2 > +relative probe rgba (0.5, 0.8) (0.0, 0.0, 0.0, 0.0) # clipped by plane 3 > +relative probe rgba (0.2, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 4 > +relative probe rgba (0.2, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 5 > + > +# Test with planes 4 and 5 enabled. > +disable GL_CLIP_PLANE0 > +disable GL_CLIP_PLANE1 > +disable GL_CLIP_PLANE2 > +disable GL_CLIP_PLANE3 > +enable GL_CLIP_PLANE4 > +enable GL_CLIP_PLANE5 > +clear > +draw rect -1 -1 2 2 > + > +# Test points inside each hexagon edge > +relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0) > + > +# Test points outside each hexagon edge > +relative probe rgba (0.5, 0.2) (1.0, 1.0, 1.0, 1.0) # clipped by plane 0 > +relative probe rgba (0.8, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 1 > +relative probe rgba (0.8, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 2 > +relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3 > +relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4 > +relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 5 > diff --git a/tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-equal-to-position.shader_test > b/tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-equal-to-position.shader_test > new file mode 100644 > index 000000000..8fee276b3 > --- /dev/null > +++ b/tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-equal-to-position.shader_test > @@ -0,0 +1,73 @@ > +# [description] > +# Use all 6 clip planes to clip a rectangle to a hexagon shape. > +# > +# In this test, gl_Position and gl_ClipVertex are the same. > + > +[require] > +GL COMPAT >= 3.2 > +GLSL >= 1.50 > + > +[vertex shader] > +#version 120 > + > +void main(void) > +{ > + gl_Position = gl_Vertex; > +} > + > +[geometry shader] > +#version 150 compatibility > + > +layout(triangles) in; > +layout(triangle_strip, max_vertices = 3) out; > + > +void main() > +{ > + for (int i = 0; i < 3; i++) { > + gl_Position = gl_ModelViewProjectionMatrix * > gl_in[i].gl_Position; > + gl_ClipVertex = gl_Position; > + > + EmitVertex(); > + } > +} > + > +[fragment shader] > +#version 120 > +void main(void) > +{ > + gl_FragColor = vec4(1, 1, 1, 1); > +} > + > +[test] > +clear color 0.0 0.0 0.0 0.0 > +clear > +ortho 0 1 0 1 > +clip plane 0 0 1 0 0.5 > +clip plane 1 -1 1 0 0.8 > +clip plane 2 -1 -1 0 0.8 > +clip plane 3 0 -1 0 0.5 > +clip plane 4 1 -1 0 0.8 > +clip plane 5 1 1 0 0.8 > +enable GL_CLIP_PLANE0 > +enable GL_CLIP_PLANE1 > +enable GL_CLIP_PLANE2 > +enable GL_CLIP_PLANE3 > +enable GL_CLIP_PLANE4 > +enable GL_CLIP_PLANE5 > +draw rect 0.1 0.1 0.8 0.8 > + > +# Test points inside each hexagon edge > +relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0) > + > +# Test points outside each hexagon edge > +relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.5, 0.8) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) > diff --git a/tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-homogeneity.shader_test b/tests/spec/glsl-1.50/ > execution/compatibility/clipping/gs-clip-vertex-homogeneity.shader_test > new file mode 100644 > index 000000000..d432b6b03 > --- /dev/null > +++ b/tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-homogeneity.shader_test > @@ -0,0 +1,86 @@ > +# This test verifies that the homogeneous coordinate of gl_ClipVertex > +# is properly respected, by doubling all the coordinates of > +# gl_ClipVertex (including the homogeneous coordinate) and verifying > +# that the clipped shape is still correct. > +# > +# In addition, this test: > +# - uses all 6 clip planes to clip a rectangle to a hexagon shape. > +# - sets gl_Position and gl_ClipVertex to different values, to verify > +# that gl_Position determines screen position and gl_ClipVertex > +# determines clipping. > + > +[require] > +GL COMPAT >= 3.2 > +GLSL >= 1.50 > + > +[vertex shader] > +#version 120 > + > +void main(void) > +{ > + gl_Position = gl_Vertex; > +} > + > +[geometry shader] > +#version 150 compatibility > + > +layout(triangles) in; > +layout(triangle_strip, max_vertices = 3) out; > + > +void main() > +{ > + for (int i = 0; i < 3; i++) { > + gl_Position = gl_ModelViewProjectionMatrix * > gl_in[i].gl_Position; > + > + // Transform gl_ClipVertex in an arbitrary way so that > + // we can verify it is being used for clipping instead of > + // gl_Position. The x and y coordinates are multiplied by > 5, > + // and the homogeneous coordinate is multiplied by 0.5, so > the > + // net result should be that x and y are scaled by a > factor of > + // 10. > + gl_ClipVertex = gl_in[i].gl_Position * vec4(5.0, 5.0, 1.0, > 0.5); > + > + EmitVertex(); > + } > +} > + > +[fragment shader] > +#version 120 > +void main(void) > +{ > + gl_FragColor = vec4(1, 1, 1, 1); > +} > + > +[test] > +clear color 0.0 0.0 0.0 0.0 > +clear > +ortho 0 1 0 1 > +clip plane 0 0 1 0 -2.5 > +clip plane 1 -1 1 0 4 > +clip plane 2 -1 -1 0 14 > +clip plane 3 0 -1 0 7.5 > +clip plane 4 1 -1 0 4 > +clip plane 5 1 1 0 -6 > +enable GL_CLIP_PLANE0 > +enable GL_CLIP_PLANE1 > +enable GL_CLIP_PLANE2 > +enable GL_CLIP_PLANE3 > +enable GL_CLIP_PLANE4 > +enable GL_CLIP_PLANE5 > +draw rect 0.1 0.1 0.8 0.8 > + > +# Test points inside each hexagon edge > +relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0) > + > +# Test points outside each hexagon edge > +relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.5, 0.8) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) > diff --git a/tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-primitives-lines.shader_test > b/tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex- > primitives-lines.shader_test > new file mode 100644 > index 000000000..278d968ca > --- /dev/null > +++ b/tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-primitives-lines.shader_test > @@ -0,0 +1,72 @@ > +# Verify that gl_ClipVertex affects different primitive types correctly. > + > +[require] > +GL COMPAT >= 3.2 > +GLSL >= 1.50 > + > +[vertex shader] > +#version 120 > + > +attribute vec2 in_pos; > + > +uniform vec2 u_offset; > + > +void main(void) > +{ > + gl_Position = gl_ModelViewProjectionMatrix * vec4(u_offset + > in_pos, 0, 1); > +} > + > +[geometry shader] > +#version 150 compatibility > + > +layout(lines) in; > +layout(line_strip, max_vertices = 2) out; > + > +uniform float u_clipdist; > + > +void main() > +{ > + for (int i = 0; i < 3; i++) { > + gl_Position = gl_in[i].gl_Position; > + gl_ClipVertex = vec4(u_clipdist, 0.0, 0.0, 0.0); > + > + EmitVertex(); > + } > +} > + > +[fragment shader] > +#version 120 > +void main(void) > +{ > + gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); > +} > + > +[vertex data] > +in_pos/float/2 > + 0 0 > +10 0 > + 0 10 > +10 10 > + > +[test] > +clear color 0.0 0.0 0.0 0.0 > +clear > + > +clip plane 0 1.0 0.0 0.0 0.0 # accept points where gl_ClipVertex.x >= 0 > +enable GL_CLIP_PLANE0 > + > +ortho > + > +# Test that primitives are clipped with a negative distance > +uniform float u_clipdist -1 > + > +uniform vec2 u_offset 20 0.5 > +draw arrays GL_LINES 0 2 > +probe rect rgba (20, 0, 20, 20) (0, 0, 0, 0) > + > +# Test that primitives are not clipped with zero distance > +uniform float u_clipdist 0 > + > +uniform vec2 u_offset 20 20.5 > +draw arrays GL_LINES 0 2 > +probe rect rgba (20, 20, 10, 1) (1, 0, 0, 1) > diff --git a/tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-primitives-points.shader_test > b/tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex- > primitives-points.shader_test > new file mode 100644 > index 000000000..a4f202ec4 > --- /dev/null > +++ b/tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-primitives-points.shader_test > @@ -0,0 +1,72 @@ > +# Verify that gl_ClipVertex affects different primitive types correctly. > + > +[require] > +GL COMPAT >= 3.2 > +GLSL >= 1.50 > + > +[vertex shader] > +#version 120 > + > +attribute vec2 in_pos; > + > +uniform vec2 u_offset; > + > +void main(void) > +{ > + gl_Position = gl_ModelViewProjectionMatrix * vec4(u_offset + > in_pos, 0, 1); > +} > + > +[geometry shader] > +#version 150 compatibility > + > +layout(points) in; > +layout(points, max_vertices = 1) out; > + > +uniform float u_clipdist; > + > +void main() > +{ > + for (int i = 0; i < 3; i++) { > + gl_Position = gl_in[i].gl_Position; > + gl_ClipVertex = vec4(u_clipdist, 0.0, 0.0, 0.0); > + > + EmitVertex(); > + } > +} > + > +[fragment shader] > +#version 120 > +void main(void) > +{ > + gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); > +} > + > +[vertex data] > +in_pos/float/2 > + 0 0 > +10 0 > + 0 10 > +10 10 > + > +[test] > +clear color 0.0 0.0 0.0 0.0 > +clear > + > +clip plane 0 1.0 0.0 0.0 0.0 # accept points where gl_ClipVertex.x >= 0 > +enable GL_CLIP_PLANE0 > + > +ortho > + > +# Test that primitives are clipped with a negative distance > +uniform float u_clipdist -1 > + > +uniform vec2 u_offset 0.5 0.5 > +draw arrays GL_POINTS 0 1 > +probe rect rgba ( 0, 0, 20, 20) (0, 0, 0, 0) > + > +# Test that primitives are not clipped with zero distance > +uniform float u_clipdist 0 > + > +uniform vec2 u_offset 0.5 20.5 > +draw arrays GL_POINTS 0 1 > +probe rect rgba ( 0, 20, 1, 1) (1, 0, 0, 1) > diff --git a/tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-primitives-triangle-strip.shader_test > b/tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex- > primitives-triangle-strip.shader_test > new file mode 100644 > index 000000000..c844f64af > --- /dev/null > +++ b/tests/spec/glsl-1.50/execution/compatibility/ > clipping/gs-clip-vertex-primitives-triangle-strip.shader_test > @@ -0,0 +1,72 @@ > +# Verify that gl_ClipVertex affects different primitive types correctly. > + > +[require] > +GL COMPAT >= 3.2 > +GLSL >= 1.50 > + > +[vertex shader] > +#version 120 > + > +attribute vec2 in_pos; > + > +uniform vec2 u_offset; > + > +void main(void) > +{ > + gl_Position = gl_ModelViewProjectionMatrix * vec4(u_offset + > in_pos, 0, 1); > +} > + > +[geometry shader] > +#version 150 compatibility > + > +layout(triangles) in; > +layout(triangle_strip, max_vertices = 3) out; > + > +uniform float u_clipdist; > + > +void main() > +{ > + for (int i = 0; i < 3; i++) { > + gl_Position = gl_in[i].gl_Position; > + gl_ClipVertex = vec4(u_clipdist, 0.0, 0.0, 0.0); > + > + EmitVertex(); > + } > +} > + > +[fragment shader] > +#version 120 > +void main(void) > +{ > + gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); > +} > + > +[vertex data] > +in_pos/float/2 > + 0 0 > +10 0 > + 0 10 > +10 10 > + > +[test] > +clear color 0.0 0.0 0.0 0.0 > +clear > + > +clip plane 0 1.0 0.0 0.0 0.0 # accept points where gl_ClipVertex.x >= 0 > +enable GL_CLIP_PLANE0 > + > +ortho > + > +# Test that primitives are clipped with a negative distance > +uniform float u_clipdist -1 > + > +uniform vec2 u_offset 40 0 > +draw arrays GL_TRIANGLE_STRIP 0 4 > +probe rect rgba (40, 0, 20, 20) (0, 0, 0, 0) > + > +# Test that primitives are not clipped with zero distance > +uniform float u_clipdist 0 > + > +uniform vec2 u_offset 40 20 > +draw arrays GL_TRIANGLE_STRIP 0 4 > +probe rect rgba (40, 20, 10, 10) (1, 0, 0, 1) > diff --git a/tests/spec/glsl-1.50/execution/compatibility/ > clipping/vs-gs-clip-vertex-const-accept.shader_test > b/tests/spec/glsl-1.50/execution/compatibility/clipping/vs-gs-clip-vertex- > const-accept.shader_test > new file mode 100644 > index 000000000..93782dbba > --- /dev/null > +++ b/tests/spec/glsl-1.50/execution/compatibility/ > clipping/vs-gs-clip-vertex-const-accept.shader_test > @@ -0,0 +1,70 @@ > +# From the GL 2.1 spec, section 2.17 (Clipping): > +# > +# All points with eye coordinates (x_e y_e z_e w_e)^T that satisfy > +# > +# (x_e) > +# (p_1' p_2' p_3' p_4')(y_e) >= 0 > +# (z_e) > +# (w_e) > +# > +# lie in the half-space defined by the plane; points that do not > +# satisfy this condition do not lie in the half-space. > +# > +# This test checks that gl_ClipVertex works properly for the trivial > +# case where gl_ClipVertex is a constant value satisfying the above > +# inequality. > + > +[require] > +GL COMPAT >= 3.2 > +GLSL >= 1.50 > + > +[vertex shader] > +#version 150 compatibility > + > +out gl_PerVertex { > + vec4 gl_Position; > + vec4 gl_ClipVertex; > +}; > + > +void main(void) > +{ > + gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; > + > + gl_ClipVertex = vec4(1.0, 0.0, 0.0, 0.0); > +} > + > +[geometry shader] > +#version 150 compatibility > + > +layout(triangles) in; > +layout(triangle_strip, max_vertices = 3) out; > + > +in gl_PerVertex { > + vec4 gl_Position; > + vec4 gl_ClipVertex; > +} gl_in[]; > + > +void main() > +{ > + for (int i = 0; i < 3; i++) { > + gl_Position = gl_in[i].gl_Position; > + gl_ClipVertex = gl_in[i].gl_ClipVertex; > + > + EmitVertex(); > + } > +} > + > +[fragment shader] > +#version 120 > +void main(void) > +{ > + gl_FragColor = vec4(1.0); > +} > + > +[test] > +clear color 0.0 0.0 0.0 0.0 > +clear > +clip plane 0 1.0 0.0 0.0 0.0 # accept points where gl_ClipVertex.x >= 0 > +enable GL_CLIP_PLANE0 > +draw rect -1 -1 2 2 > +probe all rgba 1.0 1.0 1.0 1.0 > diff --git a/tests/spec/glsl-1.50/execution/compatibility/ > clipping/vs-gs-clip-vertex-const-reject.shader_test > b/tests/spec/glsl-1.50/execution/compatibility/clipping/vs-gs-clip-vertex- > const-reject.shader_test > new file mode 100644 > index 000000000..d244a288b > --- /dev/null > +++ b/tests/spec/glsl-1.50/execution/compatibility/ > clipping/vs-gs-clip-vertex-const-reject.shader_test > @@ -0,0 +1,70 @@ > +# From the GL 2.1 spec, section 2.17 (Clipping): > +# > +# All points with eye coordinates (x_e y_e z_e w_e)^T that satisfy > +# > +# (x_e) > +# (p_1' p_2' p_3' p_4')(y_e) >= 0 > +# (z_e) > +# (w_e) > +# > +# lie in the half-space defined by the plane; points that do not > +# satisfy this condition do not lie in the half-space. > +# > +# This test checks that gl_ClipVertex works properly for the trivial > +# case where gl_ClipVertex is a constant value not satisfying the > +# above inequality. > + > +[require] > +GL COMPAT >= 3.2 > +GLSL >= 1.50 > + > +[vertex shader] > +#version 150 compatibility > + > +out gl_PerVertex { > + vec4 gl_Position; > + vec4 gl_ClipVertex; > +}; > + > +void main(void) > +{ > + gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; > + > + gl_ClipVertex = vec4(-1.0, 0.0, 0.0, 0.0); > +} > + > +[geometry shader] > +#version 150 compatibility > + > +layout(triangles) in; > +layout(triangle_strip, max_vertices = 3) out; > + > +in gl_PerVertex { > + vec4 gl_Position; > + vec4 gl_ClipVertex; > +} gl_in[]; > + > +void main() > +{ > + for (int i = 0; i < 3; i++) { > + gl_Position = gl_in[i].gl_Position; > + gl_ClipVertex = gl_in[i].gl_ClipVertex; > + > + EmitVertex(); > + } > +} > + > +[fragment shader] > +#version 120 > +void main(void) > +{ > + gl_FragColor = vec4(1.0); > +} > + > +[test] > +clear color 0.0 0.0 0.0 0.0 > +clear > +clip plane 0 1.0 0.0 0.0 0.0 # accept points where gl_ClipVertex.x >= 0 > +enable GL_CLIP_PLANE0 > +draw rect -1 -1 2 2 > +probe all rgba 0.0 0.0 0.0 0.0 > diff --git a/tests/spec/glsl-1.50/execution/compatibility/ > clipping/vs-gs-clip-vertex-different-from-position.shader_test > b/tests/spec/glsl-1.50/execution/compatibility/clipping/vs-gs-clip-vertex- > different-from-position.shader_test > new file mode 100644 > index 000000000..4a5b225b3 > --- /dev/null > +++ b/tests/spec/glsl-1.50/execution/compatibility/ > clipping/vs-gs-clip-vertex-different-from-position.shader_test > @@ -0,0 +1,90 @@ > +# [description] > +# Use all 6 clip planes to clip a rectangle to a hexagon shape. > +# > +# In this test, gl_Position and gl_ClipVertex are different to verify > +# that gl_Position determines screen position and gl_ClipVertex > +# determines clipping. > + > +[require] > +GL COMPAT >= 3.2 > +GLSL >= 1.50 > + > +[vertex shader] > +#version 150 compatibility > + > +out gl_PerVertex { > + vec4 gl_Position; > + vec4 gl_ClipVertex; > +}; > + > +void main(void) > +{ > + gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; > + > + // Transform gl_ClipVertex in an arbitrary way so that > + // we can verify it is being used for clipping instead of > + // gl_Position. > + gl_ClipVertex = gl_Vertex * vec4(10.0, 10.0, 1.0, 1.0); > +} > + > +[geometry shader] > +#version 150 compatibility > + > +layout(triangles) in; > +layout(triangle_strip, max_vertices = 3) out; > + > +in gl_PerVertex { > + vec4 gl_Position; > + vec4 gl_ClipVertex; > +} gl_in[]; > + > +void main() > +{ > + for (int i = 0; i < 3; i++) { > + gl_Position = gl_in[i].gl_Position; > + gl_ClipVertex = gl_in[i].gl_ClipVertex; > + > + EmitVertex(); > + } > +} > + > +[fragment shader] > +#version 120 > +void main(void) > +{ > + gl_FragColor = vec4(1, 1, 1, 1); > +} > + > +[test] > +clear color 0.0 0.0 0.0 0.0 > +clear > +ortho 0 1 0 1 > +clip plane 0 0 1 0 -2.5 > +clip plane 1 -1 1 0 4 > +clip plane 2 -1 -1 0 14 > +clip plane 3 0 -1 0 7.5 > +clip plane 4 1 -1 0 4 > +clip plane 5 1 1 0 -6 > +enable GL_CLIP_PLANE0 > +enable GL_CLIP_PLANE1 > +enable GL_CLIP_PLANE2 > +enable GL_CLIP_PLANE3 > +enable GL_CLIP_PLANE4 > +enable GL_CLIP_PLANE5 > +draw rect 0.1 0.1 0.8 0.8 > + > +# Test points inside each hexagon edge > +relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0) > + > +# Test points outside each hexagon edge > +relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.5, 0.8) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) > diff --git a/tests/spec/glsl-1.50/execution/compatibility/ > clipping/vs-gs-clip-vertex-enables.shader_test b/tests/spec/glsl-1.50/ > execution/compatibility/clipping/vs-gs-clip-vertex-enables.shader_test > new file mode 100644 > index 000000000..4231e8b26 > --- /dev/null > +++ b/tests/spec/glsl-1.50/execution/compatibility/ > clipping/vs-gs-clip-vertex-enables.shader_test > @@ -0,0 +1,175 @@ > +# This test sets up 6 clipping planes using gl_ClipVertex, which clip > +# a rectangle to a hexagon shape. Then it tests various combinations > +# of enables for the 6 clipping planes, and verifies that they all > +# create the correct shape. > +# > +# To verify that each enable works, the combinations of enables were > +# chosen such that: > +# - Every plane is enabled at least once and disbled at least once. > +# - Every plane is enabled and disabled in a different pattern. > +# > +# Note: Some implementations have bugs related to improper coordinate > +# transformations of clip planes (which are already adequately tested > +# by the clip-plane-transformation test), so to avoid those bugs > +# contaminating the results of this test, we don't do any coordinate > +# transformation in this test. > + > +[require] > +GL COMPAT >= 3.2 > +GLSL >= 1.50 > + > +[vertex shader] > +#version 150 compatibility > + > +out gl_PerVertex { > + vec4 gl_Position; > + vec4 gl_ClipVertex; > +}; > + > +void main(void) > +{ > + gl_Position = gl_Vertex; > + > + gl_ClipVertex = gl_Position; > +} > + > +[geometry shader] > +#version 150 compatibility > + > +layout(triangles) in; > +layout(triangle_strip, max_vertices = 3) out; > + > +in gl_PerVertex { > + vec4 gl_Position; > + vec4 gl_ClipVertex; > +} gl_in[]; > + > +void main() > +{ > + for (int i = 0; i < 3; i++) { > + gl_Position = gl_in[i].gl_Position; > + gl_ClipVertex = gl_in[i].gl_ClipVertex; > + > + EmitVertex(); > + } > +} > + > +[fragment shader] > +#version 120 > +void main(void) > +{ > + gl_FragColor = vec4(1, 1, 1, 1); > +} > + > +[test] > +clip plane 0 0 1 0 0.5 > +clip plane 1 -1 1 0 0.8 > +clip plane 2 -1 -1 0 0.8 > +clip plane 3 0 -1 0 0.5 > +clip plane 4 1 -1 0 0.8 > +clip plane 5 1 1 0 0.8 > +clear color 0.0 0.0 0.0 0.0 > + > +# Test with planes 0, 2, and 4 enabled. > +enable GL_CLIP_PLANE0 > +disable GL_CLIP_PLANE1 > +enable GL_CLIP_PLANE2 > +disable GL_CLIP_PLANE3 > +enable GL_CLIP_PLANE4 > +disable GL_CLIP_PLANE5 > +clear > +draw rect -1 -1 2 2 > + > +# Test points inside each hexagon edge > +relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0) > + > +# Test points outside each hexagon edge > +relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0 > +relative probe rgba (0.8, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 1 > +relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 2 > +relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3 > +relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4 > +relative probe rgba (0.2, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 5 > + > +# Test with planes 0, 1, 4, and 5 enabled. > +enable GL_CLIP_PLANE0 > +enable GL_CLIP_PLANE1 > +disable GL_CLIP_PLANE2 > +disable GL_CLIP_PLANE3 > +enable GL_CLIP_PLANE4 > +enable GL_CLIP_PLANE5 > +clear > +draw rect -1 -1 2 2 > + > +# Test points inside each hexagon edge > +relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0) > + > +# Test points outside each hexagon edge > +relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0 > +relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 1 > +relative probe rgba (0.8, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 2 > +relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3 > +relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4 > +relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 5 > + > +# Test with planes 0, 1, 2, and 3 enabled. > +enable GL_CLIP_PLANE0 > +enable GL_CLIP_PLANE1 > +enable GL_CLIP_PLANE2 > +enable GL_CLIP_PLANE3 > +disable GL_CLIP_PLANE4 > +disable GL_CLIP_PLANE5 > +clear > +draw rect -1 -1 2 2 > + > +# Test points inside each hexagon edge > +relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0) > + > +# Test points outside each hexagon edge > +relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) # clipped by plane 0 > +relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 1 > +relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 2 > +relative probe rgba (0.5, 0.8) (0.0, 0.0, 0.0, 0.0) # clipped by plane 3 > +relative probe rgba (0.2, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 4 > +relative probe rgba (0.2, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 5 > + > +# Test with planes 4 and 5 enabled. > +disable GL_CLIP_PLANE0 > +disable GL_CLIP_PLANE1 > +disable GL_CLIP_PLANE2 > +disable GL_CLIP_PLANE3 > +enable GL_CLIP_PLANE4 > +enable GL_CLIP_PLANE5 > +clear > +draw rect -1 -1 2 2 > + > +# Test points inside each hexagon edge > +relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0) > + > +# Test points outside each hexagon edge > +relative probe rgba (0.5, 0.2) (1.0, 1.0, 1.0, 1.0) # clipped by plane 0 > +relative probe rgba (0.8, 0.3) (1.0, 1.0, 1.0, 1.0) # clipped by plane 1 > +relative probe rgba (0.8, 0.7) (1.0, 1.0, 1.0, 1.0) # clipped by plane 2 > +relative probe rgba (0.5, 0.8) (1.0, 1.0, 1.0, 1.0) # clipped by plane 3 > +relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) # clipped by plane 4 > +relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) # clipped by plane 5 > diff --git a/tests/spec/glsl-1.50/execution/compatibility/ > clipping/vs-gs-clip-vertex-equal-to-position.shader_test > b/tests/spec/glsl-1.50/execution/compatibility/clipping/vs-gs-clip-vertex- > equal-to-position.shader_test > new file mode 100644 > index 000000000..7e05c7e72 > --- /dev/null > +++ b/tests/spec/glsl-1.50/execution/compatibility/ > clipping/vs-gs-clip-vertex-equal-to-position.shader_test > @@ -0,0 +1,85 @@ > +# [description] > +# Use all 6 clip planes to clip a rectangle to a hexagon shape. > +# > +# In this test, gl_Position and gl_ClipVertex are the same. > + > +[require] > +GL COMPAT >= 3.2 > +GLSL >= 1.50 > + > +[vertex shader] > +#version 150 compatibility > + > +out gl_PerVertex { > + vec4 gl_Position; > + vec4 gl_ClipVertex; > +}; > + > +void main(void) > +{ > + gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; > + > + gl_ClipVertex = gl_Position; > +} > + > +[geometry shader] > +#version 150 compatibility > + > +layout(triangles) in; > +layout(triangle_strip, max_vertices = 3) out; > + > +in gl_PerVertex { > + vec4 gl_Position; > + vec4 gl_ClipVertex; > +} gl_in[]; > + > +void main() > +{ > + for (int i = 0; i < 3; i++) { > + gl_Position = gl_in[i].gl_Position; > + gl_ClipVertex = gl_in[i].gl_ClipVertex; > + > + EmitVertex(); > + } > +} > + > +[fragment shader] > +#version 120 > +void main(void) > +{ > + gl_FragColor = vec4(1, 1, 1, 1); > +} > + > +[test] > +clear color 0.0 0.0 0.0 0.0 > +clear > +ortho 0 1 0 1 > +clip plane 0 0 1 0 0.5 > +clip plane 1 -1 1 0 0.8 > +clip plane 2 -1 -1 0 0.8 > +clip plane 3 0 -1 0 0.5 > +clip plane 4 1 -1 0 0.8 > +clip plane 5 1 1 0 0.8 > +enable GL_CLIP_PLANE0 > +enable GL_CLIP_PLANE1 > +enable GL_CLIP_PLANE2 > +enable GL_CLIP_PLANE3 > +enable GL_CLIP_PLANE4 > +enable GL_CLIP_PLANE5 > +draw rect 0.1 0.1 0.8 0.8 > + > +# Test points inside each hexagon edge > +relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0) > + > +# Test points outside each hexagon edge > +relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.5, 0.8) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) > diff --git a/tests/spec/glsl-1.50/execution/compatibility/ > clipping/vs-gs-clip-vertex-homogeneity.shader_test b/tests/spec/glsl-1.50/ > execution/compatibility/clipping/vs-gs-clip-vertex-homogeneity.shader_test > new file mode 100644 > index 000000000..a9ef08100 > --- /dev/null > +++ b/tests/spec/glsl-1.50/execution/compatibility/ > clipping/vs-gs-clip-vertex-homogeneity.shader_test > @@ -0,0 +1,97 @@ > +# This test verifies that the homogeneous coordinate of gl_ClipVertex > +# is properly respected, by doubling all the coordinates of > +# gl_ClipVertex (including the homogeneous coordinate) and verifying > +# that the clipped shape is still correct. > +# > +# In addition, this test: > +# - uses all 6 clip planes to clip a rectangle to a hexagon shape. > +# - sets gl_Position and gl_ClipVertex to different values, to verify > +# that gl_Position determines screen position and gl_ClipVertex > +# determines clipping. > + > +[require] > +GL COMPAT >= 3.2 > +GLSL >= 1.50 > + > +[vertex shader] > +#version 150 compatibility > + > +out gl_PerVertex { > + vec4 gl_Position; > + vec4 gl_ClipVertex; > +}; > + > +void main(void) > +{ > + gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; > + > + // Transform gl_ClipVertex in an arbitrary way so that > + // we can verify it is being used for clipping instead of > + // gl_Position. The x and y coordinates are multiplied by 5, > + // and the homogeneous coordinate is multiplied by 0.5, so the > + // net result should be that x and y are scaled by a factor of > + // 10. > + gl_ClipVertex = gl_Vertex * vec4(5.0, 5.0, 1.0, 0.5); > +} > + > +[geometry shader] > +#version 150 compatibility > + > +layout(triangles) in; > +layout(triangle_strip, max_vertices = 3) out; > + > +in gl_PerVertex { > + vec4 gl_Position; > + vec4 gl_ClipVertex; > +} gl_in[]; > + > +void main() > +{ > + for (int i = 0; i < 3; i++) { > + gl_Position = gl_in[i].gl_Position; > + gl_ClipVertex = gl_in[i].gl_ClipVertex; > + > + EmitVertex(); > + } > +} > + > +[fragment shader] > +#version 120 > +void main(void) > +{ > + gl_FragColor = vec4(1, 1, 1, 1); > +} > + > +[test] > +clear color 0.0 0.0 0.0 0.0 > +clear > +ortho 0 1 0 1 > +clip plane 0 0 1 0 -2.5 > +clip plane 1 -1 1 0 4 > +clip plane 2 -1 -1 0 14 > +clip plane 3 0 -1 0 7.5 > +clip plane 4 1 -1 0 4 > +clip plane 5 1 1 0 -6 > +enable GL_CLIP_PLANE0 > +enable GL_CLIP_PLANE1 > +enable GL_CLIP_PLANE2 > +enable GL_CLIP_PLANE3 > +enable GL_CLIP_PLANE4 > +enable GL_CLIP_PLANE5 > +draw rect 0.1 0.1 0.8 0.8 > + > +# Test points inside each hexagon edge > +relative probe rgba (0.3, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.3) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.4) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.7, 0.6) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.5, 0.7) (1.0, 1.0, 1.0, 1.0) > +relative probe rgba (0.3, 0.6) (1.0, 1.0, 1.0, 1.0) > + > +# Test points outside each hexagon edge > +relative probe rgba (0.2, 0.3) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.5, 0.2) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.8, 0.3) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.8, 0.7) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.5, 0.8) (0.0, 0.0, 0.0, 0.0) > +relative probe rgba (0.2, 0.7) (0.0, 0.0, 0.0, 0.0) > diff --git a/tests/spec/glsl-1.50/execution/compatibility/ > clipping/vs-gs-clip-vertex-primitives-triangle-strip.shader_test > b/tests/spec/glsl-1.50/execution/compatibility/clipping/vs-gs-clip-vertex- > primitives-triangle-strip.shader_test > new file mode 100644 > index 000000000..e57387018 > --- /dev/null > +++ b/tests/spec/glsl-1.50/execution/compatibility/ > clipping/vs-gs-clip-vertex-primitives-triangle-strip.shader_test > @@ -0,0 +1,83 @@ > +# Verify that gl_ClipVertex affects different primitive types correctly. > + > +[require] > +GL COMPAT >= 3.2 > +GLSL >= 1.50 > + > +[vertex shader] > +#version 150 compatibility > + > +out gl_PerVertex { > + vec4 gl_Position; > + vec4 gl_ClipVertex; > +}; > + > +attribute vec2 in_pos; > + > +uniform vec2 u_offset; > +uniform float u_clipdist; > + > +void main(void) > +{ > + gl_Position = gl_ModelViewProjectionMatrix * vec4(u_offset + > in_pos, 0, 1); > + > + gl_ClipVertex = vec4(u_clipdist, 0.0, 0.0, 0.0); > +} > + > +[geometry shader] > +#version 150 compatibility > + > +layout(triangles) in; > +layout(triangle_strip, max_vertices = 3) out; > + > +in gl_PerVertex { > + vec4 gl_Position; > + vec4 gl_ClipVertex; > +} gl_in[]; > + > +void main() > +{ > + for (int i = 0; i < 3; i++) { > + gl_Position = gl_in[i].gl_Position; > + gl_ClipVertex = gl_in[i].gl_ClipVertex; > + > + EmitVertex(); > + } > +} > + > +[fragment shader] > +#version 120 > +void main(void) > +{ > + gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); > +} > + > +[vertex data] > +in_pos/float/2 > + 0 0 > +10 0 > + 0 10 > +10 10 > + > +[test] > +clear color 0.0 0.0 0.0 0.0 > +clear > + > +clip plane 0 1.0 0.0 0.0 0.0 # accept points where gl_ClipVertex.x >= 0 > +enable GL_CLIP_PLANE0 > + > +ortho > + > +# Test that primitives are clipped with a negative distance > +uniform float u_clipdist -1 > + > +uniform vec2 u_offset 40 0 > +draw arrays GL_TRIANGLE_STRIP 0 4 > +probe rect rgba (40, 0, 20, 20) (0, 0, 0, 0) > + > +# Test that primitives are not clipped with zero distance > +uniform float u_clipdist 0 > + > +uniform vec2 u_offset 40 20 > +draw arrays GL_TRIANGLE_STRIP 0 4 > +probe rect rgba (40, 20, 10, 10) (1, 0, 0, 1) > -- > 2.17.0 > > _______________________________________________ > Piglit mailing list > Piglit@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/piglit >
_______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit