yum-mirror/slang

Making it easier to work with shaders

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

Tim FoleyChange how buffers are emitted (#741)135eaff6b

master
884 B39 linesraw
1//TEST:COMPARE_HLSL: -profile vs_5_0
2
3// Check handling of initializer list for vector
4
5#ifdef __SLANG__
6#define BEGIN_CBUFFER(NAME) cbuffer NAME
7#define END_CBUFFER(NAME, REG) /**/
8#define CBUFFER_REF(NAME, FIELD) FIELD
9#else
10#define BEGIN_CBUFFER(NAME) struct SLANG_ParameterGroup_##NAME
11#define END_CBUFFER(NAME, REG) ; cbuffer NAME : REG { SLANG_ParameterGroup_##NAME NAME; }
12#define CBUFFER_REF(NAME, FIELD) NAME.FIELD
13
14#define C C_0
15#define a a_0
16#define SV_Position SV_POSITION
17
18#endif
19
20BEGIN_CBUFFER(C)
21{
22    float4 a;
23}
24END_CBUFFER(C, register(b0))
25
26float w0(float x) { return x; }
27float w1(float x) { return x; }
28float w2(float x) { return x; }
29float w3(float x) { return x; }
30
31float4 main() : SV_Position
32{
33    float4 wx = {
34        w0(CBUFFER_REF(C,a).x),
35        w1(CBUFFER_REF(C,a).x),
36        w2(CBUFFER_REF(C,a).x),
37        w3(CBUFFER_REF(C,a).x), };
38    return wx;
39}