From fdf061e278720ec066a1fac8f1f35a22e817bf2d Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 21 Nov 2024 14:07:23 -0800 Subject: Add datalayout for constant buffers. (#5608) * Add datalayout for constant buffers. * Fixes. * Fix test. * Fix glsl codegen. * Update spirv-specific doc. * Fix test. * Fix binding in the presense of specialization constants. * address comments. * Add a test for constant buffer layout. --- source/slang/slang-check-type.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/slang/slang-check-type.cpp') diff --git a/source/slang/slang-check-type.cpp b/source/slang/slang-check-type.cpp index 34f16751b..d9691a828 100644 --- a/source/slang/slang-check-type.cpp +++ b/source/slang/slang-check-type.cpp @@ -101,6 +101,13 @@ Type* SemanticsVisitor::getRemovedModifierType(ModifiedType* modifiedType, Modif return m_astBuilder->getModifiedType(modifiedType->getBase(), newModifiers); } +Type* SemanticsVisitor::getConstantBufferType(Type* elementType, Type* layoutType) +{ + auto iBufferDataLayoutType = m_astBuilder->getSharedASTBuilder()->getIBufferDataLayoutType(); + auto witness = isSubtype(layoutType, iBufferDataLayoutType, IsSubTypeOptions()); + return m_astBuilder->getConstantBufferType(elementType, layoutType, witness); +} + Expr* SemanticsVisitor::ExpectATypeRepr(Expr* expr) { if (auto overloadedExpr = as(expr)) -- cgit v1.2.3