blob: 3360fed3ba66751853dcdc17b614b55dccd185a9 (
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
|
//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12
//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute
//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -render-features half
//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer
RWStructuredBuffer<uint> outputBuffer;
[numthreads(8, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
int idx = int(dispatchThreadID.x);
// We want to test 0
float value = 0.0f;
// Produces some somewhat interesting numbers
if (idx != 0)
{
value = (3 << idx);
if ((idx & 1) != 0)
{
value = -value;
}
// Do the recip
if ((idx & 4) != 0)
{
value = 1.0f / value;
}
}
uint r = f32tof16(value);
outputBuffer[idx] = r;
}
|