summaryrefslogtreecommitdiffstats
path: root/tests/bugs/inlining/global-const-inline.slang
blob: 629031e87bb74b9f8b61b877d4dd7172472c7a49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
//TEST(compute,vulkan):COMPARE_COMPUTE_EX:-vk -slang -compute -shaderobj

static const float3 CONSTANT = float3(16);

int test(int value)
{
    return value*int(CONSTANT.x) + value;
}

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

[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
    let index = int(dispatchThreadID.x);
    let value = test(index);
    outputBuffer[index] = value;
}