blob: da390e275991ba82d8a4ef31d4d45e39778bbe41 (
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
43
44
|
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-mtl -output-using-type
// CHECK: 1
// CHECK-NEXT: 1
// CHECK-NEXT: 1
// CHECK-NEXT: 1
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<uint> outputBuffer;
struct S {
int foo : 8;
int bar : 24;
};
// This packs the smaller int into the int64
struct T {
int64_t foo : 33;
int bar : 24;
};
// This takes two ints to store all the bits
struct P {
int foo : 24;
int bar : 24;
};
// Even though the smaller field comes first, it's still packed with the larger
// one
struct Q {
int8_t foo : 1;
int64_t bar : 63;
};
[numthreads(1, 1, 1)]
void computeMain()
{
outputBuffer[0] = sizeof(S) == sizeof(int);
outputBuffer[1] = sizeof(T) == sizeof(int64_t);
outputBuffer[2] = sizeof(P) == sizeof(int) * 2;
outputBuffer[3] = sizeof(Q) == sizeof(int64_t);
}
|