Commit b14178b6 by Alexis Hetu Committed by Alexis Hétu

Completing GLES 3.0 language parser

Added new matrix and sampler types in glslang parsed files, along with related code and new types in the C++ code. Change-Id: Id70c73fac04d000d508236bc9bf1b39a46beda6f Reviewed-on: https://swiftshader-review.googlesource.com/2826Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent f9b7cb1b
...@@ -156,14 +156,14 @@ bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources &resources) ...@@ -156,14 +156,14 @@ bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources &resources)
TPublicType integer; TPublicType integer;
integer.type = EbtInt; integer.type = EbtInt;
integer.size = 1; integer.primarySize = 1;
integer.matrix = false; integer.secondarySize = 1;
integer.array = false; integer.array = false;
TPublicType floatingPoint; TPublicType floatingPoint;
floatingPoint.type = EbtFloat; floatingPoint.type = EbtFloat;
floatingPoint.size = 1; floatingPoint.primarySize = 1;
floatingPoint.matrix = false; floatingPoint.secondarySize = 1;
floatingPoint.array = false; floatingPoint.array = false;
switch(shaderType) switch(shaderType)
......
...@@ -81,9 +81,9 @@ void InsertBuiltInFunctions(GLenum type, const ShBuiltInResources &resources, TS ...@@ -81,9 +81,9 @@ void InsertBuiltInFunctions(GLenum type, const ShBuiltInResources &resources, TS
symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpReflect, genType, "reflect", genType, genType); symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpReflect, genType, "reflect", genType, genType);
symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpRefract, genType, "refract", genType, genType, float1); symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpRefract, genType, "refract", genType, genType, float1);
TType *mat2 = new TType(EbtFloat, 2, true); TType *mat2 = new TType(EbtFloat, 2, 2);
TType *mat3 = new TType(EbtFloat, 3, true); TType *mat3 = new TType(EbtFloat, 3, 3);
TType *mat4 = new TType(EbtFloat, 4, true); TType *mat4 = new TType(EbtFloat, 4, 4);
// //
// Matrix Functions. // Matrix Functions.
...@@ -260,7 +260,7 @@ void IdentifyBuiltIns(GLenum shaderType, ...@@ -260,7 +260,7 @@ void IdentifyBuiltIns(GLenum shaderType,
case GL_FRAGMENT_SHADER: case GL_FRAGMENT_SHADER:
{ {
// Set up gl_FragData. The array size. // Set up gl_FragData. The array size.
TType fragData(EbtFloat, EbpMedium, EvqFragData, 4, false, true); TType fragData(EbtFloat, EbpMedium, EvqFragData, 4, 1, true);
fragData.setArraySize(resources.MaxDrawBuffers); fragData.setArraySize(resources.MaxDrawBuffers);
symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_FragData"), fragData)); symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString("gl_FragData"), fragData));
} }
......
...@@ -697,6 +697,7 @@ bool TIntermBinary::promote(TInfoSink& infoSink) ...@@ -697,6 +697,7 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
} }
int size = std::max(left->getNominalSize(), right->getNominalSize()); int size = std::max(left->getNominalSize(), right->getNominalSize());
int matrixSize = std::max(left->getSecondarySize(), right->getSecondarySize()); // FIXME: This will have to change for NxM matrices
// //
// All scalars. Code after this test assumes this case is removed! // All scalars. Code after this test assumes this case is removed!
...@@ -746,6 +747,12 @@ bool TIntermBinary::promote(TInfoSink& infoSink) ...@@ -746,6 +747,12 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
return false; return false;
} }
if (left->getSecondarySize() != right->getSecondarySize()) {
// Operator cannot be of type pure assignment.
if (op == EOpAssign || op == EOpInitialize)
return false;
}
// //
// Can these two operands be combined? // Can these two operands be combined?
// //
...@@ -757,12 +764,12 @@ bool TIntermBinary::promote(TInfoSink& infoSink) ...@@ -757,12 +764,12 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
op = EOpVectorTimesMatrix; op = EOpVectorTimesMatrix;
else { else {
op = EOpMatrixTimesScalar; op = EOpMatrixTimesScalar;
setType(TType(basicType, higherPrecision, EvqTemporary, size, true)); setType(TType(basicType, higherPrecision, EvqTemporary, size, matrixSize));
} }
} else if (left->isMatrix() && !right->isMatrix()) { } else if (left->isMatrix() && !right->isMatrix()) {
if (right->isVector()) { if (right->isVector()) {
op = EOpMatrixTimesVector; op = EOpMatrixTimesVector;
setType(TType(basicType, higherPrecision, EvqTemporary, size, false)); setType(TType(basicType, higherPrecision, EvqTemporary, size, 1));
} else { } else {
op = EOpMatrixTimesScalar; op = EOpMatrixTimesScalar;
} }
...@@ -773,7 +780,7 @@ bool TIntermBinary::promote(TInfoSink& infoSink) ...@@ -773,7 +780,7 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
// leave as component product // leave as component product
} else if (left->isVector() || right->isVector()) { } else if (left->isVector() || right->isVector()) {
op = EOpVectorTimesScalar; op = EOpVectorTimesScalar;
setType(TType(basicType, higherPrecision, EvqTemporary, size, false)); setType(TType(basicType, higherPrecision, EvqTemporary, size, 1));
} }
} else { } else {
infoSink.info.message(EPrefixInternalError, "Missing elses", getLine()); infoSink.info.message(EPrefixInternalError, "Missing elses", getLine());
...@@ -802,7 +809,7 @@ bool TIntermBinary::promote(TInfoSink& infoSink) ...@@ -802,7 +809,7 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
if (! left->isVector()) if (! left->isVector())
return false; return false;
op = EOpVectorTimesScalarAssign; op = EOpVectorTimesScalarAssign;
setType(TType(basicType, higherPrecision, EvqTemporary, size, false)); setType(TType(basicType, higherPrecision, EvqTemporary, size, 1));
} }
} else { } else {
infoSink.info.message(EPrefixInternalError, "Missing elses", getLine()); infoSink.info.message(EPrefixInternalError, "Missing elses", getLine());
...@@ -821,7 +828,7 @@ bool TIntermBinary::promote(TInfoSink& infoSink) ...@@ -821,7 +828,7 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
if ((left->isMatrix() && right->isVector()) || if ((left->isMatrix() && right->isVector()) ||
(left->isVector() && right->isMatrix())) (left->isVector() && right->isMatrix()))
return false; return false;
setType(TType(basicType, higherPrecision, EvqTemporary, size, left->isMatrix() || right->isMatrix())); setType(TType(basicType, higherPrecision, EvqTemporary, size, matrixSize));
break; break;
case EOpEqual: case EOpEqual:
...@@ -1288,6 +1295,6 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC ...@@ -1288,6 +1295,6 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
const TType& t = node->getType(); const TType& t = node->getType();
return addConstantUnion(leftUnionArray, TType(promoteTo, t.getPrecision(), t.getQualifier(), t.getNominalSize(), t.isMatrix(), t.isArray()), node->getLine()); return addConstantUnion(leftUnionArray, TType(promoteTo, t.getPrecision(), t.getQualifier(), t.getNominalSize(), t.getSecondarySize(), t.isArray()), node->getLine());
} }
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#define GL_APICALL #define GL_APICALL
#include <GLES2/gl2.h> #include <GLES2/gl2.h>
#include <GLES2/gl2ext.h> #include <GLES2/gl2ext.h>
#include <GLES3/gl3.h>
namespace glsl namespace glsl
{ {
...@@ -33,7 +34,7 @@ namespace glsl ...@@ -33,7 +34,7 @@ namespace glsl
class Temporary : public TIntermSymbol class Temporary : public TIntermSymbol
{ {
public: public:
Temporary(OutputASM *assembler) : TIntermSymbol(0, "tmp", TType(EbtFloat, EbpHigh, EvqTemporary, 4, false, false)), assembler(assembler) Temporary(OutputASM *assembler) : TIntermSymbol(0, "tmp", TType(EbtFloat, EbpHigh, EvqTemporary, 4, 1, false)), assembler(assembler)
{ {
} }
...@@ -49,7 +50,7 @@ namespace glsl ...@@ -49,7 +50,7 @@ namespace glsl
class Constant : public TIntermConstantUnion class Constant : public TIntermConstantUnion
{ {
public: public:
Constant(float x, float y, float z, float w) : TIntermConstantUnion(constants, TType(EbtFloat, EbpHigh, EvqConstExpr, 4, false, false)) Constant(float x, float y, float z, float w) : TIntermConstantUnion(constants, TType(EbtFloat, EbpHigh, EvqConstExpr, 4, 1, false))
{ {
constants[0].setFConst(x); constants[0].setFConst(x);
constants[1].setFConst(y); constants[1].setFConst(y);
...@@ -57,12 +58,12 @@ namespace glsl ...@@ -57,12 +58,12 @@ namespace glsl
constants[3].setFConst(w); constants[3].setFConst(w);
} }
Constant(bool b) : TIntermConstantUnion(constants, TType(EbtBool, EbpHigh, EvqConstExpr, 1, false, false)) Constant(bool b) : TIntermConstantUnion(constants, TType(EbtBool, EbpHigh, EvqConstExpr, 1, 1, false))
{ {
constants[0].setBConst(b); constants[0].setBConst(b);
} }
Constant(int i) : TIntermConstantUnion(constants, TType(EbtInt, EbpHigh, EvqConstExpr, 1, false, false)) Constant(int i) : TIntermConstantUnion(constants, TType(EbtInt, EbpHigh, EvqConstExpr, 1, 1, false))
{ {
constants[0].setIConst(i); constants[0].setIConst(i);
} }
...@@ -2357,9 +2358,30 @@ namespace glsl ...@@ -2357,9 +2358,30 @@ namespace glsl
{ {
switch(type.getNominalSize()) switch(type.getNominalSize())
{ {
case 2: return GL_FLOAT_MAT2; case 2:
case 3: return GL_FLOAT_MAT3; switch(type.getSecondarySize())
case 4: return GL_FLOAT_MAT4; {
case 2: return GL_FLOAT_MAT2;
case 3: return GL_FLOAT_MAT2x3;
case 4: return GL_FLOAT_MAT2x4;
default: UNREACHABLE();
}
case 3:
switch(type.getSecondarySize())
{
case 2: return GL_FLOAT_MAT3x2;
case 3: return GL_FLOAT_MAT3;
case 4: return GL_FLOAT_MAT4x2;
default: UNREACHABLE();
}
case 4:
switch(type.getSecondarySize())
{
case 2: return GL_FLOAT_MAT4x2;
case 3: return GL_FLOAT_MAT4x3;
case 4: return GL_FLOAT_MAT4;
default: UNREACHABLE();
}
default: UNREACHABLE(); default: UNREACHABLE();
} }
} }
......
...@@ -580,7 +580,7 @@ bool TParseContext::boolErrorCheck(int line, const TIntermTyped* type) ...@@ -580,7 +580,7 @@ bool TParseContext::boolErrorCheck(int line, const TIntermTyped* type)
// //
bool TParseContext::boolErrorCheck(int line, const TPublicType& pType) bool TParseContext::boolErrorCheck(int line, const TPublicType& pType)
{ {
if (pType.type != EbtBool || pType.array || pType.matrix || (pType.size > 1)) { if (pType.type != EbtBool || pType.array || (pType.primarySize > 1) || (pType.secondarySize > 1)) {
error(line, "boolean expression expected", ""); error(line, "boolean expression expected", "");
return true; return true;
} }
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
int TSymbolTableLevel::uniqueId = 0; int TSymbolTableLevel::uniqueId = 0;
TType::TType(const TPublicType &p) : TType::TType(const TPublicType &p) :
type(p.type), precision(p.precision), qualifier(p.qualifier), size(p.size), matrix(p.matrix), array(p.array), arraySize(p.arraySize), type(p.type), precision(p.precision), primarySize(p.primarySize), secondarySize(p.secondarySize), qualifier(p.qualifier), array(p.array), arraySize(p.arraySize),
maxArraySize(0), arrayInformationType(0), structure(0), structureSize(0), deepestStructNesting(0), fieldName(0), mangled(0), typeName(0) maxArraySize(0), arrayInformationType(0), structure(0), structureSize(0), deepestStructNesting(0), fieldName(0), mangled(0), typeName(0)
{ {
if (p.userDef) if (p.userDef)
......
...@@ -439,7 +439,7 @@ public: ...@@ -439,7 +439,7 @@ public:
return true; // Skip sampler types for the time being return true; // Skip sampler types for the time being
if (type.type != EbtFloat && type.type != EbtInt) if (type.type != EbtFloat && type.type != EbtInt)
return false; // Only set default precision for int/float return false; // Only set default precision for int/float
if (type.size != 1 || type.matrix || type.array) if (type.primarySize > 1 || type.secondarySize > 1 || type.array)
return false; // Not allowed to set for aggregate types return false; // Not allowed to set for aggregate types
int indexOfLastElement = static_cast<int>(precisionStack.size()) - 1; int indexOfLastElement = static_cast<int>(precisionStack.size()) - 1;
precisionStack[indexOfLastElement][type.type] = prec; // Uses map operator [], overwrites the current value precisionStack[indexOfLastElement][type.type] = prec; // Uses map operator [], overwrites the current value
......
...@@ -39,19 +39,19 @@ class TType ...@@ -39,19 +39,19 @@ class TType
public: public:
POOL_ALLOCATOR_NEW_DELETE(); POOL_ALLOCATOR_NEW_DELETE();
TType() {} TType() {}
TType(TBasicType t, int s = 1, bool m = false) : TType(TBasicType t, int s0 = 1, int s1 = 1) :
type(t), precision(EbpUndefined), qualifier(EvqGlobal), size(s), matrix(m), array(false), arraySize(0), type(t), precision(EbpUndefined), qualifier(EvqGlobal), primarySize(s0), secondarySize(s1), array(false), arraySize(0),
maxArraySize(0), arrayInformationType(0), structure(0), structureSize(0), deepestStructNesting(0), fieldName(0), mangled(0), typeName(0) maxArraySize(0), arrayInformationType(0), structure(0), structureSize(0), deepestStructNesting(0), fieldName(0), mangled(0), typeName(0)
{ {
} }
TType(TBasicType t, TPrecision p, TQualifier q = EvqTemporary, int s = 1, bool m = false, bool a = false) : TType(TBasicType t, TPrecision p, TQualifier q = EvqTemporary, int s0 = 1, int s1 = 1, bool a = false) :
type(t), precision(p), qualifier(q), size(s), matrix(m), array(a), arraySize(0), type(t), precision(p), qualifier(q), primarySize(s0), secondarySize(s1), array(a), arraySize(0),
maxArraySize(0), arrayInformationType(0), structure(0), structureSize(0), deepestStructNesting(0), fieldName(0), mangled(0), typeName(0) maxArraySize(0), arrayInformationType(0), structure(0), structureSize(0), deepestStructNesting(0), fieldName(0), mangled(0), typeName(0)
{ {
} }
explicit TType(const TPublicType &p); explicit TType(const TPublicType &p);
TType(TTypeList* userDef, const TString& n, TPrecision p = EbpUndefined) : TType(TTypeList* userDef, const TString& n, TPrecision p = EbpUndefined) :
type(EbtStruct), precision(p), qualifier(EvqTemporary), size(1), matrix(false), array(false), arraySize(0), type(EbtStruct), precision(p), qualifier(EvqTemporary), primarySize(1), secondarySize(1), array(false), arraySize(0),
maxArraySize(0), arrayInformationType(0), structure(userDef), structureSize(0), deepestStructNesting(0), fieldName(0), mangled(0) maxArraySize(0), arrayInformationType(0), structure(userDef), structureSize(0), deepestStructNesting(0), fieldName(0), mangled(0)
{ {
typeName = NewPoolTString(n.c_str()); typeName = NewPoolTString(n.c_str());
...@@ -67,8 +67,8 @@ public: ...@@ -67,8 +67,8 @@ public:
void setQualifier(TQualifier q) { qualifier = q; } void setQualifier(TQualifier q) { qualifier = q; }
// One-dimensional size of single instance type // One-dimensional size of single instance type
int getNominalSize() const { return size; } int getNominalSize() const { return primarySize; }
void setNominalSize(int s) { size = s; } void setNominalSize(int s) { primarySize = s; }
// Full size of single instance of type // Full size of single instance of type
int getObjectSize() const int getObjectSize() const
{ {
...@@ -88,13 +88,13 @@ public: ...@@ -88,13 +88,13 @@ public:
{ {
return getStructSize(); return getStructSize();
} }
else if(matrix) else if(isMatrix())
{ {
return size * size; return primarySize * secondarySize;
} }
else // Vector or scalar else // Vector or scalar
{ {
return size; return primarySize;
} }
} }
...@@ -135,8 +135,9 @@ public: ...@@ -135,8 +135,9 @@ public:
} }
} }
bool isMatrix() const { return matrix ? true : false; } bool isMatrix() const { return secondarySize > 1; }
void setMatrix(bool m) { matrix = m; } void setSecondarySize(int s1) { secondarySize = s1; }
int getSecondarySize() const { return secondarySize; }
bool isArray() const { return array ? true : false; } bool isArray() const { return array ? true : false; }
int getArraySize() const { return arraySize; } int getArraySize() const { return arraySize; }
...@@ -147,9 +148,9 @@ public: ...@@ -147,9 +148,9 @@ public:
void setArrayInformationType(TType* t) { arrayInformationType = t; } void setArrayInformationType(TType* t) { arrayInformationType = t; }
TType* getArrayInformationType() const { return arrayInformationType; } TType* getArrayInformationType() const { return arrayInformationType; }
bool isVector() const { return size > 1 && !matrix; } bool isVector() const { return primarySize > 1 && !isMatrix(); }
bool isScalar() const { return size == 1 && !matrix && !structure; } bool isScalar() const { return primarySize == 1 && !isMatrix() && !structure; }
bool isRegister() const { return !matrix && !structure && !array; } // Fits in a 4-element register bool isRegister() const { return !isMatrix() && !structure && !array; } // Fits in a 4-element register
bool isStruct() const { return structure != 0; } bool isStruct() const { return structure != 0; }
bool isScalarInt() const { return isScalar() && (type == EbtInt || type == EbtUInt); } bool isScalarInt() const { return isScalar() && (type == EbtInt || type == EbtUInt); }
...@@ -189,15 +190,15 @@ public: ...@@ -189,15 +190,15 @@ public:
bool sameElementType(const TType& right) const { bool sameElementType(const TType& right) const {
return type == right.type && return type == right.type &&
size == right.size && primarySize == right.primarySize &&
matrix == right.matrix && secondarySize == right.secondarySize &&
structure == right.structure; structure == right.structure;
} }
bool operator==(const TType& right) const { bool operator==(const TType& right) const {
return type == right.type && return type == right.type &&
size == right.size && primarySize == right.primarySize &&
matrix == right.matrix && secondarySize == right.secondarySize &&
array == right.array && (!array || arraySize == right.arraySize) && array == right.array && (!array || arraySize == right.arraySize) &&
structure == right.structure; structure == right.structure;
// don't check the qualifier, it's not ever what's being sought after // don't check the qualifier, it's not ever what's being sought after
} }
...@@ -206,8 +207,8 @@ public: ...@@ -206,8 +207,8 @@ public:
} }
bool operator<(const TType& right) const { bool operator<(const TType& right) const {
if (type != right.type) return type < right.type; if (type != right.type) return type < right.type;
if (size != right.size) return size < right.size; if(primarySize != right.primarySize) return (primarySize * secondarySize) < (right.primarySize * right.secondarySize);
if (matrix != right.matrix) return matrix < right.matrix; if(secondarySize != right.secondarySize) return secondarySize < right.secondarySize;
if (array != right.array) return array < right.array; if (array != right.array) return array < right.array;
if (arraySize != right.arraySize) return arraySize < right.arraySize; if (arraySize != right.arraySize) return arraySize < right.arraySize;
if (structure != right.structure) return structure < right.structure; if (structure != right.structure) return structure < right.structure;
...@@ -244,8 +245,8 @@ protected: ...@@ -244,8 +245,8 @@ protected:
TBasicType type; TBasicType type;
TPrecision precision; TPrecision precision;
TQualifier qualifier; TQualifier qualifier;
unsigned char size; // size of vector or matrix, not size of array unsigned char primarySize; // size of vector or matrix, not size of array
bool matrix; unsigned char secondarySize; // secondarySize: 1 for vectors, >1 for matrices
bool array; bool array;
int arraySize; int arraySize;
int maxArraySize; int maxArraySize;
...@@ -275,8 +276,8 @@ struct TPublicType ...@@ -275,8 +276,8 @@ struct TPublicType
TLayoutQualifier layoutQualifier; TLayoutQualifier layoutQualifier;
TQualifier qualifier; TQualifier qualifier;
TPrecision precision; TPrecision precision;
int size; // size of vector or matrix, not size of array int primarySize; // size of vector or matrix, not size of array
bool matrix; int secondarySize; // 1 for scalars/vectors, >1 for matrices
bool array; bool array;
int arraySize; int arraySize;
TType* userDef; TType* userDef;
...@@ -288,20 +289,26 @@ struct TPublicType ...@@ -288,20 +289,26 @@ struct TPublicType
layoutQualifier = TLayoutQualifier::create(); layoutQualifier = TLayoutQualifier::create();
qualifier = q; qualifier = q;
precision = EbpUndefined; precision = EbpUndefined;
size = 1; primarySize = 1;
matrix = false; secondarySize = 1;
array = false; array = false;
arraySize = 0; arraySize = 0;
userDef = 0; userDef = 0;
line = ln; line = ln;
} }
void setAggregate(int s, bool m = false) void setAggregate(int s)
{ {
size = s; primarySize = s;
matrix = m; secondarySize = 1;
} }
void setMatrix(int s0, int s1)
{
primarySize = s0;
secondarySize = s1;
}
void setArray(bool a, int s = 0) void setArray(bool a, int s = 0)
{ {
array = a; array = a;
......
/* /*
// //
// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2002-2015 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -133,6 +133,17 @@ O [0-7] ...@@ -133,6 +133,17 @@ O [0-7]
"mat3" { context->lexAfterType = true; return(MATRIX3); } "mat3" { context->lexAfterType = true; return(MATRIX3); }
"mat4" { context->lexAfterType = true; return(MATRIX4); } "mat4" { context->lexAfterType = true; return(MATRIX4); }
"mat2x2" { return ES2_identifier_ES3_keyword(context, MATRIX2); }
"mat3x3" { return ES2_identifier_ES3_keyword(context, MATRIX3); }
"mat4x4" { return ES2_identifier_ES3_keyword(context, MATRIX4); }
"mat2x3" { return ES2_identifier_ES3_keyword(context, MATRIX2x3); }
"mat3x2" { return ES2_identifier_ES3_keyword(context, MATRIX3x2); }
"mat2x4" { return ES2_identifier_ES3_keyword(context, MATRIX2x4); }
"mat4x2" { return ES2_identifier_ES3_keyword(context, MATRIX4x2); }
"mat3x4" { return ES2_identifier_ES3_keyword(context, MATRIX3x4); }
"mat4x3" { return ES2_identifier_ES3_keyword(context, MATRIX4x3); }
"vec2" { context->lexAfterType = true; return (VEC2); } "vec2" { context->lexAfterType = true; return (VEC2); }
"vec3" { context->lexAfterType = true; return (VEC3); } "vec3" { context->lexAfterType = true; return (VEC3); }
"vec4" { context->lexAfterType = true; return (VEC4); } "vec4" { context->lexAfterType = true; return (VEC4); }
...@@ -151,7 +162,18 @@ O [0-7] ...@@ -151,7 +162,18 @@ O [0-7]
"samplerExternalOES" { context->lexAfterType = true; return SAMPLER_EXTERNAL_OES; } "samplerExternalOES" { context->lexAfterType = true; return SAMPLER_EXTERNAL_OES; }
"sampler3D" { context->lexAfterType = true; return SAMPLER3D; } "sampler3D" { context->lexAfterType = true; return SAMPLER3D; }
"sampler3DRect" { return ES2_reserved_ES3_keyword(context, SAMPLER3DRECT); } "sampler3DRect" { return ES2_reserved_ES3_keyword(context, SAMPLER3DRECT); }
"sampler2DArray" { return ES2_identifier_ES3_keyword(context, SAMPLER2DARRAY); }
"isampler2D" { return ES2_identifier_ES3_keyword(context, ISAMPLER2D); }
"isampler3D" { return ES2_identifier_ES3_keyword(context, ISAMPLER3D); }
"isamplerCube" { return ES2_identifier_ES3_keyword(context, ISAMPLERCUBE); }
"isampler2DArray" { return ES2_identifier_ES3_keyword(context, ISAMPLER2DARRAY); }
"usampler2D" { return ES2_identifier_ES3_keyword(context, USAMPLER2D); }
"usampler3D" { return ES2_identifier_ES3_keyword(context, USAMPLER3D); }
"usamplerCube" { return ES2_identifier_ES3_keyword(context, USAMPLERCUBE); }
"usampler2DArray" { return ES2_identifier_ES3_keyword(context, USAMPLER2DARRAY); }
"sampler2DShadow" { return ES2_reserved_ES3_keyword(context, SAMPLER2DSHADOW); } "sampler2DShadow" { return ES2_reserved_ES3_keyword(context, SAMPLER2DSHADOW); }
"samplerCubeShadow" { return ES2_identifier_ES3_keyword(context, SAMPLERCUBESHADOW); }
"sampler2DArrayShadow" { return ES2_identifier_ES3_keyword(context, SAMPLER2DARRAYSHADOW); }
"struct" { context->lexAfterType = true; return(STRUCT); } "struct" { context->lexAfterType = true; return(STRUCT); }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -81,72 +81,89 @@ ...@@ -81,72 +81,89 @@
INOUT_QUAL = 297, INOUT_QUAL = 297,
UNIFORM = 298, UNIFORM = 298,
VARYING = 299, VARYING = 299,
CENTROID = 300, MATRIX2x3 = 300,
FLAT = 301, MATRIX3x2 = 301,
SMOOTH = 302, MATRIX2x4 = 302,
STRUCT = 303, MATRIX4x2 = 303,
VOID_TYPE = 304, MATRIX3x4 = 304,
WHILE = 305, MATRIX4x3 = 305,
SAMPLER2D = 306, CENTROID = 306,
SAMPLERCUBE = 307, FLAT = 307,
SAMPLER_EXTERNAL_OES = 308, SMOOTH = 308,
SAMPLER2DRECT = 309, STRUCT = 309,
SAMPLER3D = 310, VOID_TYPE = 310,
SAMPLER3DRECT = 311, WHILE = 311,
SAMPLER2DSHADOW = 312, SAMPLER2D = 312,
LAYOUT = 313, SAMPLERCUBE = 313,
IDENTIFIER = 314, SAMPLER_EXTERNAL_OES = 314,
TYPE_NAME = 315, SAMPLER2DRECT = 315,
FLOATCONSTANT = 316, SAMPLER2DARRAY = 316,
INTCONSTANT = 317, ISAMPLER2D = 317,
UINTCONSTANT = 318, ISAMPLER3D = 318,
BOOLCONSTANT = 319, ISAMPLERCUBE = 319,
FIELD_SELECTION = 320, ISAMPLER2DARRAY = 320,
LEFT_OP = 321, USAMPLER2D = 321,
RIGHT_OP = 322, USAMPLER3D = 322,
INC_OP = 323, USAMPLERCUBE = 323,
DEC_OP = 324, USAMPLER2DARRAY = 324,
LE_OP = 325, SAMPLER3D = 325,
GE_OP = 326, SAMPLER3DRECT = 326,
EQ_OP = 327, SAMPLER2DSHADOW = 327,
NE_OP = 328, SAMPLERCUBESHADOW = 328,
AND_OP = 329, SAMPLER2DARRAYSHADOW = 329,
OR_OP = 330, LAYOUT = 330,
XOR_OP = 331, IDENTIFIER = 331,
MUL_ASSIGN = 332, TYPE_NAME = 332,
DIV_ASSIGN = 333, FLOATCONSTANT = 333,
ADD_ASSIGN = 334, INTCONSTANT = 334,
MOD_ASSIGN = 335, UINTCONSTANT = 335,
LEFT_ASSIGN = 336, BOOLCONSTANT = 336,
RIGHT_ASSIGN = 337, FIELD_SELECTION = 337,
AND_ASSIGN = 338, LEFT_OP = 338,
XOR_ASSIGN = 339, RIGHT_OP = 339,
OR_ASSIGN = 340, INC_OP = 340,
SUB_ASSIGN = 341, DEC_OP = 341,
LEFT_PAREN = 342, LE_OP = 342,
RIGHT_PAREN = 343, GE_OP = 343,
LEFT_BRACKET = 344, EQ_OP = 344,
RIGHT_BRACKET = 345, NE_OP = 345,
LEFT_BRACE = 346, AND_OP = 346,
RIGHT_BRACE = 347, OR_OP = 347,
DOT = 348, XOR_OP = 348,
COMMA = 349, MUL_ASSIGN = 349,
COLON = 350, DIV_ASSIGN = 350,
EQUAL = 351, ADD_ASSIGN = 351,
SEMICOLON = 352, MOD_ASSIGN = 352,
BANG = 353, LEFT_ASSIGN = 353,
DASH = 354, RIGHT_ASSIGN = 354,
TILDE = 355, AND_ASSIGN = 355,
PLUS = 356, XOR_ASSIGN = 356,
STAR = 357, OR_ASSIGN = 357,
SLASH = 358, SUB_ASSIGN = 358,
PERCENT = 359, LEFT_PAREN = 359,
LEFT_ANGLE = 360, RIGHT_PAREN = 360,
RIGHT_ANGLE = 361, LEFT_BRACKET = 361,
VERTICAL_BAR = 362, RIGHT_BRACKET = 362,
CARET = 363, LEFT_BRACE = 363,
AMPERSAND = 364, RIGHT_BRACE = 364,
QUESTION = 365 DOT = 365,
COMMA = 366,
COLON = 367,
EQUAL = 368,
SEMICOLON = 369,
BANG = 370,
DASH = 371,
TILDE = 372,
PLUS = 373,
STAR = 374,
SLASH = 375,
PERCENT = 376,
LEFT_ANGLE = 377,
RIGHT_ANGLE = 378,
VERTICAL_BAR = 379,
CARET = 380,
AMPERSAND = 381,
QUESTION = 382
}; };
#endif #endif
......
...@@ -44,10 +44,10 @@ TString TType::getCompleteString() const ...@@ -44,10 +44,10 @@ TString TType::getCompleteString() const
stream << getQualifierString() << " " << getPrecisionString() << " "; stream << getQualifierString() << " " << getPrecisionString() << " ";
if (array) if (array)
stream << "array of "; stream << "array of ";
if (matrix) if (isMatrix())
stream << size << "X" << size << " matrix of "; stream << primarySize << "X" << secondarySize << " matrix of ";
else if (size > 1) else if(primarySize > 1)
stream << size << "-component vector of "; stream << primarySize << "-component vector of ";
stream << getBasicString(); stream << getBasicString();
return stream.str(); return stream.str();
......
...@@ -161,7 +161,13 @@ enum TOperator { ...@@ -161,7 +161,13 @@ enum TOperator {
EOpConstructUVec3, EOpConstructUVec3,
EOpConstructUVec4, EOpConstructUVec4,
EOpConstructMat2, EOpConstructMat2,
EOpConstructMat2x3,
EOpConstructMat2x4,
EOpConstructMat3x2,
EOpConstructMat3, EOpConstructMat3,
EOpConstructMat3x4,
EOpConstructMat4x2,
EOpConstructMat4x3,
EOpConstructMat4, EOpConstructMat4,
EOpConstructStruct, EOpConstructStruct,
...@@ -247,6 +253,7 @@ public: ...@@ -247,6 +253,7 @@ public:
TQualifier getQualifier() const { return type.getQualifier(); } TQualifier getQualifier() const { return type.getQualifier(); }
TPrecision getPrecision() const { return type.getPrecision(); } TPrecision getPrecision() const { return type.getPrecision(); }
int getNominalSize() const { return type.getNominalSize(); } int getNominalSize() const { return type.getNominalSize(); }
int getSecondarySize() const { return type.getSecondarySize(); }
bool isMatrix() const { return type.isMatrix(); } bool isMatrix() const { return type.isMatrix(); }
bool isArray() const { return type.isArray(); } bool isArray() const { return type.isArray(); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment