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
726 B34 linesraw
1//TEST:COMPARE_HLSL: -profile vs_5_0
2
3// Confirm that type-cast expressions parse with
4// the appropriate precedence.
5
6#ifdef __SLANG__
7#define R(X) /**/
8#define BEGIN_CBUFFER(NAME) cbuffer NAME
9#define END_CBUFFER(NAME, REG) /**/
10#define CBUFFER_REF(NAME, FIELD) FIELD
11#else
12#define R(X) X
13#define BEGIN_CBUFFER(NAME) struct SLANG_ParameterGroup_##NAME
14#define END_CBUFFER(NAME, REG) ; cbuffer NAME : register(REG) { SLANG_ParameterGroup_##NAME NAME; }
15#define CBUFFER_REF(NAME, FIELD) NAME.FIELD
16
17#define C C_0
18#define a a_0
19#define b b_0
20#define SV_Position SV_POSITION
21#endif
22
23BEGIN_CBUFFER(C)
24{
25	float a;
26	float b;
27}
28END_CBUFFER(C,b0)
29
30
31float4 main() : SV_Position
32{
33	return (uint) CBUFFER_REF(C,a) / CBUFFER_REF(C,b);
34}