yum-mirror/slang

Making it easier to work with shaders

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

CopilotFix spurious vk::binding warnings when attribute is present (#7581)cd28357bb

master
1.2 KiB35 linesraw
1// vk-binding-with-register-no-warning.slang
2
3//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):-target metallib -matrix-layout-row-major -entry main
4
5// Test that no spurious warnings are generated when vk::binding is present alongside register
6// This addresses issue #7553 where the compiler incorrectly warned about missing vk::binding
7
8// Should NOT generate warning - has both vk::binding and register
9// CHECK-NOT: ([[# @LINE+1]]): warning 39029
10[[vk::binding(0, 0)]] cbuffer ConstantBuffer : register(b0)
11{
12    float4 testValue;
13};
14
15// Should NOT generate warning - has both vk::binding and register  
16// CHECK-NOT: ([[# @LINE+1]]): warning 39029
17[[vk::binding(1, 0)]] Texture2D tex : register(t1);
18
19// Should NOT generate warning - has both vk::binding and register
20// CHECK-NOT: ([[# @LINE+1]]): warning 39029
21[[vk::binding(2, 0)]] SamplerState sampler : register(s2);
22
23// Should generate warning - has register but no vk::binding
24// CHECK: ([[# @LINE+1]]): warning 39029
25Texture2D texNoBinding : register(t3);
26
27// Should generate warning - has register but no vk::binding
28// CHECK: ([[# @LINE+1]]): warning 39029
29ConstantBuffer<float4> cbNoBinding : register(b4);
30
31[shader("compute")]
32[numthreads(1, 1, 1)]
33void main()
34{
35}