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
725 B46 linesraw
1//TEST:COMPARE_HLSL: -profile ps_5_1 -entry main
2
3// Let's first confirm that Slang can reproduce what the
4// HLSL compiler would already do in the simple case (when
5// all shader parameters are actually used).
6
7float4 use(Texture2D t, SamplerState samp) { return t.Sample(samp, 0.0); }
8
9#ifdef __SLANG__
10
11struct Test
12{
13	Texture2D a;
14	Texture2D b;
15};
16
17Test test[2];
18SamplerState s;
19
20float4 main() : SV_Target
21{
22	return use(test[0].a,s)
23		 + use(test[0].b,s)
24		 + use(test[1].a,s)
25		 + use(test[1].b,s);
26}
27
28#else
29
30#define a test_a_0
31#define b test_b_0
32#define s s_0
33
34Texture2D a[2];
35Texture2D b[2];
36SamplerState s;
37
38float4 main() : SV_TARGET
39{
40	return use(a[0],s)
41		 + use(b[0],s)
42		 + use(a[1],s)
43		 + use(b[1],s);
44}
45
46#endif