forked from shader-slang/slang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvec-init-list.hlsl
39 lines (32 loc) · 884 Bytes
/
vec-init-list.hlsl
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
//TEST:COMPARE_HLSL: -profile vs_5_0
// Check handling of initializer list for vector
#ifdef __SLANG__
#define BEGIN_CBUFFER(NAME) cbuffer NAME
#define END_CBUFFER(NAME, REG) /**/
#define CBUFFER_REF(NAME, FIELD) FIELD
#else
#define BEGIN_CBUFFER(NAME) struct SLANG_ParameterGroup_##NAME
#define END_CBUFFER(NAME, REG) ; cbuffer NAME : REG { SLANG_ParameterGroup_##NAME NAME; }
#define CBUFFER_REF(NAME, FIELD) NAME.FIELD
#define C C_0
#define a a_0
#define SV_Position SV_POSITION
#endif
BEGIN_CBUFFER(C)
{
float4 a;
}
END_CBUFFER(C, register(b0))
float w0(float x) { return x; }
float w1(float x) { return x; }
float w2(float x) { return x; }
float w3(float x) { return x; }
float4 main() : SV_Position
{
float4 wx = {
w0(CBUFFER_REF(C,a).x),
w1(CBUFFER_REF(C,a).x),
w2(CBUFFER_REF(C,a).x),
w3(CBUFFER_REF(C,a).x), };
return wx;
}