X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fgenerate.cpp;h=9dff1e607ae40f6fd7019cdbac2f2338ff81de23;hb=a4cd67f1c9f1f375bacacfbb421d40f78a22644b;hp=a2fd3608220e836d268d2310ad1ec6c8915e4550;hpb=27e7b634d31498783ea6d24b72f02f3f1287851d;p=libs%2Fgl.git diff --git a/source/glsl/generate.cpp b/source/glsl/generate.cpp index a2fd3608..9dff1e60 100644 --- a/source/glsl/generate.cpp +++ b/source/glsl/generate.cpp @@ -219,6 +219,8 @@ bool VariableResolver::apply(Stage &s) s.interface_blocks.clear(); r_any_resolved = false; s.content.visit(*this); + for(vector::const_iterator i=redeclared_builtins.begin(); i!=redeclared_builtins.end(); ++i) + (*i)->source = GENERATED_SOURCE; NodeRemover().apply(s, nodes_to_remove); return r_any_resolved; } @@ -461,6 +463,12 @@ void VariableResolver::visit(VariableDeclaration &var) ptr = &var; else if(!current_block->parent && ptr->interface==var.interface && ptr->type==var.type) { + if(ptr->source==BUILTIN_SOURCE) + redeclared_builtins.push_back(&var); + else + stage->diagnostics.push_back(Diagnostic(Diagnostic::WARN, var.source, var.line, + format("Redeclaring non-builtin variable '%s' is deprecated", var.name))); + if(var.init_expression) ptr->init_expression = var.init_expression; if(var.layout) @@ -611,12 +619,6 @@ void ExpressionResolver::visit(Literal &literal) resolve(literal, find_type(BasicTypeDeclaration::FLOAT, 32), false); } -void ExpressionResolver::visit(ParenthesizedExpression &parexpr) -{ - TraversingVisitor::visit(parexpr); - resolve(parexpr, parexpr.expression->type, parexpr.expression->lvalue); -} - void ExpressionResolver::visit(VariableReference &var) { if(var.declaration) @@ -978,6 +980,15 @@ void FunctionResolver::visit(FunctionDeclaration &func) vector &decls = declarations[key]; if(func.definition==&func) { + if(stage_decl && stage_decl->definition) + { + if(!func.overrd) + stage->diagnostics.push_back(Diagnostic(Diagnostic::WARN, func.source, func.line, + format("Overriding function '%s' without the override keyword is deprecated", key))); + if(!stage_decl->definition->virtua) + stage->diagnostics.push_back(Diagnostic(Diagnostic::WARN, func.source, func.line, + format("Overriding function '%s' not declared as virtual is deprecated", key))); + } stage_decl = &func; // Set all previous declarations to use this definition. @@ -1216,7 +1227,8 @@ void InterfaceGenerator::visit(VariableDeclaration &var) } else if(var.interface=="in" && current_block==&stage->content) { - declared_inputs.push_back(&var); + if(var.name.compare(0, 3, "gl_")) + declared_inputs.push_back(&var); /* Try to link input variables in global scope with output variables from previous stage. */