diff options
| author | Yong He <yonghe@outlook.com> | 2023-07-27 16:58:32 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-27 16:58:32 -0700 |
| commit | 8bfdc39259d0a401a33d3be69b22c8dd9b576683 (patch) | |
| tree | 44fd5af8ab348aca24b5100508371d10b8b41865 /source/slang/slang-ast-builder.cpp | |
| parent | 04f72443d717ca7b8304f893452c471fc6b6dc8f (diff) | |
Fix push constant on global variables. (#3034)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ast-builder.cpp')
| -rw-r--r-- | source/slang/slang-ast-builder.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/slang/slang-ast-builder.cpp b/source/slang/slang-ast-builder.cpp index 72cb647d5..64a7abd8c 100644 --- a/source/slang/slang-ast-builder.cpp +++ b/source/slang/slang-ast-builder.cpp @@ -304,6 +304,19 @@ ArrayExpressionType* ASTBuilder::getArrayType(Type* elementType, IntVal* element return result; } +ConstantBufferType* ASTBuilder::getConstantBufferType(Type* elementType) +{ + auto result = getOrCreate<ConstantBufferType>(elementType); + if (!result->declRef.getDecl()) + { + auto genericDecl = as<GenericDecl>(m_sharedASTBuilder->findMagicDecl("ConstantBuffer")); + auto typeDecl = genericDecl->inner; + auto substitutions = getOrCreateGenericSubstitution(nullptr, genericDecl, elementType); + result->declRef = getSpecializedDeclRef<Decl>(typeDecl, substitutions); + } + return result; +} + VectorExpressionType* ASTBuilder::getVectorType( Type* elementType, IntVal* elementCount) |
