summaryrefslogtreecommitdiffstats
path: root/tests/bugs/uav-write-index.hlsl
blob: 7dac172fa90a1af6820e0c6d0d2fbedc5f01913c (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
//TEST:COMPARE_HLSL: -profile cs_5_0

// Make sure we handle complex UAV write patterns

// Force import of Slang to ensure that some
// checking takes place:
#ifdef __SLANG__
__import empty;
#else

#define Bar Bar_0
#define bar bar_0
#define gUAV gUAV_0
#define gUAV2 gUAV2_0

#endif

struct Bar
{
	uint bar;
};

RWStructuredBuffer<Bar> gUAV : register(u0);

void foo(RWTexture1D<float2> uav)
{
	uint index = gUAV.IncrementCounter();
	gUAV[index].bar = 1;
	uav[index] = float2(0,0);
}

RWTexture1D<float2> gUAV2 : register(u1);

[numthreads(1,1,1)]
void main()
{
	foo(gUAV2);
}