Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tools/clang/lib/AST/HlslTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ bool IsHLSLNumericOrAggregateOfNumericType(clang::QualType type) {
} else if (type->isArrayType()) {
return IsHLSLNumericOrAggregateOfNumericType(
QualType(type->getArrayElementTypeNoTypeQual(), 0));
} else if (type->isEnumeralType()) {
return true;
}

// Chars can only appear as part of strings, which we don't consider numeric.
Expand Down
31 changes: 31 additions & 0 deletions tools/clang/test/CodeGenSPIRV/enum_sizeof.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// RUN: %dxc -T cs_6_0 -E main -fcgl %s -spirv | FileCheck %s

enum E1 : uint64_t
{
v1 = 0,
};

enum E2 : uint32_t
{
v2 = 0,
};

struct S {
E1 e1;
E2 e2;
};

RWBuffer<int> b;

[numthreads(128, 1, 1)]
void main()
{
// CHECK: OpImageWrite {{%.*}} %uint_0 %int_8 None
b[0] = sizeof(E1);

// CHECK: OpImageWrite {{%.*}} %uint_1 %int_4 None
b[1] = sizeof(E2);

// CHECK: OpImageWrite {{%.*}} %uint_2 %int_16 None
b[2] = sizeof(S);
}