blob: 527556cab2267e25804d188359e876c955e4bacd (
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
33
34
35
36
37
38
39
40
41
42
|
//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj
// No support for int64_t on D3D11 (no sm 6.0)
//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
// No support with Dx12 with dxbc. Needs SM6.0 + dxil
//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -shaderobj
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -profile cs_6_0 -dx12 -shaderobj -render-feature hardware-device
//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -render-feature int64
//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -shaderobj
//TEST(compute, metal):COMPARE_COMPUTE_EX:-slang -compute -mtl
//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)
{
int64_t idx = int64_t(dispatchThreadID.x);
int64_t ti =0;
ti += max(2, idx);
ti += min(idx, 1);
ti += abs(idx - 2);
ti += clamp(idx * 10, 11, 23);
// Math
ti = ti - idx;
ti = ti + (ti % (idx + 5));
ti = ti + (ti / (idx + 20));
// Logical ops
ti = ti | idx;
ti = ti ^ (idx & (idx + 1));
// Shift
ti = ti + (idx >> 1);
ti = ti + (idx << 2);
int64_t v = (ti * 0x400010035435435ll) / 3ll + 7ll - 9ll;
outputBuffer[uint(idx)] = int(v) ^ int(((v >> 32) & 0xffffffff));
}
|