yum-mirror/slang

Making it easier to work with shaders

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

ArielG-NVWarn if providing explicit bindings to a object using uniform locations (#4708)c28d8b6ae

master
879 B27 linesraw
1//TEST:SIMPLE(filecheck=PASS): -entry computeMain -stage compute -target spirv -DPASS1
2//TEST:SIMPLE(filecheck=WARN): -entry computeMain -stage compute -target spirv -DWARN1
3//TEST:SIMPLE(filecheck=WARN): -entry computeMain -stage compute -target spirv -DWARN2
4
5//PASS-NOT: 31104
6#ifdef PASS
7[[vk_binding(0,0)]] uniform ConstantBuffer<uint> addresses;
8layout(location = 1) uniform ConstantBuffer<uint> addresses1;
9#endif
10
11//WARN: 31104
12#ifdef WARN1
13[[vk_binding(0,0)]] uniform uint addresses;
14[[vk_binding(1,0)]] uniform uint addresses1;
15#endif
16#ifdef WARN2
17layout(location = 0) uniform uint addresses;
18layout(location = 1) uniform uint addresses1;
19#endif
20
21[shader("compute")]
22[numthreads(1, 1, 1)]
23void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID, uint groupIndex: SV_GroupIndex)
24{
25    printf("\nfrom gpu: %u", addresses);
26    printf("\nfrom gpu: %u", addresses1);
27}