summaryrefslogtreecommitdiffstats
path: root/tests/compute/modern-syntax.slang
blob: 8d075e66b4a405b03cec4820f1cab4728e916d9e (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
// modern-syntax.slang
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
//TEST(compute):COMPARE_COMPUTE_EX:-cpu -slang -compute -shaderobj

// This file exists to confirm that declarations using "modern"
// syntax are handled correctly by the compiler front-end.

typealias MyInt = int;

func test(val: MyInt) -> MyInt
{
	var tmp = val;
	let c : MyInt = 16;
	tmp += c;
	return tmp;
}

//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<int> outputBuffer;

[numthreads(4, 1, 1)]
void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
{
	int tid = dispatchThreadID.x;
	int val = test(tid);
	outputBuffer[tid] = val;
}