summaryrefslogtreecommitdiffstats
path: root/tests/hlsl/simple/allow-uav-conditional.hlsl
blob: c75e4228012207b5d3ac72dbadf353b344c1c896 (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
//TEST:COMPARE_HLSL: -profile cs_5_0
//TEST:COMPARE_HLSL: -profile cs_5_0 -verify-debug-serial-ir

// Check output for `[allow_uav_conditional]`

#ifndef __SLANG__
#define gBuffer gBuffer_0
#endif

RWStructuredBuffer<uint> gBuffer : register(u0);

[numthreads(16,1,1)]
void main(
	uint tid : SV_DispatchThreadID)
{
	uint index = tid;

	[allow_uav_condition]
	for(;;)
	{
		if(gBuffer[index] == 0)
			break;
		index = gBuffer[index];
		gBuffer[index]--;
	}
}