yum-mirror/slang

Making it easier to work with shaders

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

Tim FoleyRework command-line options handling for entry points and targets (#697)725985528

master
946 B42 linesraw
1//SLANG_TEST_OPTS:-profile ps_5_0 -entry main
2
3// Confirm that resources inside `struct` types work reasonably well,
4
5#ifdef __SLANG__
6#define R(X) /**/
7#else
8#define R(X) X
9#endif
10
11float4 use(float  val) { return val; };
12float4 use(float2 val) { return float4(val,0.0,0.0); };
13float4 use(float3 val) { return float4(val,0.0); };
14float4 use(float4 val) { return val; };
15float4 use(Texture2D t, SamplerState s) { return t.Sample(s, 0.0); }
16float4 use(Texture2D t, SamplerComparisonState s) { return t.SampleCmp(s, 0.0, 0.0); }
17
18struct FooData
19{
20	float4 f;
21	Texture2D t;
22	SamplerState s;
23	SamplerComparisonState c;	
24};
25
26cbuffer CA R(: register(b0))
27{
28	FooData foo  R(: register(c0) : register(t0) : register(s0));
29};
30
31Texture2D t R(: register(t1));
32SamplerState s R(: register(s2));
33
34float4 main() : SV_Target
35{
36	// Go ahead and use everything in this case:
37	return use(foo.t,  foo.s)
38	    +  use(foo.t,  foo.c)
39		+  use(t, s)
40		+  use(foo.f)
41		;
42}