summaryrefslogtreecommitdiffstats
path: root/tests/compute/byte-address-buffer-64bit.slang
blob: ab3c82e4b1e4a1503ccc9323475090529e9e508a (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
28
29
30
31
32
// byte-address-buffer.slang

//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj
//TEST(compute):COMPARE_COMPUTE_EX:-d3d12 -compute -shaderobj -profile cs_6_0
//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj

//TEST_INPUT:ubuffer(data=[0 1 2 3]):name=inputBuffer
RWByteAddressBuffer inputBuffer;

//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0]):out,name=outputBuffer
RWByteAddressBuffer outputBuffer;

void testInt64(uint val)
{
    // Load a 32-bit value from the input buffer
    uint tmp = inputBuffer.Load(uint(val * 4));

    // Cast to uint64_t
    uint64_t tmp64 = uint64_t(tmp) + 1;

    // Store the result back as uint64_t
    outputBuffer.Store(uint(val * 8), tmp64);
}

[numthreads(4, 1, 1)]
[shader("compute")]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
    uint tid = dispatchThreadID.x;

    testInt64(tid);
}