yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
8813c6105
master
1// nested-component-write.slang 2 3// This tests that writing to individual components nested structs works for 4// mesh shader outputs. 5 6//TEST:CROSS_COMPILE:-target spirv -profile glsl_450+GL_EXT_mesh_shader -entry main -stage mesh 7 8struct Foo 9{ 10 float4 pos : SV_Position; 11 Bar bar; 12}; 13 14struct Bar 15{ 16 Baz baz : Color; 17}; 18 19struct Baz 20{ 21 float3 color; 22}; 23 24struct Vertex 25{ 26 Foo foo; 27}; 28 29const static uint MAX_VERTS = 3; 30const static uint MAX_PRIMS = 1; 31 32[outputtopology("triangle")] 33[numthreads(3, 1, 1)] 34void main( 35 in uint tig : SV_GroupIndex, 36 OutputVertices<Vertex, MAX_VERTS> verts, 37 OutputIndices<uint3, MAX_PRIMS> triangles 38 ) 39{ 40 SetMeshOutputCounts(3, 1); 41 42 if(tig < 3) { 43 verts[tig].foo.pos = float4(0, 0, 0, 1); 44 verts[tig].foo.bar.baz.color = float3(1, 2, 3); 45 } 46 47 if(tig < 1) { 48 triangles[tig] = uint3(0,1,2); 49 } 50} 51