X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fvalidate.cpp;h=ec322f4207751af90482893dc21dc4f4dce39e0a;hb=f4460c27a4d19ffb34017b92389420adad44d051;hp=ce30c2abdf44fe9156476e9eba145063c90fde43;hpb=e9a898f315b5d1396f196d785913a283c30940f2;p=libs%2Fgl.git diff --git a/source/glsl/validate.cpp b/source/glsl/validate.cpp index ce30c2ab..ec322f42 100644 --- a/source/glsl/validate.cpp +++ b/source/glsl/validate.cpp @@ -12,11 +12,6 @@ namespace Msp { namespace GL { namespace SL { -Validator::Validator(): - stage(0), - last_provoker(0) -{ } - void Validator::diagnose(Node &node, Node &provoking_node, Diagnostic::Severity severity, const string &message) { Diagnostic diag; @@ -39,13 +34,6 @@ void Validator::add_info(Node &node, const string &message) } -DeclarationValidator::DeclarationValidator(): - scope(GLOBAL), - iface_layout(0), - iface_block(0), - variable(0) -{ } - const char *DeclarationValidator::describe_variable(ScopeType scope) { switch(scope) @@ -266,8 +254,13 @@ void DeclarationValidator::visit(VariableDeclaration &var) } else if(kind==BasicTypeDeclaration::VOID) error(var, "Type 'void' not allowed on variable"); - else if(kind==BasicTypeDeclaration::BOOL && !var.interface.empty() && var.source!=BUILTIN_SOURCE) - error(var, "Type 'bool' not allowed on interface variable"); + else if(kind==BasicTypeDeclaration::BOOL && var.source!=BUILTIN_SOURCE) + { + if(scope==INTERFACE_BLOCK) + error(var, "Type 'bool' not allowed in an interface block"); + else if(!var.interface.empty()) + error(var, "Type 'bool' not allowed on interface variable"); + } if(var.init_expression) { @@ -305,10 +298,6 @@ void DeclarationValidator::visit(FunctionDeclaration &func) } -IdentifierValidator::IdentifierValidator(): - anonymous_block(false) -{ } - void IdentifierValidator::multiple_definition(const string &name, Statement &statement, Statement &previous) { error(statement, format("Multiple definition of %s", name)); @@ -506,11 +495,6 @@ void ReferenceValidator::visit(FunctionDeclaration &func) } -ExpressionValidator::ExpressionValidator(): - current_function(0), - constant_expression(false) -{ } - void ExpressionValidator::visit(VariableReference &var) { if(var.declaration && constant_expression && !var.declaration->constant) @@ -698,10 +682,6 @@ void ExpressionValidator::visit(Return &ret) } -FlowControlValidator::FlowControlValidator(): - reachable(true) -{ } - void FlowControlValidator::visit(Block &block) { for(const RefPtr &s: block.body)