diff --git a/src/libs/glsl/glsl.g b/src/libs/glsl/glsl.g index 8d2ff92e426c83c7d14b8cf0cb0c616072439480..c30903cf69527dee12a332175574f13e4b64f755 100644 --- a/src/libs/glsl/glsl.g +++ b/src/libs/glsl/glsl.g @@ -368,9 +368,9 @@ private: return node; } - TypeAST *makeBasicType(int token, BasicTypeAST::Category category) + TypeAST *makeBasicType(int token) { - TypeAST *type = new (_engine->pool()) BasicTypeAST(token, spell[token], category); + TypeAST *type = new (_engine->pool()) BasicTypeAST(token, spell[token]); type->lineno = yyloc >= 0 ? (_tokens[yyloc].line + 1) : 0; return type; } @@ -1800,595 +1800,595 @@ case $rule_number: { type_specifier_nonarray ::= VOID ; /. case $rule_number: { - ast(1) = makeBasicType(T_VOID, TypeAST::Void); + ast(1) = makeBasicType(T_VOID); } break; ./ type_specifier_nonarray ::= FLOAT ; /. case $rule_number: { - ast(1) = makeBasicType(T_FLOAT, TypeAST::Primitive); + ast(1) = makeBasicType(T_FLOAT); } break; ./ type_specifier_nonarray ::= DOUBLE ; /. case $rule_number: { - ast(1) = makeBasicType(T_DOUBLE, TypeAST::Primitive); + ast(1) = makeBasicType(T_DOUBLE); } break; ./ type_specifier_nonarray ::= INT ; /. case $rule_number: { - ast(1) = makeBasicType(T_INT, TypeAST::Primitive); + ast(1) = makeBasicType(T_INT); } break; ./ type_specifier_nonarray ::= UINT ; /. case $rule_number: { - ast(1) = makeBasicType(T_UINT, TypeAST::Primitive); + ast(1) = makeBasicType(T_UINT); } break; ./ type_specifier_nonarray ::= BOOL ; /. case $rule_number: { - ast(1) = makeBasicType(T_BOOL, TypeAST::Primitive); + ast(1) = makeBasicType(T_BOOL); } break; ./ type_specifier_nonarray ::= VEC2 ; /. case $rule_number: { - ast(1) = makeBasicType(T_VEC2, TypeAST::Vector2); + ast(1) = makeBasicType(T_VEC2); } break; ./ type_specifier_nonarray ::= VEC3 ; /. case $rule_number: { - ast(1) = makeBasicType(T_VEC3, TypeAST::Vector3); + ast(1) = makeBasicType(T_VEC3); } break; ./ type_specifier_nonarray ::= VEC4 ; /. case $rule_number: { - ast(1) = makeBasicType(T_VEC4, TypeAST::Vector4); + ast(1) = makeBasicType(T_VEC4); } break; ./ type_specifier_nonarray ::= DVEC2 ; /. case $rule_number: { - ast(1) = makeBasicType(T_DVEC2, TypeAST::Vector2); + ast(1) = makeBasicType(T_DVEC2); } break; ./ type_specifier_nonarray ::= DVEC3 ; /. case $rule_number: { - ast(1) = makeBasicType(T_DVEC3, TypeAST::Vector3); + ast(1) = makeBasicType(T_DVEC3); } break; ./ type_specifier_nonarray ::= DVEC4 ; /. case $rule_number: { - ast(1) = makeBasicType(T_DVEC4, TypeAST::Vector4); + ast(1) = makeBasicType(T_DVEC4); } break; ./ type_specifier_nonarray ::= BVEC2 ; /. case $rule_number: { - ast(1) = makeBasicType(T_BVEC2, TypeAST::Vector2); + ast(1) = makeBasicType(T_BVEC2); } break; ./ type_specifier_nonarray ::= BVEC3 ; /. case $rule_number: { - ast(1) = makeBasicType(T_BVEC3, TypeAST::Vector3); + ast(1) = makeBasicType(T_BVEC3); } break; ./ type_specifier_nonarray ::= BVEC4 ; /. case $rule_number: { - ast(1) = makeBasicType(T_BVEC4, TypeAST::Vector4); + ast(1) = makeBasicType(T_BVEC4); } break; ./ type_specifier_nonarray ::= IVEC2 ; /. case $rule_number: { - ast(1) = makeBasicType(T_IVEC2, TypeAST::Vector2); + ast(1) = makeBasicType(T_IVEC2); } break; ./ type_specifier_nonarray ::= IVEC3 ; /. case $rule_number: { - ast(1) = makeBasicType(T_IVEC3, TypeAST::Vector3); + ast(1) = makeBasicType(T_IVEC3); } break; ./ type_specifier_nonarray ::= IVEC4 ; /. case $rule_number: { - ast(1) = makeBasicType(T_IVEC4, TypeAST::Vector4); + ast(1) = makeBasicType(T_IVEC4); } break; ./ type_specifier_nonarray ::= UVEC2 ; /. case $rule_number: { - ast(1) = makeBasicType(T_UVEC2, TypeAST::Vector2); + ast(1) = makeBasicType(T_UVEC2); } break; ./ type_specifier_nonarray ::= UVEC3 ; /. case $rule_number: { - ast(1) = makeBasicType(T_UVEC3, TypeAST::Vector3); + ast(1) = makeBasicType(T_UVEC3); } break; ./ type_specifier_nonarray ::= UVEC4 ; /. case $rule_number: { - ast(1) = makeBasicType(T_UVEC4, TypeAST::Vector4); + ast(1) = makeBasicType(T_UVEC4); } break; ./ type_specifier_nonarray ::= MAT2 ; /. case $rule_number: { - ast(1) = makeBasicType(T_MAT2, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT2); } break; ./ type_specifier_nonarray ::= MAT3 ; /. case $rule_number: { - ast(1) = makeBasicType(T_MAT3, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT3); } break; ./ type_specifier_nonarray ::= MAT4 ; /. case $rule_number: { - ast(1) = makeBasicType(T_MAT4, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT4); } break; ./ type_specifier_nonarray ::= MAT2X2 ; /. case $rule_number: { - ast(1) = makeBasicType(T_MAT2, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT2); } break; ./ type_specifier_nonarray ::= MAT2X3 ; /. case $rule_number: { - ast(1) = makeBasicType(T_MAT2X3, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT2X3); } break; ./ type_specifier_nonarray ::= MAT2X4 ; /. case $rule_number: { - ast(1) = makeBasicType(T_MAT2X4, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT2X4); } break; ./ type_specifier_nonarray ::= MAT3X2 ; /. case $rule_number: { - ast(1) = makeBasicType(T_MAT3X2, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT3X2); } break; ./ type_specifier_nonarray ::= MAT3X3 ; /. case $rule_number: { - ast(1) = makeBasicType(T_MAT3, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT3); } break; ./ type_specifier_nonarray ::= MAT3X4 ; /. case $rule_number: { - ast(1) = makeBasicType(T_MAT3X4, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT3X4); } break; ./ type_specifier_nonarray ::= MAT4X2 ; /. case $rule_number: { - ast(1) = makeBasicType(T_MAT4X2, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT4X2); } break; ./ type_specifier_nonarray ::= MAT4X3 ; /. case $rule_number: { - ast(1) = makeBasicType(T_MAT4X3, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT4X3); } break; ./ type_specifier_nonarray ::= MAT4X4 ; /. case $rule_number: { - ast(1) = makeBasicType(T_MAT4, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT4); } break; ./ type_specifier_nonarray ::= DMAT2 ; /. case $rule_number: { - ast(1) = makeBasicType(T_DMAT2, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT2); } break; ./ type_specifier_nonarray ::= DMAT3 ; /. case $rule_number: { - ast(1) = makeBasicType(T_DMAT3, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT3); } break; ./ type_specifier_nonarray ::= DMAT4 ; /. case $rule_number: { - ast(1) = makeBasicType(T_DMAT4, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT4); } break; ./ type_specifier_nonarray ::= DMAT2X2 ; /. case $rule_number: { - ast(1) = makeBasicType(T_DMAT2, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT2); } break; ./ type_specifier_nonarray ::= DMAT2X3 ; /. case $rule_number: { - ast(1) = makeBasicType(T_DMAT2X3, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT2X3); } break; ./ type_specifier_nonarray ::= DMAT2X4 ; /. case $rule_number: { - ast(1) = makeBasicType(T_DMAT2X4, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT2X4); } break; ./ type_specifier_nonarray ::= DMAT3X2 ; /. case $rule_number: { - ast(1) = makeBasicType(T_DMAT3X2, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT3X2); } break; ./ type_specifier_nonarray ::= DMAT3X3 ; /. case $rule_number: { - ast(1) = makeBasicType(T_DMAT3, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT3); } break; ./ type_specifier_nonarray ::= DMAT3X4 ; /. case $rule_number: { - ast(1) = makeBasicType(T_DMAT3X4, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT3X4); } break; ./ type_specifier_nonarray ::= DMAT4X2 ; /. case $rule_number: { - ast(1) = makeBasicType(T_DMAT4X2, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT4X2); } break; ./ type_specifier_nonarray ::= DMAT4X3 ; /. case $rule_number: { - ast(1) = makeBasicType(T_DMAT4X3, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT4X3); } break; ./ type_specifier_nonarray ::= DMAT4X4 ; /. case $rule_number: { - ast(1) = makeBasicType(T_DMAT4, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT4); } break; ./ type_specifier_nonarray ::= SAMPLER1D ; /. case $rule_number: { - ast(1) = makeBasicType(T_SAMPLER1D, TypeAST::Sampler1D); + ast(1) = makeBasicType(T_SAMPLER1D); } break; ./ type_specifier_nonarray ::= SAMPLER2D ; /. case $rule_number: { - ast(1) = makeBasicType(T_SAMPLER2D, TypeAST::Sampler2D); + ast(1) = makeBasicType(T_SAMPLER2D); } break; ./ type_specifier_nonarray ::= SAMPLER3D ; /. case $rule_number: { - ast(1) = makeBasicType(T_SAMPLER3D, TypeAST::Sampler3D); + ast(1) = makeBasicType(T_SAMPLER3D); } break; ./ type_specifier_nonarray ::= SAMPLERCUBE ; /. case $rule_number: { - ast(1) = makeBasicType(T_SAMPLERCUBE, TypeAST::SamplerCube); + ast(1) = makeBasicType(T_SAMPLERCUBE); } break; ./ type_specifier_nonarray ::= SAMPLER1DSHADOW ; /. case $rule_number: { - ast(1) = makeBasicType(T_SAMPLER1DSHADOW, TypeAST::Sampler1DShadow); + ast(1) = makeBasicType(T_SAMPLER1DSHADOW); } break; ./ type_specifier_nonarray ::= SAMPLER2DSHADOW ; /. case $rule_number: { - ast(1) = makeBasicType(T_SAMPLER2DSHADOW, TypeAST::Sampler2DShadow); + ast(1) = makeBasicType(T_SAMPLER2DSHADOW); } break; ./ type_specifier_nonarray ::= SAMPLERCUBESHADOW ; /. case $rule_number: { - ast(1) = makeBasicType(T_SAMPLERCUBESHADOW, TypeAST::SamplerCubeShadow); + ast(1) = makeBasicType(T_SAMPLERCUBESHADOW); } break; ./ type_specifier_nonarray ::= SAMPLER1DARRAY ; /. case $rule_number: { - ast(1) = makeBasicType(T_SAMPLER1DARRAY, TypeAST::Sampler1DArray); + ast(1) = makeBasicType(T_SAMPLER1DARRAY); } break; ./ type_specifier_nonarray ::= SAMPLER2DARRAY ; /. case $rule_number: { - ast(1) = makeBasicType(T_SAMPLER2DARRAY, TypeAST::Sampler2DArray); + ast(1) = makeBasicType(T_SAMPLER2DARRAY); } break; ./ type_specifier_nonarray ::= SAMPLER1DARRAYSHADOW ; /. case $rule_number: { - ast(1) = makeBasicType(T_SAMPLER1DARRAYSHADOW, TypeAST::Sampler1DArrayShadow); + ast(1) = makeBasicType(T_SAMPLER1DARRAYSHADOW); } break; ./ type_specifier_nonarray ::= SAMPLER2DARRAYSHADOW ; /. case $rule_number: { - ast(1) = makeBasicType(T_SAMPLER2DARRAYSHADOW, TypeAST::Sampler2DArrayShadow); + ast(1) = makeBasicType(T_SAMPLER2DARRAYSHADOW); } break; ./ type_specifier_nonarray ::= SAMPLERCUBEARRAY ; /. case $rule_number: { - ast(1) = makeBasicType(T_SAMPLERCUBEARRAY, TypeAST::SamplerCubeShadow); + ast(1) = makeBasicType(T_SAMPLERCUBEARRAY); } break; ./ type_specifier_nonarray ::= SAMPLERCUBEARRAYSHADOW ; /. case $rule_number: { - ast(1) = makeBasicType(T_SAMPLERCUBEARRAYSHADOW, TypeAST::SamplerCubeArrayShadow); + ast(1) = makeBasicType(T_SAMPLERCUBEARRAYSHADOW); } break; ./ type_specifier_nonarray ::= ISAMPLER1D ; /. case $rule_number: { - ast(1) = makeBasicType(T_ISAMPLER1D, TypeAST::Sampler1D); + ast(1) = makeBasicType(T_ISAMPLER1D); } break; ./ type_specifier_nonarray ::= ISAMPLER2D ; /. case $rule_number: { - ast(1) = makeBasicType(T_ISAMPLER2D, TypeAST::Sampler2D); + ast(1) = makeBasicType(T_ISAMPLER2D); } break; ./ type_specifier_nonarray ::= ISAMPLER3D ; /. case $rule_number: { - ast(1) = makeBasicType(T_ISAMPLER3D, TypeAST::Sampler3D); + ast(1) = makeBasicType(T_ISAMPLER3D); } break; ./ type_specifier_nonarray ::= ISAMPLERCUBE ; /. case $rule_number: { - ast(1) = makeBasicType(T_ISAMPLERCUBE, TypeAST::SamplerCube); + ast(1) = makeBasicType(T_ISAMPLERCUBE); } break; ./ type_specifier_nonarray ::= ISAMPLER1DARRAY ; /. case $rule_number: { - ast(1) = makeBasicType(T_ISAMPLER1DARRAY, TypeAST::Sampler1DArray); + ast(1) = makeBasicType(T_ISAMPLER1DARRAY); } break; ./ type_specifier_nonarray ::= ISAMPLER2DARRAY ; /. case $rule_number: { - ast(1) = makeBasicType(T_ISAMPLER2DARRAY, TypeAST::Sampler2DArray); + ast(1) = makeBasicType(T_ISAMPLER2DARRAY); } break; ./ type_specifier_nonarray ::= ISAMPLERCUBEARRAY ; /. case $rule_number: { - ast(1) = makeBasicType(T_ISAMPLERCUBEARRAY, TypeAST::SamplerCubeArray); + ast(1) = makeBasicType(T_ISAMPLERCUBEARRAY); } break; ./ type_specifier_nonarray ::= USAMPLER1D ; /. case $rule_number: { - ast(1) = makeBasicType(T_USAMPLER1D, TypeAST::Sampler1D); + ast(1) = makeBasicType(T_USAMPLER1D); } break; ./ type_specifier_nonarray ::= USAMPLER2D ; /. case $rule_number: { - ast(1) = makeBasicType(T_USAMPLER2D, TypeAST::Sampler2D); + ast(1) = makeBasicType(T_USAMPLER2D); } break; ./ type_specifier_nonarray ::= USAMPLER3D ; /. case $rule_number: { - ast(1) = makeBasicType(T_USAMPLER3D, TypeAST::Sampler3D); + ast(1) = makeBasicType(T_USAMPLER3D); } break; ./ type_specifier_nonarray ::= USAMPLERCUBE ; /. case $rule_number: { - ast(1) = makeBasicType(T_USAMPLERCUBE, TypeAST::SamplerCube); + ast(1) = makeBasicType(T_USAMPLERCUBE); } break; ./ type_specifier_nonarray ::= USAMPLER1DARRAY ; /. case $rule_number: { - ast(1) = makeBasicType(T_USAMPLER1DARRAY, TypeAST::Sampler1DArray); + ast(1) = makeBasicType(T_USAMPLER1DARRAY); } break; ./ type_specifier_nonarray ::= USAMPLER2DARRAY ; /. case $rule_number: { - ast(1) = makeBasicType(T_USAMPLER2DARRAY, TypeAST::Sampler2DArray); + ast(1) = makeBasicType(T_USAMPLER2DARRAY); } break; ./ type_specifier_nonarray ::= USAMPLERCUBEARRAY ; /. case $rule_number: { - ast(1) = makeBasicType(T_USAMPLERCUBEARRAY, TypeAST::SamplerCubeArray); + ast(1) = makeBasicType(T_USAMPLERCUBEARRAY); } break; ./ type_specifier_nonarray ::= SAMPLER2DRECT ; /. case $rule_number: { - ast(1) = makeBasicType(T_SAMPLER2DRECT, TypeAST::Sampler2DRect); + ast(1) = makeBasicType(T_SAMPLER2DRECT); } break; ./ type_specifier_nonarray ::= SAMPLER2DRECTSHADOW ; /. case $rule_number: { - ast(1) = makeBasicType(T_SAMPLER2DRECTSHADOW, TypeAST::Sampler2DRectShadow); + ast(1) = makeBasicType(T_SAMPLER2DRECTSHADOW); } break; ./ type_specifier_nonarray ::= ISAMPLER2DRECT ; /. case $rule_number: { - ast(1) = makeBasicType(T_ISAMPLER2DRECT, TypeAST::Sampler2DRect); + ast(1) = makeBasicType(T_ISAMPLER2DRECT); } break; ./ type_specifier_nonarray ::= USAMPLER2DRECT ; /. case $rule_number: { - ast(1) = makeBasicType(T_USAMPLER2DRECT, TypeAST::Sampler2DRect); + ast(1) = makeBasicType(T_USAMPLER2DRECT); } break; ./ type_specifier_nonarray ::= SAMPLERBUFFER ; /. case $rule_number: { - ast(1) = makeBasicType(T_SAMPLERBUFFER, TypeAST::SamplerBuffer); + ast(1) = makeBasicType(T_SAMPLERBUFFER); } break; ./ type_specifier_nonarray ::= ISAMPLERBUFFER ; /. case $rule_number: { - ast(1) = makeBasicType(T_ISAMPLERBUFFER, TypeAST::SamplerBuffer); + ast(1) = makeBasicType(T_ISAMPLERBUFFER); } break; ./ type_specifier_nonarray ::= USAMPLERBUFFER ; /. case $rule_number: { - ast(1) = makeBasicType(T_USAMPLERBUFFER, TypeAST::SamplerBuffer); + ast(1) = makeBasicType(T_USAMPLERBUFFER); } break; ./ type_specifier_nonarray ::= SAMPLER2DMS ; /. case $rule_number: { - ast(1) = makeBasicType(T_SAMPLER2DMS, TypeAST::Sampler2DMS); + ast(1) = makeBasicType(T_SAMPLER2DMS); } break; ./ type_specifier_nonarray ::= ISAMPLER2DMS ; /. case $rule_number: { - ast(1) = makeBasicType(T_ISAMPLER2DMS, TypeAST::Sampler2DMS); + ast(1) = makeBasicType(T_ISAMPLER2DMS); } break; ./ type_specifier_nonarray ::= USAMPLER2DMS ; /. case $rule_number: { - ast(1) = makeBasicType(T_USAMPLER2DMS, TypeAST::Sampler2DMS); + ast(1) = makeBasicType(T_USAMPLER2DMS); } break; ./ type_specifier_nonarray ::= SAMPLER2DMSARRAY ; /. case $rule_number: { - ast(1) = makeBasicType(T_SAMPLER2DMSARRAY, TypeAST::Sampler2DMSArray); + ast(1) = makeBasicType(T_SAMPLER2DMSARRAY); } break; ./ type_specifier_nonarray ::= ISAMPLER2DMSARRAY ; /. case $rule_number: { - ast(1) = makeBasicType(T_ISAMPLER2DMSARRAY, TypeAST::Sampler2DMSArray); + ast(1) = makeBasicType(T_ISAMPLER2DMSARRAY); } break; ./ type_specifier_nonarray ::= USAMPLER2DMSARRAY ; /. case $rule_number: { - ast(1) = makeBasicType(T_USAMPLER2DMSARRAY, TypeAST::Sampler2DMSArray); + ast(1) = makeBasicType(T_USAMPLER2DMSARRAY); } break; ./ diff --git a/src/libs/glsl/glslast.cpp b/src/libs/glsl/glslast.cpp index 16ee129760e86c2e2c7617fc17ae0d94b449824e..5f02b2b07b82306c9176eeb0d1fc3847776866b7 100644 --- a/src/libs/glsl/glslast.cpp +++ b/src/libs/glsl/glslast.cpp @@ -222,8 +222,8 @@ void DeclarationStatementAST::accept0(Visitor *visitor) visitor->endVisit(this); } -BasicTypeAST::BasicTypeAST(int _token, const char *_name, Category _category) - : TypeAST(Kind_BasicType), token(_token), name(_name), categ(_category) +BasicTypeAST::BasicTypeAST(int _token, const char *_name) + : TypeAST(Kind_BasicType), token(_token), name(_name) { switch (token) { case GLSLParserTable::T_VOID: diff --git a/src/libs/glsl/glslast.h b/src/libs/glsl/glslast.h index 7e8649393a0704de49a96b3006d791ed241a8dba..f64b59e02f6dd4518b727395e128babaa2488da6 100644 --- a/src/libs/glsl/glslast.h +++ b/src/libs/glsl/glslast.h @@ -668,36 +668,6 @@ public: Highp }; - enum Category - { - Void, - Primitive, - Vector2, - Vector3, - Vector4, - Matrix, - Sampler1D, - Sampler2D, - Sampler3D, - SamplerCube, - Sampler1DShadow, - Sampler2DShadow, - SamplerCubeShadow, - Sampler1DArray, - Sampler2DArray, - SamplerCubeArray, - Sampler1DArrayShadow, - Sampler2DArrayShadow, - SamplerCubeArrayShadow, - Sampler2DRect, - Sampler2DRectShadow, - Sampler2DMS, - Sampler2DMSArray, - SamplerBuffer, - Array, - Struct - }; - virtual TypeAST *asType() { return this; } virtual Precision precision() const = 0; @@ -705,15 +675,13 @@ public: // Set the precision for the innermost basic type. Returns false if it // is not valid to set a precision (e.g. structs). virtual bool setPrecision(Precision precision) = 0; - - virtual Category category() const = 0; }; class GLSL_EXPORT BasicTypeAST: public TypeAST { public: // Pass the parser's token code: T_VOID, T_VEC4, etc. - BasicTypeAST(int _token, const char *_name, Category _category); + BasicTypeAST(int _token, const char *_name); virtual BasicTypeAST *asBasicType() { return this; } @@ -722,13 +690,10 @@ public: virtual Precision precision() const; virtual bool setPrecision(Precision precision); - virtual Category category() const { return categ; } - public: // attributes Precision prec; int token; const char *name; - Category categ; }; class GLSL_EXPORT NamedTypeAST: public TypeAST @@ -743,8 +708,6 @@ public: virtual Precision precision() const; virtual bool setPrecision(Precision precision); - virtual Category category() const { return Struct; } - public: // attributes const QString *name; }; @@ -764,8 +727,6 @@ public: virtual Precision precision() const; virtual bool setPrecision(Precision precision); - virtual Category category() const { return Array; } - public: // attributes TypeAST *elementType; ExpressionAST *size; @@ -810,8 +771,6 @@ public: // be copied into the "array holes" of all fields. static List<Field *> *fixInnerTypes(TypeAST *innerType, List<Field *> *fields); - virtual Category category() const { return Struct; } - public: // attributes const QString *name; List<Field *> *fields; @@ -858,7 +817,8 @@ public: Smooth = 0x00000100, Flat = 0x00000200, NoPerspective = 0x00000300, - Invariant = 0x00010000 + Invariant = 0x00010000, + Struct = 0x00020000 }; virtual QualifiedTypeAST *asQualifiedType() { return this; } @@ -868,8 +828,6 @@ public: virtual Precision precision() const { return type->precision(); } virtual bool setPrecision(Precision precision) { return type->setPrecision(precision); } - virtual Category category() const { return type->category(); } - public: // attributes int qualifiers; TypeAST *type; diff --git a/src/libs/glsl/glslparser.cpp b/src/libs/glsl/glslparser.cpp index 7285056b8c6c2f90c2a87a574ca3e40f7f8c2c23..8ddc3d3d108c61627f5d120c778f7882dded60d7 100644 --- a/src/libs/glsl/glslparser.cpp +++ b/src/libs/glsl/glslparser.cpp @@ -1247,511 +1247,511 @@ case 158: { #line 1801 "./glsl.g" case 159: { - ast(1) = makeBasicType(T_VOID, TypeAST::Void); + ast(1) = makeBasicType(T_VOID); } break; #line 1808 "./glsl.g" case 160: { - ast(1) = makeBasicType(T_FLOAT, TypeAST::Primitive); + ast(1) = makeBasicType(T_FLOAT); } break; #line 1815 "./glsl.g" case 161: { - ast(1) = makeBasicType(T_DOUBLE, TypeAST::Primitive); + ast(1) = makeBasicType(T_DOUBLE); } break; #line 1822 "./glsl.g" case 162: { - ast(1) = makeBasicType(T_INT, TypeAST::Primitive); + ast(1) = makeBasicType(T_INT); } break; #line 1829 "./glsl.g" case 163: { - ast(1) = makeBasicType(T_UINT, TypeAST::Primitive); + ast(1) = makeBasicType(T_UINT); } break; #line 1836 "./glsl.g" case 164: { - ast(1) = makeBasicType(T_BOOL, TypeAST::Primitive); + ast(1) = makeBasicType(T_BOOL); } break; #line 1843 "./glsl.g" case 165: { - ast(1) = makeBasicType(T_VEC2, TypeAST::Vector2); + ast(1) = makeBasicType(T_VEC2); } break; #line 1850 "./glsl.g" case 166: { - ast(1) = makeBasicType(T_VEC3, TypeAST::Vector3); + ast(1) = makeBasicType(T_VEC3); } break; #line 1857 "./glsl.g" case 167: { - ast(1) = makeBasicType(T_VEC4, TypeAST::Vector4); + ast(1) = makeBasicType(T_VEC4); } break; #line 1864 "./glsl.g" case 168: { - ast(1) = makeBasicType(T_DVEC2, TypeAST::Vector2); + ast(1) = makeBasicType(T_DVEC2); } break; #line 1871 "./glsl.g" case 169: { - ast(1) = makeBasicType(T_DVEC3, TypeAST::Vector3); + ast(1) = makeBasicType(T_DVEC3); } break; #line 1878 "./glsl.g" case 170: { - ast(1) = makeBasicType(T_DVEC4, TypeAST::Vector4); + ast(1) = makeBasicType(T_DVEC4); } break; #line 1885 "./glsl.g" case 171: { - ast(1) = makeBasicType(T_BVEC2, TypeAST::Vector2); + ast(1) = makeBasicType(T_BVEC2); } break; #line 1892 "./glsl.g" case 172: { - ast(1) = makeBasicType(T_BVEC3, TypeAST::Vector3); + ast(1) = makeBasicType(T_BVEC3); } break; #line 1899 "./glsl.g" case 173: { - ast(1) = makeBasicType(T_BVEC4, TypeAST::Vector4); + ast(1) = makeBasicType(T_BVEC4); } break; #line 1906 "./glsl.g" case 174: { - ast(1) = makeBasicType(T_IVEC2, TypeAST::Vector2); + ast(1) = makeBasicType(T_IVEC2); } break; #line 1913 "./glsl.g" case 175: { - ast(1) = makeBasicType(T_IVEC3, TypeAST::Vector3); + ast(1) = makeBasicType(T_IVEC3); } break; #line 1920 "./glsl.g" case 176: { - ast(1) = makeBasicType(T_IVEC4, TypeAST::Vector4); + ast(1) = makeBasicType(T_IVEC4); } break; #line 1927 "./glsl.g" case 177: { - ast(1) = makeBasicType(T_UVEC2, TypeAST::Vector2); + ast(1) = makeBasicType(T_UVEC2); } break; #line 1934 "./glsl.g" case 178: { - ast(1) = makeBasicType(T_UVEC3, TypeAST::Vector3); + ast(1) = makeBasicType(T_UVEC3); } break; #line 1941 "./glsl.g" case 179: { - ast(1) = makeBasicType(T_UVEC4, TypeAST::Vector4); + ast(1) = makeBasicType(T_UVEC4); } break; #line 1948 "./glsl.g" case 180: { - ast(1) = makeBasicType(T_MAT2, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT2); } break; #line 1955 "./glsl.g" case 181: { - ast(1) = makeBasicType(T_MAT3, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT3); } break; #line 1962 "./glsl.g" case 182: { - ast(1) = makeBasicType(T_MAT4, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT4); } break; #line 1969 "./glsl.g" case 183: { - ast(1) = makeBasicType(T_MAT2, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT2); } break; #line 1976 "./glsl.g" case 184: { - ast(1) = makeBasicType(T_MAT2X3, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT2X3); } break; #line 1983 "./glsl.g" case 185: { - ast(1) = makeBasicType(T_MAT2X4, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT2X4); } break; #line 1990 "./glsl.g" case 186: { - ast(1) = makeBasicType(T_MAT3X2, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT3X2); } break; #line 1997 "./glsl.g" case 187: { - ast(1) = makeBasicType(T_MAT3, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT3); } break; #line 2004 "./glsl.g" case 188: { - ast(1) = makeBasicType(T_MAT3X4, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT3X4); } break; #line 2011 "./glsl.g" case 189: { - ast(1) = makeBasicType(T_MAT4X2, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT4X2); } break; #line 2018 "./glsl.g" case 190: { - ast(1) = makeBasicType(T_MAT4X3, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT4X3); } break; #line 2025 "./glsl.g" case 191: { - ast(1) = makeBasicType(T_MAT4, TypeAST::Matrix); + ast(1) = makeBasicType(T_MAT4); } break; #line 2032 "./glsl.g" case 192: { - ast(1) = makeBasicType(T_DMAT2, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT2); } break; #line 2039 "./glsl.g" case 193: { - ast(1) = makeBasicType(T_DMAT3, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT3); } break; #line 2046 "./glsl.g" case 194: { - ast(1) = makeBasicType(T_DMAT4, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT4); } break; #line 2053 "./glsl.g" case 195: { - ast(1) = makeBasicType(T_DMAT2, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT2); } break; #line 2060 "./glsl.g" case 196: { - ast(1) = makeBasicType(T_DMAT2X3, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT2X3); } break; #line 2067 "./glsl.g" case 197: { - ast(1) = makeBasicType(T_DMAT2X4, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT2X4); } break; #line 2074 "./glsl.g" case 198: { - ast(1) = makeBasicType(T_DMAT3X2, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT3X2); } break; #line 2081 "./glsl.g" case 199: { - ast(1) = makeBasicType(T_DMAT3, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT3); } break; #line 2088 "./glsl.g" case 200: { - ast(1) = makeBasicType(T_DMAT3X4, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT3X4); } break; #line 2095 "./glsl.g" case 201: { - ast(1) = makeBasicType(T_DMAT4X2, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT4X2); } break; #line 2102 "./glsl.g" case 202: { - ast(1) = makeBasicType(T_DMAT4X3, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT4X3); } break; #line 2109 "./glsl.g" case 203: { - ast(1) = makeBasicType(T_DMAT4, TypeAST::Matrix); + ast(1) = makeBasicType(T_DMAT4); } break; #line 2116 "./glsl.g" case 204: { - ast(1) = makeBasicType(T_SAMPLER1D, TypeAST::Sampler1D); + ast(1) = makeBasicType(T_SAMPLER1D); } break; #line 2123 "./glsl.g" case 205: { - ast(1) = makeBasicType(T_SAMPLER2D, TypeAST::Sampler2D); + ast(1) = makeBasicType(T_SAMPLER2D); } break; #line 2130 "./glsl.g" case 206: { - ast(1) = makeBasicType(T_SAMPLER3D, TypeAST::Sampler3D); + ast(1) = makeBasicType(T_SAMPLER3D); } break; #line 2137 "./glsl.g" case 207: { - ast(1) = makeBasicType(T_SAMPLERCUBE, TypeAST::SamplerCube); + ast(1) = makeBasicType(T_SAMPLERCUBE); } break; #line 2144 "./glsl.g" case 208: { - ast(1) = makeBasicType(T_SAMPLER1DSHADOW, TypeAST::Sampler1DShadow); + ast(1) = makeBasicType(T_SAMPLER1DSHADOW); } break; #line 2151 "./glsl.g" case 209: { - ast(1) = makeBasicType(T_SAMPLER2DSHADOW, TypeAST::Sampler2DShadow); + ast(1) = makeBasicType(T_SAMPLER2DSHADOW); } break; #line 2158 "./glsl.g" case 210: { - ast(1) = makeBasicType(T_SAMPLERCUBESHADOW, TypeAST::SamplerCubeShadow); + ast(1) = makeBasicType(T_SAMPLERCUBESHADOW); } break; #line 2165 "./glsl.g" case 211: { - ast(1) = makeBasicType(T_SAMPLER1DARRAY, TypeAST::Sampler1DArray); + ast(1) = makeBasicType(T_SAMPLER1DARRAY); } break; #line 2172 "./glsl.g" case 212: { - ast(1) = makeBasicType(T_SAMPLER2DARRAY, TypeAST::Sampler2DArray); + ast(1) = makeBasicType(T_SAMPLER2DARRAY); } break; #line 2179 "./glsl.g" case 213: { - ast(1) = makeBasicType(T_SAMPLER1DARRAYSHADOW, TypeAST::Sampler1DArrayShadow); + ast(1) = makeBasicType(T_SAMPLER1DARRAYSHADOW); } break; #line 2186 "./glsl.g" case 214: { - ast(1) = makeBasicType(T_SAMPLER2DARRAYSHADOW, TypeAST::Sampler2DArrayShadow); + ast(1) = makeBasicType(T_SAMPLER2DARRAYSHADOW); } break; #line 2193 "./glsl.g" case 215: { - ast(1) = makeBasicType(T_SAMPLERCUBEARRAY, TypeAST::SamplerCubeShadow); + ast(1) = makeBasicType(T_SAMPLERCUBEARRAY); } break; #line 2200 "./glsl.g" case 216: { - ast(1) = makeBasicType(T_SAMPLERCUBEARRAYSHADOW, TypeAST::SamplerCubeArrayShadow); + ast(1) = makeBasicType(T_SAMPLERCUBEARRAYSHADOW); } break; #line 2207 "./glsl.g" case 217: { - ast(1) = makeBasicType(T_ISAMPLER1D, TypeAST::Sampler1D); + ast(1) = makeBasicType(T_ISAMPLER1D); } break; #line 2214 "./glsl.g" case 218: { - ast(1) = makeBasicType(T_ISAMPLER2D, TypeAST::Sampler2D); + ast(1) = makeBasicType(T_ISAMPLER2D); } break; #line 2221 "./glsl.g" case 219: { - ast(1) = makeBasicType(T_ISAMPLER3D, TypeAST::Sampler3D); + ast(1) = makeBasicType(T_ISAMPLER3D); } break; #line 2228 "./glsl.g" case 220: { - ast(1) = makeBasicType(T_ISAMPLERCUBE, TypeAST::SamplerCube); + ast(1) = makeBasicType(T_ISAMPLERCUBE); } break; #line 2235 "./glsl.g" case 221: { - ast(1) = makeBasicType(T_ISAMPLER1DARRAY, TypeAST::Sampler1DArray); + ast(1) = makeBasicType(T_ISAMPLER1DARRAY); } break; #line 2242 "./glsl.g" case 222: { - ast(1) = makeBasicType(T_ISAMPLER2DARRAY, TypeAST::Sampler2DArray); + ast(1) = makeBasicType(T_ISAMPLER2DARRAY); } break; #line 2249 "./glsl.g" case 223: { - ast(1) = makeBasicType(T_ISAMPLERCUBEARRAY, TypeAST::SamplerCubeArray); + ast(1) = makeBasicType(T_ISAMPLERCUBEARRAY); } break; #line 2256 "./glsl.g" case 224: { - ast(1) = makeBasicType(T_USAMPLER1D, TypeAST::Sampler1D); + ast(1) = makeBasicType(T_USAMPLER1D); } break; #line 2263 "./glsl.g" case 225: { - ast(1) = makeBasicType(T_USAMPLER2D, TypeAST::Sampler2D); + ast(1) = makeBasicType(T_USAMPLER2D); } break; #line 2270 "./glsl.g" case 226: { - ast(1) = makeBasicType(T_USAMPLER3D, TypeAST::Sampler3D); + ast(1) = makeBasicType(T_USAMPLER3D); } break; #line 2277 "./glsl.g" case 227: { - ast(1) = makeBasicType(T_USAMPLERCUBE, TypeAST::SamplerCube); + ast(1) = makeBasicType(T_USAMPLERCUBE); } break; #line 2284 "./glsl.g" case 228: { - ast(1) = makeBasicType(T_USAMPLER1DARRAY, TypeAST::Sampler1DArray); + ast(1) = makeBasicType(T_USAMPLER1DARRAY); } break; #line 2291 "./glsl.g" case 229: { - ast(1) = makeBasicType(T_USAMPLER2DARRAY, TypeAST::Sampler2DArray); + ast(1) = makeBasicType(T_USAMPLER2DARRAY); } break; #line 2298 "./glsl.g" case 230: { - ast(1) = makeBasicType(T_USAMPLERCUBEARRAY, TypeAST::SamplerCubeArray); + ast(1) = makeBasicType(T_USAMPLERCUBEARRAY); } break; #line 2305 "./glsl.g" case 231: { - ast(1) = makeBasicType(T_SAMPLER2DRECT, TypeAST::Sampler2DRect); + ast(1) = makeBasicType(T_SAMPLER2DRECT); } break; #line 2312 "./glsl.g" case 232: { - ast(1) = makeBasicType(T_SAMPLER2DRECTSHADOW, TypeAST::Sampler2DRectShadow); + ast(1) = makeBasicType(T_SAMPLER2DRECTSHADOW); } break; #line 2319 "./glsl.g" case 233: { - ast(1) = makeBasicType(T_ISAMPLER2DRECT, TypeAST::Sampler2DRect); + ast(1) = makeBasicType(T_ISAMPLER2DRECT); } break; #line 2326 "./glsl.g" case 234: { - ast(1) = makeBasicType(T_USAMPLER2DRECT, TypeAST::Sampler2DRect); + ast(1) = makeBasicType(T_USAMPLER2DRECT); } break; #line 2333 "./glsl.g" case 235: { - ast(1) = makeBasicType(T_SAMPLERBUFFER, TypeAST::SamplerBuffer); + ast(1) = makeBasicType(T_SAMPLERBUFFER); } break; #line 2340 "./glsl.g" case 236: { - ast(1) = makeBasicType(T_ISAMPLERBUFFER, TypeAST::SamplerBuffer); + ast(1) = makeBasicType(T_ISAMPLERBUFFER); } break; #line 2347 "./glsl.g" case 237: { - ast(1) = makeBasicType(T_USAMPLERBUFFER, TypeAST::SamplerBuffer); + ast(1) = makeBasicType(T_USAMPLERBUFFER); } break; #line 2354 "./glsl.g" case 238: { - ast(1) = makeBasicType(T_SAMPLER2DMS, TypeAST::Sampler2DMS); + ast(1) = makeBasicType(T_SAMPLER2DMS); } break; #line 2361 "./glsl.g" case 239: { - ast(1) = makeBasicType(T_ISAMPLER2DMS, TypeAST::Sampler2DMS); + ast(1) = makeBasicType(T_ISAMPLER2DMS); } break; #line 2368 "./glsl.g" case 240: { - ast(1) = makeBasicType(T_USAMPLER2DMS, TypeAST::Sampler2DMS); + ast(1) = makeBasicType(T_USAMPLER2DMS); } break; #line 2375 "./glsl.g" case 241: { - ast(1) = makeBasicType(T_SAMPLER2DMSARRAY, TypeAST::Sampler2DMSArray); + ast(1) = makeBasicType(T_SAMPLER2DMSARRAY); } break; #line 2382 "./glsl.g" case 242: { - ast(1) = makeBasicType(T_ISAMPLER2DMSARRAY, TypeAST::Sampler2DMSArray); + ast(1) = makeBasicType(T_ISAMPLER2DMSARRAY); } break; #line 2389 "./glsl.g" case 243: { - ast(1) = makeBasicType(T_USAMPLER2DMSARRAY, TypeAST::Sampler2DMSArray); + ast(1) = makeBasicType(T_USAMPLER2DMSARRAY); } break; #line 2396 "./glsl.g" diff --git a/src/libs/glsl/glslparser.h b/src/libs/glsl/glslparser.h index f5ce937d2d9fd4cdeef5dd59072ef46e5174e5b0..9359140fa295608cf8cc5bc2c5e591ca126eee5b 100644 --- a/src/libs/glsl/glslparser.h +++ b/src/libs/glsl/glslparser.h @@ -157,9 +157,9 @@ private: return node; } - TypeAST *makeBasicType(int token, BasicTypeAST::Category category) + TypeAST *makeBasicType(int token) { - TypeAST *type = new (_engine->pool()) BasicTypeAST(token, spell[token], category); + TypeAST *type = new (_engine->pool()) BasicTypeAST(token, spell[token]); type->lineno = yyloc >= 0 ? (_tokens[yyloc].line + 1) : 0; return type; }