From f030a5ab62235152055fe8a616dd6d0d7ba1c275 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 27 Jan 2025 18:17:16 -0800 Subject: Properly plumbing layout for global varyings. (#6198) * Properly plumbing layout for global varyings. * Fix test. --- source/slang/slang-check-decl.cpp | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'source/slang/slang-check-decl.cpp') 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()) - 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(modifier)) + return false; - // While not normally allowed, out variables are not constant - // parameters, this can happen for example in GLSL mode - if (decl->hasModifier()) - return false; - if (decl->hasModifier()) - return false; + // While not normally allowed, out variables are not constant + // parameters, this can happen for example in GLSL mode + if (as(modifier)) + return false; + if (as(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()) - 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(modifier)) + return false; + } return true; } -- cgit v1.2.3