diff options
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
| -rw-r--r-- | source/slang/slang-check-decl.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index 2d009c28c..b1dd2d533 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -1300,6 +1300,21 @@ namespace Slang addModifier(varDecl, m_astBuilder->getOrCreate<NoDiffModifier>()); } } + + + if (as<NamespaceDeclBase>(varDecl->parentDecl)) + { + // If this is a global variable with [vk::push_constant] attribute, + // we need to make sure to wrap it in a `ConstantBuffer`. + + if (!as<ConstantBufferType>(varDecl->type)) + { + if (varDecl->findModifier<PushConstantAttribute>()) + { + varDecl->type.type = m_astBuilder->getConstantBufferType(varDecl->type); + } + } + } } void SemanticsDeclHeaderVisitor::visitStructDecl(StructDecl* structDecl) |
