blob: 72545302fd39f3e613324149160f1092122a7c3f (
plain)
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
|
#ifdef MESH_SHADER
/* TODO tight slices */
layout(triangles) in;
layout(triangle_strip, max_vertices=3) out;
#else /* World */
layout(triangles) in;
layout(triangle_strip, max_vertices=3) out;
#endif
in vec4 vPos[];
flat out int slice;
#ifdef MESH_SHADER
/* TODO tight slices */
void main() {
gl_Layer = slice = int(vPos[0].z);
#ifdef USE_ATTR
pass_attr(0);
#endif
gl_Position = vPos[0].xyww;
EmitVertex();
#ifdef USE_ATTR
pass_attr(1);
#endif
gl_Position = vPos[1].xyww;
EmitVertex();
#ifdef USE_ATTR
pass_attr(2);
#endif
gl_Position = vPos[2].xyww;
EmitVertex();
EndPrimitive();
}
#else /* World */
/* This is just a pass-through geometry shader that send the geometry
* to the layer corresponding to it's depth. */
void main() {
gl_Layer = slice = int(vPos[0].z);
#ifdef USE_ATTR
pass_attr(0);
#endif
gl_Position = vPos[0].xyww;
EmitVertex();
#ifdef USE_ATTR
pass_attr(1);
#endif
gl_Position = vPos[1].xyww;
EmitVertex();
#ifdef USE_ATTR
pass_attr(2);
#endif
gl_Position = vPos[2].xyww;
EmitVertex();
EndPrimitive();
}
#endif
|