forked from shader-slang/slang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgh-4874-2.slang
41 lines (34 loc) · 982 Bytes
/
gh-4874-2.slang
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Same to gh-4874.slang, but defining the global resource typed variables
// without the "const" modifier. This should lead to a compile time error.
//
//TEST:SIMPLE(filecheck=CHECK): -target spirv
RWStructuredBuffer<uint> outputBuffer;
RWStructuredBuffer<uint> inputBuffer;
// CHECK: ([[# @LINE+1]]): error 30076:
static RWStructuredBuffer<uint> gBuffer = inputBuffer;
struct Stuff
{
__init(RWStructuredBuffer<uint> a1, RWStructuredBuffer<uint> b2)
{
a = a1;
b = b2;
}
RWStructuredBuffer<uint> a;
RWStructuredBuffer<uint> b;
}
// CHECK: ([[# @LINE+1]]): error 30076:
static Stuff gStuff = Stuff( inputBuffer, inputBuffer );
uint test(uint x)
{
return gBuffer[x]
+ gStuff.a[x + 1] * 16
+ gStuff.b[x + 2] * 256;
}
[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
let tid = dispatchThreadID.x;
let inVal = tid;
let outVal = test(inVal);
outputBuffer[tid] = outVal;
}