aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorRhys Weatherley <[email protected]>2010-12-01 15:44:50 +1000
committerRhys Weatherley <[email protected]>2010-12-01 15:44:50 +1000
commite117f04fabde000f4c0aae7cc1a82c58da1ba4c3 (patch)
tree5f359f97cbb0f98892bc6c3265dda0dcb2cbe5de /src/libs
parentecf4baec663e5c2368056a6a79efa7078719026c (diff)
Show different icons for GLSL variable categories
Attributes, uniforms, varyings, and constants are shown with a distinguished icon that is different from regular variables.
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/glsl/glslengine.cpp3
-rw-r--r--src/libs/glsl/glslengine.h2
-rw-r--r--src/libs/glsl/glslsemantic.cpp6
-rw-r--r--src/libs/glsl/glslsymbols.cpp1
-rw-r--r--src/libs/glsl/glslsymbols.h4
5 files changed, 13 insertions, 3 deletions
diff --git a/src/libs/glsl/glslengine.cpp b/src/libs/glsl/glslengine.cpp
index 73938e947ea..2b6ec6e0391 100644
--- a/src/libs/glsl/glslengine.cpp
+++ b/src/libs/glsl/glslengine.cpp
@@ -266,11 +266,12 @@ Argument *Engine::newArgument(Function *function, const QString &name, const Typ
return a;
}
-Variable *Engine::newVariable(Scope *scope, const QString &name, const Type *type)
+Variable *Engine::newVariable(Scope *scope, const QString &name, const Type *type, int qualifiers)
{
Variable *var = new Variable(scope);
var->setName(name);
var->setType(type);
+ var->setQualifiers(qualifiers);
_symbols.append(var);
return var;
}
diff --git a/src/libs/glsl/glslengine.h b/src/libs/glsl/glslengine.h
index ab73debf9e7..2d668ba37f0 100644
--- a/src/libs/glsl/glslengine.h
+++ b/src/libs/glsl/glslengine.h
@@ -120,7 +120,7 @@ public:
Block *newBlock(Scope *scope = 0);
Function *newFunction(Scope *scope = 0);
Argument *newArgument(Function *function, const QString &name, const Type *type);
- Variable *newVariable(Scope *scope, const QString &name, const Type *type);
+ Variable *newVariable(Scope *scope, const QString &name, const Type *type, int qualifiers = 0);
MemoryPool *pool();
diff --git a/src/libs/glsl/glslsemantic.cpp b/src/libs/glsl/glslsemantic.cpp
index 29760e2eecd..ac07911ea5b 100644
--- a/src/libs/glsl/glslsemantic.cpp
+++ b/src/libs/glsl/glslsemantic.cpp
@@ -751,7 +751,11 @@ bool Semantic::visit(VariableDeclarationAST *ast)
const Type *ty = type(ast->type);
ExprResult initializer = expression(ast->initializer);
if (ast->name) {
- Variable *var = _engine->newVariable(_scope, *ast->name, ty);
+ QualifiedTypeAST *qtype = ast->type->asQualifiedType();
+ int qualifiers = 0;
+ if (qtype)
+ qualifiers = qtype->qualifiers;
+ Variable *var = _engine->newVariable(_scope, *ast->name, ty, qualifiers);
_scope->add(var);
}
return false;
diff --git a/src/libs/glsl/glslsymbols.cpp b/src/libs/glsl/glslsymbols.cpp
index e4ede5f6c5e..21608629177 100644
--- a/src/libs/glsl/glslsymbols.cpp
+++ b/src/libs/glsl/glslsymbols.cpp
@@ -78,6 +78,7 @@ Symbol *Block::find(const QString &name) const
Variable::Variable(Scope *scope)
: Symbol(scope)
, _type(0)
+ , _qualifiers(0)
{
}
diff --git a/src/libs/glsl/glslsymbols.h b/src/libs/glsl/glslsymbols.h
index 6506c62fa7d..bf610dd3a24 100644
--- a/src/libs/glsl/glslsymbols.h
+++ b/src/libs/glsl/glslsymbols.h
@@ -59,10 +59,14 @@ public:
virtual const Type *type() const;
void setType(const Type *type);
+ int qualifiers() const { return _qualifiers; }
+ void setQualifiers(int qualifiers) { _qualifiers = qualifiers; }
+
virtual Variable *asVariable() { return this; }
private:
const Type *_type;
+ int _qualifiers;
};
class GLSL_EXPORT Block: public Scope