yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
8813c6105
master
1// component-write.slang 2 3// This tests that writing to individual components of the output struct works 4 5//TEST:CROSS_COMPILE:-target spirv -profile sm_6_5 -entry main -stage mesh 6 7const static uint MAX_VERTS = 3; 8const static uint MAX_PRIMS = 1; 9 10[outputtopology("triangle")] 11[numthreads(3, 1, 1)] 12void main( 13 in uint tig : SV_GroupIndex, 14 OutputVertices<float4, MAX_VERTS> verts : SV_Position, 15 OutputIndices<uint3, MAX_PRIMS> triangles 16 ) 17{ 18 const uint numVertices = 3; 19 const uint numPrimitives = 1; 20 SetMeshOutputCounts(numVertices, numPrimitives); 21 22 if(tig < numVertices) { 23 verts[tig].wz = float2(1, 0); 24 verts[tig].x = 0; 25 verts[tig].y = 0; 26 } 27 28 if(tig < numPrimitives) { 29 triangles[tig] = uint3(0,1,2); 30 } 31} 32