summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-check-decl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
-rw-r--r--source/slang/slang-check-decl.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp
index ad3f506a6..5054b00bc 100644
--- a/source/slang/slang-check-decl.cpp
+++ b/source/slang/slang-check-decl.cpp
@@ -234,9 +234,10 @@ namespace Slang
/// Is `decl` a global shader parameter declaration?
bool isGlobalShaderParameter(VarDeclBase* decl)
{
- // A global shader parameter must be declared at global (module) scope.
+ // A global shader parameter must be declared at global or namespace
+ // scope, so that it has a single definition across the module.
//
- if(!as<ModuleDecl>(decl->ParentDecl)) return false;
+ if(!as<NamespaceDeclBase>(decl->ParentDecl)) return false;
// A global variable marked `static` indicates a traditional
// global variable (albeit one that is implicitly local to
@@ -408,6 +409,11 @@ namespace Slang
auto type = GetSup(constraintDeclRef);
return QualType(type);
}
+ else if( auto namespaceDeclRef = declRef.as<NamespaceDeclBase>())
+ {
+ auto type = getNamespaceType(session, namespaceDeclRef);
+ return QualType(type);
+ }
if( sink )
{
// The compiler is trying to form a reference to a declaration