summaryrefslogtreecommitdiff
path: root/tests/compute/rewriter.hlsl
blob: 35a630c6212153c2a2003b8dfd5e2fb9d7eb8dd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//TEST(compute):HLSL_COMPUTE:-xslang -no-checking -xslang -use-ir
//TEST_INPUT:ubuffer(data=[0 1 2 3], stride=4):dxbinding(0),glbinding(0),out

// Test that we can use Slang libraries that require IR cross-compilation
// (e.g., libraries that use generics) while writing the main code in
// vanilla HLSL/GLSL without checking enabled.

import rewriter;

RWStructuredBuffer<int> outputBuffer : register(u0);

[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
	uint tid = dispatchThreadID.x;
	int inVal = outputBuffer[tid];
	int outVal = test(inVal);
	outputBuffer[tid] = outVal;
}