summaryrefslogtreecommitdiffstats
path: root/source/slang/check.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2018-03-30 16:53:07 -0700
committerGitHub <noreply@github.com>2018-03-30 16:53:07 -0700
commitbd66d4f90086eeff339f076f8cedfbf78e1989b6 (patch)
tree4fe943e2bc47015ea39444fb025e7b2f533dcac8 /source/slang/check.cpp
parent87c50cf1644454cdc9e7f6d1262bee29bfc86e80 (diff)
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
Diffstat (limited to 'source/slang/check.cpp')
-rw-r--r--source/slang/check.cpp12
1 files changed, 10 insertions, 2 deletions
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> 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<Name*> paraNames;
for (auto & para : functionNode->GetParameters())
{
- checkDecl(para);
+ EnsureDecl(para, DeclCheckState::CheckedHeader);
if (paraNames.Contains(para->getName()))
{