summaryrefslogtreecommitdiff
path: root/tests/cross-compile/geometry-shader.slang
blob: 8666b739a4672a3ffd9c1a98fff79ff9b42bf719 (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
// geometry-shader.slang

//TEST:CROSS_COMPILE: -profile sm_5_0 -stage geometry -entry main -target spirv-assembly

struct CoarseVertex
{
    float4 position     : POSITION;
    float3 color        : COLOR;
    uint   id           : ID;
}

struct RasterVertex
{
    float4 position : POSITION;
    float3 color    : COLOR;
    uint   id       : SV_RenderTargetArrayIndex;
}

[maxvertexcount(3)]
void main(
    triangle CoarseVertex coarseVertices[3],
    inout TriangleStream<RasterVertex> outputStream,
    uint primitiveID : SV_PrimitiveID)
{
    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;
        outputStream.Append(rasterVertex);
    }
}