Răsfoiți Sursa

[spirv] Skip all TypeDecls when calculating memory layouts (#1179)

Lei Zhang 7 ani în urmă
părinte
comite
31b29d89c0

+ 3 - 2
tools/clang/lib/SPIRV/TypeTranslator.cpp

@@ -1122,9 +1122,10 @@ TypeTranslator::getCapabilityForStorageImageReadWrite(QualType type) {
 
 bool TypeTranslator::shouldSkipInStructLayout(const Decl *decl) {
   // Ignore implicit generated struct declarations/constructors/destructors
-  // Ignore embedded struct/union/class/enum/function decls
+  // Ignore embedded type decls
+  // Ignore embeded function decls
   // Ignore empty decls
-  if (decl->isImplicit() || isa<TagDecl>(decl) || isa<FunctionDecl>(decl) ||
+  if (decl->isImplicit() || isa<TypeDecl>(decl) || isa<FunctionDecl>(decl) ||
       isa<EmptyDecl>(decl))
     return true;
 

+ 2 - 0
tools/clang/test/CodeGenSPIRV/var.globals.hlsl

@@ -64,6 +64,8 @@ cbuffer MyCBuffer {                // Not included - 4
 ConstantBuffer<S>       gCBuffer;  // Not included - 5
 TextureBuffer<S>        gTBuffer;  // Not included - 6
 
+typedef SamplerState SamplerStateType;
+
 // CHECK: [[v2f_struct:%\w+]] = OpTypeStruct %v2float
 struct {
     float2 f;