summaryrefslogtreecommitdiffstats
path: root/tests/bindings/targets-and-uavs-structure.hlsl
blob: 7f5ca2b80d12cb529c8802aa77a8a99345dcf28a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//TEST(smoke):COMPARE_HLSL: -profile ps_5_0 -entry main

// Handle the case where the fragment shader output is
// defined a structure, and the semantics are on the sub-fields

#ifdef __SLANG__
#define R(X) /**/
#else
#define R(X) X

#define Foo Foo_0
#define v v_0
#define fooBuffer fooBuffer_0

#endif

float4 use(float  val) { return val; };
float4 use(float2 val) { return float4(val,0.0,0.0); };
float4 use(float3 val) { return float4(val,0.0); };
float4 use(float4 val) { return val; };
float4 use(Texture2D t, SamplerState s) { return t.Sample(s, 0.0); }

struct Foo { float2 v; };

// This should be allocated a register *after* the render targets
RWStructuredBuffer<Foo> fooBuffer R(: register(u2));

struct Fragment
{
	float4 color : SV_Target0;
	float4 extra : SV_Target1;
	
};

Fragment main()
{
	Fragment output;
	output.color = use(fooBuffer[42].v);
	output.extra = use(fooBuffer[999].v);
	return output;
}