summaryrefslogtreecommitdiff
path: root/src/plugins/glsleditor
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2010-11-26 15:58:17 +0100
committerRoberto Raggi <roberto.raggi@nokia.com>2010-11-26 15:58:51 +0100
commitad25ec2d94caf4c58aa4bb51b5e63c64ab4122b7 (patch)
tree93192154ac700f840f29466c972e79d3fc9ec95f /src/plugins/glsleditor
parent72e04e6501179e943851e8784b549787f29962cb (diff)
downloadqt-creator-ad25ec2d94caf4c58aa4bb51b5e63c64ab4122b7.tar.gz
Set up the GLSL variant.
Diffstat (limited to 'src/plugins/glsleditor')
-rw-r--r--src/plugins/glsleditor/glsleditor.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/plugins/glsleditor/glsleditor.cpp b/src/plugins/glsleditor/glsleditor.cpp
index bd782cca0b..4eb6172591 100644
--- a/src/plugins/glsleditor/glsleditor.cpp
+++ b/src/plugins/glsleditor/glsleditor.cpp
@@ -261,9 +261,12 @@ void GLSLTextEditor::updateDocumentNow()
{
m_updateDocumentTimer->stop();
- const int variant = Lexer::Variant_GLSL_Qt | // ### hardcoded
- Lexer::Variant_VertexShader |
- Lexer::Variant_FragmentShader;
+ int variant = Lexer::Variant_GLSL_Qt; // ### hardcoded
+
+ if (isVertexShader())
+ variant |= Lexer::Variant_VertexShader;
+ if (isFragmentShader())
+ variant |= Lexer::Variant_FragmentShader;
const QString contents = toPlainText(); // get the code from the editor
const QByteArray preprocessedCode = contents.toLatin1(); // ### use the QtCreator C++ preprocessor.
@@ -276,9 +279,9 @@ void GLSLTextEditor::updateDocumentNow()
Semantic sem;
Scope *globalScope = engine.newNamespace();
sem.translationUnit(plugin->shaderInit()->ast, globalScope, plugin->shaderInit()->engine);
- if (isVertexShader())
+ if (variant & Lexer::Variant_VertexShader)
sem.translationUnit(plugin->vertexShaderInit()->ast, globalScope, plugin->vertexShaderInit()->engine);
- if (isFragmentShader())
+ if (variant & Lexer::Variant_FragmentShader)
sem.translationUnit(plugin->fragmentShaderInit()->ast, globalScope, plugin->fragmentShaderInit()->engine);
sem.translationUnit(ast, globalScope, &engine);