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
757 B43 linesraw
1//TEST:COMPARE_HLSL: -profile ps_5_1 -entry main -parameter-blocks-use-register-spaces
2
3// Confirm that Slang `ParameterBlock<T>` generates
4// parameter bindings like we expect.
5
6
7float4 use(float4 val) { return val; };
8float4 use(Texture2D t, SamplerState s) { return t.Sample(s, 0.0); }
9
10#ifdef __SLANG__
11
12struct S
13{
14	Texture2D 		t;
15	Texture2D 		ta[4];
16	SamplerState 	s;	
17};
18
19ParameterBlock<S> p;
20
21float4 main(float v : V) : SV_Target
22{
23	return use(p.ta[int(v)], p.s)
24		+ use(p.t, p.s);
25}
26
27#else
28
29#define t p_t_0
30#define ta p_ta_0
31#define s p_s_0
32
33Texture2D t : register(t0, space0);
34Texture2D ta[4] : register(t1, space0);
35SamplerState s : register(s0, space0);
36
37float4 main(float v : V) : SV_TARGET
38{
39	return use(ta[int(v)], s)
40		+ use(t, s);
41}
42
43#endif