forked from shader-slang/slang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgh-4150.slang
49 lines (43 loc) · 1.38 KB
/
gh-4150.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
42
43
44
45
46
47
48
49
//TEST:SIMPLE(filecheck=CHECK1):-target spirv -DERROR1
//TEST:SIMPLE(filecheck=CHECK2):-target spirv -DERROR2
extern static const int constValue = 1;
struct RWTex<T : __BuiltinRealType, let N : uint>
{
#ifdef ERROR2
// expect error: cannot define static member with unsized type.
// CHECK2:([[# @LINE+1]]): error 30071
static [[vk::binding(0, 0)]] vector<T,N> rwtable[];
#else
static [[vk::binding(0, 0)]] vector<T,N> rwtable[4];
#endif
static vector<T, N> get(uint image_index) { return rwtable[image_index]; }
}
struct Push
{
uint image_id;
};
[[vk::push_constant]] Push p;
RWStructuredBuffer<float3> output;
[shader("compute")]
[numthreads(8, 8, 1)]
void main(uint3 pixel_i : SV_DispatchThreadID)
{
output[0] =
#ifdef ERROR1
// expect error: trying to specialize RWTex, which has two arguments, with only one argument.
// CHECK1-DAG:([[# @LINE+1]]): error 30075
RWTex<float3>::get(p.image_id);
#else
RWTex<float, 3>::get(p.image_id);
#endif
//CHECK1-DAG:([[# @LINE+1]]): error 30071
static float sa1[];
//CHECK1-DAG:([[# @LINE+1]]): error 30071
float sa2[];
//CHECK1-NOT:([[# @LINE+1]]): error
static float sa3[] = { 1, 2, 3 }; // should be ok.
//CHECK1-NOT:([[# @LINE+1]]): error
float sa4[] = { 1, 2, 3 }; // should be ok.
//CHECK1-NOT:([[# @LINE+1]]): error
float sa5[constValue]; // should be ok.
}