1
- // TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj
2
- // TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
3
- // TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -use-dxil -shaderobj
4
- // TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj
5
- // TEST(compute, vulkan):COMPARE_COMPUTE_EX:-cuda -compute -shaderobj
1
+ // TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj -output-using-type
2
+ // TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -use-dxil -shaderobj -output-using-type
3
+ // TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type
4
+ // TEST(compute, vulkan):COMPARE_COMPUTE_EX:-cuda -compute -shaderobj -output-using-type
5
+
6
+ // No 16-bit and 64-bit integer support on DX11.
7
+ // TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type -xslang -DDX11
8
+
9
+ // TEST(compute, vulkan):SIMPLE(filecheck=CHECK_SPV): -stage compute -entry computeMain -target spirv
6
10
7
11
// TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
8
12
RWStructuredBuffer < int > outputBuffer;
9
13
10
14
[numthreads(1 , 1 , 1 )]
11
15
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
12
16
{
13
- int idx = int (dispatchThreadID .x );
17
+ int index = int (dispatchThreadID .x );
18
+ uint outIndex = 0 ;
14
19
15
- float tmp = dot(float3(idx), float3(1 ));
16
-
17
- int3 a = { idx + 1 , idx + 2 , idx + 3 };
20
+ // CHECK_SPV: OpSDot
21
+ int3 a = { index - 1 , index - 2 , index - 3 };
18
22
int3 b = { 1 , 2 , 3 };
23
+ outputBuffer [outIndex++ ] = dot(a, b);
24
+
25
+ // CHECK_SPV: OpUDot
26
+ uint3 c = { index + 1 , index + 2 , index + 3 };
27
+ uint3 d = { 2 , 4 , 6 };
28
+ outputBuffer [outIndex++ ] = int (dot(c, d));
19
29
20
- int result = dot(a, b);
30
+ #if ! defined (DX11 )
31
+ // CHECK_SPV: OpUDot
32
+ uint64_t2 e = { index + 1 , index + 2 };
33
+ uint64_t2 f = { 4 , 8 };
34
+ outputBuffer [outIndex++ ] = int (dot(e, f));
21
35
22
- outputBuffer [idx] = result;
23
- }
36
+ // CHECK_SPV: OpSDot
37
+ int16_t4 g = { int16_t(index + 1 ), int16_t(index + 2 ), int16_t(index + 3 ), int16_t(index + 4 )};
38
+ int16_t4 h = { - 1 , 2 , 2 , - 1 };
39
+ outputBuffer [outIndex++ ] = int (dot(g, h));
40
+ #else
41
+ outputBuffer [outIndex++ ] = 20 ;
42
+ outputBuffer [outIndex++ ] = 5 ;
43
+ #endif
44
+ }
0 commit comments