File tree Expand file tree Collapse file tree 3 files changed +64
-0
lines changed Expand file tree Collapse file tree 3 files changed +64
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,8 @@ bool IsHLSLNumericOrAggregateOfNumericType(clang::QualType type) {
95
95
} else if (type->isArrayType ()) {
96
96
return IsHLSLNumericOrAggregateOfNumericType (
97
97
QualType (type->getArrayElementTypeNoTypeQual (), 0 ));
98
+ } else if (type->isEnumeralType ()) {
99
+ return true ;
98
100
}
99
101
100
102
// Chars can only appear as part of strings, which we don't consider numeric.
Original file line number Diff line number Diff line change
1
+ // RUN: %dxc -T cs_6_0 -E main -fcgl %s -spirv | FileCheck %s
2
+
3
+ enum E1 : uint64_t
4
+ {
5
+ v1 = 0 ,
6
+ };
7
+
8
+ enum E2 : uint32_t
9
+ {
10
+ v2 = 0 ,
11
+ };
12
+
13
+ struct S {
14
+ E1 e1;
15
+ E2 e2;
16
+ };
17
+
18
+ RWBuffer <int > b;
19
+
20
+ [numthreads (128 , 1 , 1 )]
21
+ void main ()
22
+ {
23
+ // CHECK: OpImageWrite {{%.*}} %uint_0 %int_8 None
24
+ b[0 ] = sizeof (E1);
25
+
26
+ // CHECK: OpImageWrite {{%.*}} %uint_1 %int_4 None
27
+ b[1 ] = sizeof (E2);
28
+
29
+ // CHECK: OpImageWrite {{%.*}} %uint_2 %int_16 None
30
+ b[2 ] = sizeof (S);
31
+ }
Original file line number Diff line number Diff line change
1
+ // RUN: %dxc -T cs_6_9 -E main %s -ast-dump-implicit | FileCheck %s --check-prefix AST
2
+
3
+ enum E1 : uint64_t
4
+ {
5
+ v1 = 0 ,
6
+ };
7
+
8
+ enum E2 : uint32_t
9
+ {
10
+ v2 = 0 ,
11
+ };
12
+
13
+ struct S {
14
+ E1 e1;
15
+ E2 e2;
16
+ };
17
+
18
+ RWBuffer <int > b;
19
+
20
+ [numthreads (128 , 1 , 1 )]
21
+ void main ()
22
+ {
23
+ // AST: UnaryExprOrTypeTraitExpr {{.*}} 'unsigned long' sizeof 'E1'
24
+ b[0 ] = sizeof (E1);
25
+
26
+ // AST: UnaryExprOrTypeTraitExpr {{.*}} 'unsigned long' sizeof 'E2'
27
+ b[1 ] = sizeof (E2);
28
+
29
+ // AST: UnaryExprOrTypeTraitExpr {{.*}} 'unsigned long' sizeof 'S'
30
+ b[2 ] = sizeof (S);
31
+ }
You can’t perform that action at this time.
0 commit comments