yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Yong HeEnhance buffer load specialization pass to specialize past field extracts. (#8547)e4611e2e3

master
671 B38 linesraw
1//TEST:SIMPLE(filecheck=SPV): -target spirv
2
3struct Bottom
4{
5    float bigArray[1024];
6    float bottomGetValue(int index) { return bigArray[index]; }
7}
8
9struct Middle
10{
11    Bottom bottom;
12    float middleGetValue(int index) { return bottom.bottomGetValue(index); }
13}
14
15struct Top
16{
17    Middle middle;
18    float topGetValue(int index) { return middle.middleGetValue(index); }
19}
20
21struct Root
22{
23    Top top;
24}
25
26ConstantBuffer<Root> cb;
27
28RWStructuredBuffer<float> outputBuffer;
29
30// SPV: OpEntryPoint
31// SPV-NOT: OpCompositeConstruct
32
33[shader("compute")]
34[numthreads(1, 1, 1)]
35void compute_main(uint3 tid: SV_DispatchThreadID)
36{
37    outputBuffer[0] = cb.top.topGetValue(0);
38}