From bd66d4f90086eeff339f076f8cedfbf78e1989b6 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Fri, 30 Mar 2018 16:53:07 -0700 Subject: Fix several issues discovered by Falcor (#467) Fixes #466 Most of these are Vulkan-related regressions. * Kludge the definition of `GroupMemoryBarrierWithGroupSync()` for GLSL so that it works around parentheses that the emit logic now introduces. * Don't emit `static` for global constants when targetting GLSL * Emit the `flat` modifier for varying input/output with integer type, when targetting GLSL * Avoid checking parameter default-value expressions more than once, because this can crash when the checking introduces syntax that is not expected to appear in the input AST --- source/slang/check.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'source/slang/check.cpp') diff --git a/source/slang/check.cpp b/source/slang/check.cpp index b1df71428..eb15d0889 100644 --- a/source/slang/check.cpp +++ b/source/slang/check.cpp @@ -511,7 +511,11 @@ namespace Slang // Use visitor pattern to dispatch to correct case DeclVisitor::dispatch(decl); - decl->SetCheckState(state); + + if(state > decl->checkState) + { + decl->SetCheckState(state); + } } void EnusreAllDeclsRec(RefPtr decl) @@ -2839,6 +2843,8 @@ namespace Slang paramDecl->type = typeExpr; } + paramDecl->SetCheckState(DeclCheckState::CheckedHeader); + // The "initializer" expression for a parameter represents // a default argument value to use if an explicit one is // not supplied. @@ -2857,6 +2863,8 @@ namespace Slang // to other parameters of the same function (or maybe // only the parameters to its left...). } + + paramDecl->SetCheckState(DeclCheckState::Checked); } void VisitFunctionDeclaration(FuncDecl *functionNode) @@ -2870,7 +2878,7 @@ namespace Slang HashSet paraNames; for (auto & para : functionNode->GetParameters()) { - checkDecl(para); + EnsureDecl(para, DeclCheckState::CheckedHeader); if (paraNames.Contains(para->getName())) { -- cgit v1.2.3