summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-shader.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-03-11 14:42:14 -0700
committerGitHub <noreply@github.com>2024-03-11 14:42:14 -0700
commit1bbcf25af514a9ae24f7006747177f2d1b3b7c0d (patch)
treef42c17d32040d033742e741548e7b73ff24a5e92 /source/slang/slang-check-shader.cpp
parent25a7d51445e64253beca5c4f70ddd52f40226b1d (diff)
Link-time specialization fixes. (#3734)
* Fix method synthesis logic for static differentiable methods. * Support link-time constants in thread group size reflection.
Diffstat (limited to 'source/slang/slang-check-shader.cpp')
-rw-r--r--source/slang/slang-check-shader.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/source/slang/slang-check-shader.cpp b/source/slang/slang-check-shader.cpp
index 1aa93d019..c588a9018 100644
--- a/source/slang/slang-check-shader.cpp
+++ b/source/slang/slang-check-shader.cpp
@@ -1305,7 +1305,7 @@ namespace Slang
sink);
}
- Scope* ComponentType::_createScopeForLegacyLookup(ASTBuilder* astBuilder)
+ Scope* ComponentType::_getOrCreateScopeForLegacyLookup(ASTBuilder* astBuilder)
{
// The shape of this logic is dictated by the legacy
// behavior for name-based lookup/parsing of types
@@ -1316,6 +1316,8 @@ namespace Slang
// definitions (that scope is necessary because
// it defines keywords like `true` and `false`).
//
+ if (m_lookupScope)
+ return m_lookupScope;
Scope* scope = astBuilder->create<Scope>();
scope->parent = getLinkage()->getSessionImpl()->slangLanguageScope;
@@ -1338,7 +1340,7 @@ namespace Slang
scope->nextSibling = moduleScope;
}
}
-
+ m_lookupScope = scope;
return scope;
}
@@ -1359,7 +1361,7 @@ namespace Slang
// We create the scopes on the linkages ASTBuilder. We might want to create a temporary ASTBuilder,
// and let that memory get freed, but is like this because it's not clear if the scopes in ASTNode members
// will dangle if we do.
- Scope* scope = unspecialiedProgram->_createScopeForLegacyLookup(endToEndReq->getLinkage()->getASTBuilder());
+ Scope* scope = unspecialiedProgram->_getOrCreateScopeForLegacyLookup(endToEndReq->getLinkage()->getASTBuilder());
// We are going to do some semantic checking, so we need to
// set up a `SemanticsVistitor` that we can use.