summaryrefslogtreecommitdiff
path: root/tests/compute/static-const-array.slang
blob: 48c47bea14e29f2339d9d26df2f23aee88a019ab (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
// static-const-array.slang

//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj
//TEST(compute):COMPARE_COMPUTE_EX:-cpu -slang -compute -shaderobj
//DISABLE_TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl

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

static const int kArray[] = { 16, 1, 32, 2 };

int test(int val)
{
	return kArray[val];
}

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