yum-mirror/slang

Making it easier to work with shaders

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

Alexey PanteleevSupport for querying which parameters are used in emitted code (#2239)69cb6e8f3

master
720 B34 linesraw
1//TEST:REFLECTION:-profile cs_6_0  -target hlsl -entry computeMain -no-codegen
2
3struct Thing
4{
5    static int value;
6};
7
8struct AnotherThing
9{
10    int a;
11    int b;
12    static Texture2D t;
13};
14
15
16ConstantBuffer<Thing> cbThing;
17ConstantBuffer<AnotherThing> cbAnotherThing;
18
19//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
20RWStructuredBuffer<int> outputBuffer;
21
22[numthreads(4, 1, 1)]
23void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
24{
25    Texture2D t = AnotherThing::t;
26    
27    float4 v = t.Load(int3(dispatchThreadID.x, dispatchThreadID.y, 0));
28    
29    int m = cbAnotherThing.a + cbAnotherThing.b + Thing::value;
30    
31    m += int(v.x);
32    
33    outputBuffer[dispatchThreadID.x] = m;
34}