]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/validate.h
Disallow specialization constants in certain contexts
[libs/gl.git] / source / glsl / validate.h
index 52ae136bb61da6053f425cd1d70cc2ad87231be9..b47a9911d95c6a147034f1937243f34bd69ebca9 100644 (file)
@@ -113,8 +113,16 @@ is indicated by a null result type. */
 class ExpressionValidator: private Validator
 {
 private:
+       enum ConstantKind
+       {
+               NOT_CONSTANT,
+               FIXED_CONSTANT,
+               SPEC_CONSTANT
+       };
+
        FunctionDeclaration *current_function = 0;
-       bool constant_expression = false;
+       bool in_struct = false;
+       ConstantKind constant_expression = NOT_CONSTANT;
 
 public:
        void apply(Stage &s) { stage = &s; s.content.visit(*this); }
@@ -127,6 +135,7 @@ private:
        virtual void visit(BinaryExpression &);
        virtual void visit(Assignment &);
        virtual void visit(TernaryExpression &);
+       virtual void visit(StructDeclaration &);
        virtual void visit(VariableDeclaration &);
        virtual void visit(FunctionDeclaration &);
        virtual void visit(Conditional &);