File: tes-clip-vertex-different-from-position.shader_test

package info (click to toggle)
piglit 0~git20220119-124bca3c9-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 109,012 kB
  • sloc: ansic: 273,511; xml: 46,666; python: 33,098; lisp: 20,392; cpp: 12,480; sh: 22; makefile: 22; pascal: 5
file content (88 lines) | stat: -rw-r--r-- 2,132 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# [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
GL_ARB_tessellation_shader

[vertex shader]
#version 150 compatibility

in vec4 piglit_vertex;

void main(void)
{
	gl_Position = piglit_vertex;
}

[tessellation evaluation shader]
#version 150 compatibility
#extension GL_ARB_tessellation_shader: require

layout(quads) in;

void main() {
	gl_Position = gl_ModelViewProjectionMatrix * vec4(gl_TessCoord.xy * 2 - 1, 0, 1);

	// Transform gl_ClipVertex in an arbitrary way so that
	// we can verify it is being used for clipping instead of
	// gl_Position.
	gl_ClipVertex = vec4(gl_TessCoord.xy * 2 - 1, 0, 1) * vec4(10.0, 10.0, 1.0, 1.0);
}

[fragment shader]
#version 120
void main(void)
{
	gl_FragColor = vec4(1, 1, 1, 1);
}

[vertex data]
piglit_vertex/float/2
0.1 0.1
 0.8 0.1
0.1  0.8
0.1  0.8
 0.8 0.1
 0.8  0.8

[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

patch parameter vertices 1
draw arrays GL_PATCHES 0 1

# 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)