blob: 20634ea67a7a6157f486cfe64fc80142535d147f (
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
|
// geometry-shader-sub-func.slang
//TEST:SIMPLE(filecheck=SPIRV): -target spirv -emit-spirv-directly -O0
struct CoarseVertex
{
float4 position : POSITION;
float3 color : COLOR;
uint id : ID;
}
struct RasterVertex
{
float4 position : POSITION;
float3 color : COLOR;
uint id : SV_RenderTargetArrayIndex;
}
// SPIRV: OpEntryPoint
// SPIRV: OpStore %outputStream_position
// SPIRV: OpEmitVertex
void appendVertex(TriangleStream<RasterVertex> outputStream, RasterVertex vert)
{
outputStream.Append(vert);
}
[shader("geometry")]
[maxvertexcount(3)]
void main(
triangle CoarseVertex coarseVertices[3],
inout TriangleStream<RasterVertex> outputStream,
uint primitiveID : SV_PrimitiveID)
{
[ForceUnroll]
for(int ii = 0; ii < 3; ++ii)
{
CoarseVertex coarseVertex = coarseVertices[ii];
RasterVertex rasterVertex;
rasterVertex.position = coarseVertex.position;
rasterVertex.color = coarseVertex.color;
rasterVertex.id = coarseVertex.id + primitiveID;
appendVertex(outputStream, rasterVertex);
}
}
|