yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
387f2be1e
master
1// Same to gh-4874.slang, but defining the global resource typed variables 2// without the "const" modifier. This should lead to a compile time error. 3// 4//TEST:SIMPLE(filecheck=CHECK): -target spirv 5RWStructuredBuffer<uint> outputBuffer; 6 7RWStructuredBuffer<uint> inputBuffer; 8 9// CHECK: ([[# @LINE+1]]): error 30076: 10static RWStructuredBuffer<uint> gBuffer = inputBuffer; 11 12struct Stuff 13{ 14 __init(RWStructuredBuffer<uint> a1, RWStructuredBuffer<uint> b2) 15 { 16 a = a1; 17 b = b2; 18 } 19 20 RWStructuredBuffer<uint> a; 21 RWStructuredBuffer<uint> b; 22} 23 24// CHECK: ([[# @LINE+1]]): error 30076: 25static Stuff gStuff = Stuff( inputBuffer, inputBuffer ); 26 27uint test(uint x) 28{ 29 return gBuffer[x] 30 + gStuff.a[x + 1] * 16 31 + gStuff.b[x + 2] * 256; 32} 33 34[numthreads(4, 1, 1)] 35void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) 36{ 37 let tid = dispatchThreadID.x; 38 let inVal = tid; 39 let outVal = test(inVal); 40 outputBuffer[tid] = outVal; 41}