summaryrefslogtreecommitdiff
path: root/tests/pipeline/rasterization/mesh/swizzled-store.slang
blob: 6636ef31d1aa6c913f24a4c7a93ad3ac07973f2f (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
// component-write.slang

// This tests that writing to individual components of the output struct works

//TEST:CROSS_COMPILE:-target spirv -profile sm_6_5 -entry main -stage mesh

const static uint MAX_VERTS = 3;
const static uint MAX_PRIMS = 1;

[outputtopology("triangle")]
[numthreads(3, 1, 1)]
void main(
    in uint tig : SV_GroupIndex,
    OutputVertices<float4, MAX_VERTS> verts : SV_Position,
    OutputIndices<uint3, MAX_PRIMS> triangles
    )
{
    const uint numVertices = 3;
    const uint numPrimitives = 1;
    SetMeshOutputCounts(numVertices, numPrimitives);

    if(tig < numVertices) {
        verts[tig].wz = float2(1, 0);
        verts[tig].x = 0;
        verts[tig].y = 0;
    }

    if(tig < numPrimitives) {
        triangles[tig] = uint3(0,1,2);
    }
}