diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2010-11-26 15:00:46 +0100 |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2010-11-26 15:15:42 +0100 |
commit | 1bf87c67aa5d79ef0c4c8004107f4c94003eff6c (patch) | |
tree | 96bad4dce5b1b83d81f05db4b48236b3b0ea641b /src/libs/glsl/glslsemantic.cpp | |
parent | 6b3016875018d7baeaa11b014fed0482e20d335c (diff) | |
download | qt-creator-1bf87c67aa5d79ef0c4c8004107f4c94003eff6c.tar.gz |
Initialize the shaders
Diffstat (limited to 'src/libs/glsl/glslsemantic.cpp')
-rw-r--r-- | src/libs/glsl/glslsemantic.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/libs/glsl/glslsemantic.cpp b/src/libs/glsl/glslsemantic.cpp index ea4e81c60b..1be3c486a7 100644 --- a/src/libs/glsl/glslsemantic.cpp +++ b/src/libs/glsl/glslsemantic.cpp @@ -36,8 +36,8 @@ using namespace GLSL; -Semantic::Semantic(Engine *engine) - : _engine(engine) +Semantic::Semantic() + : _engine(0) , _scope(0) , _type(0) { @@ -47,6 +47,13 @@ Semantic::~Semantic() { } +Engine *Semantic::switchEngine(Engine *engine) +{ + Engine *previousEngine = _engine; + _engine = engine; + return previousEngine; +} + Scope *Semantic::switchScope(Scope *scope) { Scope *previousScope = _scope; @@ -82,9 +89,9 @@ void Semantic::declaration(DeclarationAST *ast) accept(ast); } -Scope *Semantic::translationUnit(TranslationUnitAST *ast) +void Semantic::translationUnit(TranslationUnitAST *ast, Scope *globalScope, Engine *engine) { - Namespace *globalScope = _engine->newNamespace(); + Engine *previousEngine = switchEngine(engine); Scope *previousScope = switchScope(globalScope); if (ast) { for (List<DeclarationAST *> *it = ast->declarations; it; it = it->next) { @@ -92,7 +99,8 @@ Scope *Semantic::translationUnit(TranslationUnitAST *ast) declaration(decl); } } - return switchScope(previousScope); + (void) switchScope(previousScope); + (void) switchEngine(previousEngine); } Semantic::ExprResult Semantic::functionIdentifier(FunctionIdentifierAST *ast) @@ -106,7 +114,7 @@ Semantic::ExprResult Semantic::functionIdentifier(FunctionIdentifierAST *ast) else _engine->error(ast->lineno, QString("`%1' cannot be used as a function").arg(*ast->name)); } else { - // ### _engine->error(ast->lineno, QString("`%1' was not declared in this scope").arg(*ast->name)); + _engine->error(ast->lineno, QString("`%1' was not declared in this scope").arg(*ast->name)); } } else if (ast->type) { const Type *ty = type(ast->type); |