yum-mirror/slang

Making it easier to work with shaders

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

Yong HeMake `-no-mangle` option work, add `-no-hlsl-binding`. (#3817)a23adc221

master
723 B36 linesraw
1//TEST:COMPARE_HLSL: -profile ps_4_0 -entry main
2
3// Ensure that matrix-times-scalar works
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 b b_0
17#endif
18
19float4x4 doIt(float4x4 a, float b)
20{
21    return a * b;
22}
23
24BEGIN_CBUFFER(C)
25{
26    float4x4 a;
27    float b;    
28}
29END_CBUFFER(C,register(b0))
30
31float4 main() : SV_TARGET
32{
33    return doIt(
34        CBUFFER_REF(C,a),
35        CBUFFER_REF(C,b))[0];
36}