summaryrefslogtreecommitdiff
path: root/tests/bugs/uav-write-index.hlsl
blob: 667c73e895f327f40a42c8682c3582c0037fbad7 (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
//TEST:COMPARE_HLSL: -profile cs_5_0 -target dxbc-assembly -no-checking

// Make sure we handle complex UAV write patterns

// Force import of Slang to ensure that some
// checking takes place:
#ifdef __SLANG__
__import empty;
#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);
}