summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-parameter-binding.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-08-04 15:47:39 -0700
committerGitHub <noreply@github.com>2023-08-04 15:47:39 -0700
commita2d90fb275962da84611160f8ddd74d934a68dbd (patch)
tree066084537b9f4fe1f367de100ed6638a88a028c1 /source/slang/slang-parameter-binding.cpp
parent17da4f0dec2b86ba3a4bdaf8a2ae112047d23623 (diff)
Redesign `DeclRef` and systematic `Val` deduplication (#3049)
* Redesign DeclRef + Deduplicate Val. * Update project files * Fix warning. * Fix. * Fix. * Remove `Val::_equalsImplOverride`. * Rmove `Val::_getHashCodeOverride`. * Remove `semanticVisitor` param from `resolve`. * Cleanups. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-parameter-binding.cpp')
-rw-r--r--source/slang/slang-parameter-binding.cpp24
1 files changed, 4 insertions, 20 deletions
diff --git a/source/slang/slang-parameter-binding.cpp b/source/slang/slang-parameter-binding.cpp
index 47f370854..c0389d1cd 100644
--- a/source/slang/slang-parameter-binding.cpp
+++ b/source/slang/slang-parameter-binding.cpp
@@ -2064,7 +2064,7 @@ static RefPtr<TypeLayout> processEntryPointVaryingParameter(
// otherwise they will include all of the above cases...
else if( auto declRefType = as<DeclRefType>(type) )
{
- auto declRef = declRefType->declRef;
+ auto declRef = declRefType->getDeclRef();
if (auto structDeclRef = declRef.as<StructDecl>())
{
@@ -2777,7 +2777,7 @@ static RefPtr<EntryPointLayout> collectEntryPointParameters(
// Any generic specialization applied to the entry-point function
// must also be applied to its parameters.
- paramDeclRef = context->getASTBuilder()->getSpecializedDeclRef(paramDeclRef.getDecl(), entryPointFuncDeclRef.getSubst());
+ paramDeclRef = context->getASTBuilder()->getMemberDeclRef(entryPointFuncDeclRef, paramDeclRef.getDecl());
// When computing layout for an entry-point parameter,
// we want to make sure that the layout context has access
@@ -3033,24 +3033,6 @@ struct CollectParametersVisitor : ComponentTypeVisitor
// along.
//
visitChildren(specialized);
-
- // While we are at it, we will also make note of any
- // tagged-union types that were used as part of the
- // specialization arguments, since we need to make
- // sure that their layout information is computed
- // and made available for IR code generation.
- //
- // Note: this isn't really the best place for this logic to sit,
- // but it is the simplest place where we can collect all the tagged
- // union types that get referenced by a program.
- //
- for( auto taggedUnionType : specialized->getTaggedUnionTypes() )
- {
- SLANG_ASSERT(taggedUnionType);
- auto substType = taggedUnionType;
- auto typeLayout = createTypeLayout(m_context->layoutContext, substType);
- m_context->shared->programLayout->taggedUnionTypeLayouts.add(typeLayout);
- }
}
@@ -3755,6 +3737,8 @@ RefPtr<ProgramLayout> generateParameterBindings(
TargetProgram* targetProgram,
DiagnosticSink* sink)
{
+ SLANG_AST_BUILDER_RAII(targetProgram->getProgram()->getLinkage()->getASTBuilder());
+
auto program = targetProgram->getProgram();
auto targetReq = targetProgram->getTargetReq();