summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-check-decl.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-01-27 18:17:16 -0800
committerGitHub <noreply@github.com>2025-01-27 18:17:16 -0800
commitf030a5ab62235152055fe8a616dd6d0d7ba1c275 (patch)
treee4851bd271a04feaa8c3dc9eeb228d3550b9b56e /source/slang/slang-check-decl.cpp
parentda3dc98f96cc7be2accb5c6f86aa6f6e5502bada (diff)
Properly plumbing layout for global varyings. (#6198)
* Properly plumbing layout for global varyings. * Fix test.
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
-rw-r--r--source/slang/slang-check-decl.cpp39
1 files changed, 21 insertions, 18 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp
index 3453d0538..33319ca8f 100644
--- a/source/slang/slang-check-decl.cpp
+++ b/source/slang/slang-check-decl.cpp
@@ -842,26 +842,29 @@ bool isGlobalShaderParameter(VarDeclBase* decl)
if (!isGlobalDecl(decl))
return false;
- // A global variable marked `static` indicates a traditional
- // global variable (albeit one that is implicitly local to
- // the translation unit)
- //
- if (decl->hasModifier<HLSLStaticModifier>())
- return false;
+ for (auto modifier : decl->modifiers)
+ {
+ // A global variable marked `static` indicates a traditional
+ // global variable (albeit one that is implicitly local to
+ // the translation unit)
+ //
+ if (as<HLSLStaticModifier>(modifier))
+ return false;
- // While not normally allowed, out variables are not constant
- // parameters, this can happen for example in GLSL mode
- if (decl->hasModifier<OutModifier>())
- return false;
- if (decl->hasModifier<InModifier>())
- return false;
+ // While not normally allowed, out variables are not constant
+ // parameters, this can happen for example in GLSL mode
+ if (as<OutModifier>(modifier))
+ return false;
+ if (as<InModifier>(modifier))
+ return false;
- // The `groupshared` modifier indicates that a variable cannot
- // be a shader parameters, but is instead transient storage
- // allocated for the duration of a thread-group's execution.
- //
- if (decl->hasModifier<HLSLGroupSharedModifier>())
- return false;
+ // The `groupshared` modifier indicates that a variable cannot
+ // be a shader parameters, but is instead transient storage
+ // allocated for the duration of a thread-group's execution.
+ //
+ if (as<HLSLGroupSharedModifier>(modifier))
+ return false;
+ }
return true;
}