Add support for the unsigned integer scalar type to the shader translator.

TRAC #23080 Signed-off-by: Nicolas Capens Signed-off-by: Shannon Woods Author: Jamie Madill git-svn-id: https://angleproject.googlecode.com/svn/branches/es3proto@2403 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 1885113c
...@@ -88,6 +88,7 @@ typedef enum { ...@@ -88,6 +88,7 @@ typedef enum {
typedef enum { typedef enum {
SH_NONE = 0, SH_NONE = 0,
SH_INT = 0x1404, SH_INT = 0x1404,
SH_UNSIGNED_INT = 0x1405,
SH_FLOAT = 0x1406, SH_FLOAT = 0x1406,
SH_FLOAT_VEC2 = 0x8B50, SH_FLOAT_VEC2 = 0x8B50,
SH_FLOAT_VEC3 = 0x8B51, SH_FLOAT_VEC3 = 0x8B51,
...@@ -95,6 +96,9 @@ typedef enum { ...@@ -95,6 +96,9 @@ typedef enum {
SH_INT_VEC2 = 0x8B53, SH_INT_VEC2 = 0x8B53,
SH_INT_VEC3 = 0x8B54, SH_INT_VEC3 = 0x8B54,
SH_INT_VEC4 = 0x8B55, SH_INT_VEC4 = 0x8B55,
SH_UNSIGNED_INT_VEC2 = 0x8DC6,
SH_UNSIGNED_INT_VEC3 = 0x8DC7,
SH_UNSIGNED_INT_VEC4 = 0x8DC8,
SH_BOOL = 0x8B56, SH_BOOL = 0x8B56,
SH_BOOL_VEC2 = 0x8B57, SH_BOOL_VEC2 = 0x8B57,
SH_BOOL_VEC3 = 0x8B58, SH_BOOL_VEC3 = 0x8B58,
......
...@@ -326,6 +326,10 @@ void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType, bool mapLongV ...@@ -326,6 +326,10 @@ void PrintActiveVariables(ShHandle compiler, ShShaderInfo varType, bool mapLongV
case SH_INT_VEC2: typeName = "GL_INT_VEC2"; break; case SH_INT_VEC2: typeName = "GL_INT_VEC2"; break;
case SH_INT_VEC3: typeName = "GL_INT_VEC3"; break; case SH_INT_VEC3: typeName = "GL_INT_VEC3"; break;
case SH_INT_VEC4: typeName = "GL_INT_VEC4"; break; case SH_INT_VEC4: typeName = "GL_INT_VEC4"; break;
case SH_UNSIGNED_INT: typeName = "GL_UNSIGNED_INT"; break;
case SH_UNSIGNED_INT_VEC2: typeName = "GL_UNSIGNED_INT_VEC2"; break;
case SH_UNSIGNED_INT_VEC3: typeName = "GL_UNSIGNED_INT_VEC3"; break;
case SH_UNSIGNED_INT_VEC4: typeName = "GL_UNSIGNED_INT_VEC4"; break;
case SH_BOOL: typeName = "GL_BOOL"; break; case SH_BOOL: typeName = "GL_BOOL"; break;
case SH_BOOL_VEC2: typeName = "GL_BOOL_VEC2"; break; case SH_BOOL_VEC2: typeName = "GL_BOOL_VEC2"; break;
case SH_BOOL_VEC3: typeName = "GL_BOOL_VEC3"; break; case SH_BOOL_VEC3: typeName = "GL_BOOL_VEC3"; break;
......
...@@ -164,6 +164,7 @@ int VariableRowCount(GLenum type) ...@@ -164,6 +164,7 @@ int VariableRowCount(GLenum type)
case GL_BOOL: case GL_BOOL:
case GL_FLOAT: case GL_FLOAT:
case GL_INT: case GL_INT:
case GL_UNSIGNED_INT:
case GL_BOOL_VEC2: case GL_BOOL_VEC2:
case GL_FLOAT_VEC2: case GL_FLOAT_VEC2:
case GL_INT_VEC2: case GL_INT_VEC2:
...@@ -204,6 +205,7 @@ int VariableColumnCount(GLenum type) ...@@ -204,6 +205,7 @@ int VariableColumnCount(GLenum type)
case GL_BOOL: case GL_BOOL:
case GL_FLOAT: case GL_FLOAT:
case GL_INT: case GL_INT:
case GL_UNSIGNED_INT:
case GL_SAMPLER_2D: case GL_SAMPLER_2D:
case GL_SAMPLER_CUBE: case GL_SAMPLER_CUBE:
return 1; return 1;
......
...@@ -77,16 +77,24 @@ const char* getOperatorString(TOperator op) { ...@@ -77,16 +77,24 @@ const char* getOperatorString(TOperator op) {
// Fall-through. // Fall-through.
case EOpConvIntToBool: case EOpConvIntToBool:
case EOpConvUnsignedIntToBool:
case EOpConvFloatToBool: return "bool"; case EOpConvFloatToBool: return "bool";
// Fall-through. // Fall-through.
case EOpConvBoolToFloat: case EOpConvBoolToFloat:
case EOpConvUnsignedIntToFloat:
case EOpConvIntToFloat: return "float"; case EOpConvIntToFloat: return "float";
// Fall-through. // Fall-through.
case EOpConvFloatToInt: case EOpConvFloatToInt:
case EOpConvUnsignedIntToInt:
case EOpConvBoolToInt: return "int"; case EOpConvBoolToInt: return "int";
// Fall-through.
case EOpConvIntToUnsignedInt:
case EOpConvFloatToUnsignedInt:
case EOpConvBoolToUnsignedInt: return "uint";
case EOpRadians: return "radians"; case EOpRadians: return "radians";
case EOpDegrees: return "degrees"; case EOpDegrees: return "degrees";
case EOpSin: return "sin"; case EOpSin: return "sin";
...@@ -315,6 +323,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode, ...@@ -315,6 +323,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode,
TBasicType newType = EbtVoid; TBasicType newType = EbtVoid;
switch (op) { switch (op) {
case EOpConstructInt: newType = EbtInt; break; case EOpConstructInt: newType = EbtInt; break;
case EOpConstructUnsignedInt: newType = EbtUInt; break;
case EOpConstructBool: newType = EbtBool; break; case EOpConstructBool: newType = EbtBool; break;
case EOpConstructFloat: newType = EbtFloat; break; case EOpConstructFloat: newType = EbtFloat; break;
default: break; default: break;
...@@ -335,6 +344,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode, ...@@ -335,6 +344,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode,
// //
switch (op) { switch (op) {
case EOpConstructInt: case EOpConstructInt:
case EOpConstructUnsignedInt:
case EOpConstructBool: case EOpConstructBool:
case EOpConstructFloat: case EOpConstructFloat:
return child; return child;
...@@ -462,6 +472,9 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt ...@@ -462,6 +472,9 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
case EOpConstructInt: case EOpConstructInt:
promoteTo = EbtInt; promoteTo = EbtInt;
break; break;
case EOpConstructUnsignedInt:
promoteTo = EbtUInt;
break;
default: default:
// //
// implicit conversions were removed from the language. // implicit conversions were removed from the language.
...@@ -489,8 +502,9 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt ...@@ -489,8 +502,9 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
switch (promoteTo) { switch (promoteTo) {
case EbtFloat: case EbtFloat:
switch (node->getBasicType()) { switch (node->getBasicType()) {
case EbtInt: newOp = EOpConvIntToFloat; break; case EbtInt: newOp = EOpConvIntToFloat; break;
case EbtBool: newOp = EOpConvBoolToFloat; break; case EbtUInt: newOp = EOpConvFloatToUnsignedInt; break;
case EbtBool: newOp = EOpConvBoolToFloat; break;
default: default:
infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine()); infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine());
return 0; return 0;
...@@ -498,8 +512,9 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt ...@@ -498,8 +512,9 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
break; break;
case EbtBool: case EbtBool:
switch (node->getBasicType()) { switch (node->getBasicType()) {
case EbtInt: newOp = EOpConvIntToBool; break; case EbtInt: newOp = EOpConvIntToBool; break;
case EbtFloat: newOp = EOpConvFloatToBool; break; case EbtUInt: newOp = EOpConvBoolToUnsignedInt; break;
case EbtFloat: newOp = EOpConvFloatToBool; break;
default: default:
infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine()); infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine());
return 0; return 0;
...@@ -507,8 +522,19 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt ...@@ -507,8 +522,19 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
break; break;
case EbtInt: case EbtInt:
switch (node->getBasicType()) { switch (node->getBasicType()) {
case EbtBool: newOp = EOpConvBoolToInt; break; case EbtUInt: newOp = EOpConvUnsignedIntToInt; break;
case EbtFloat: newOp = EOpConvFloatToInt; break; case EbtBool: newOp = EOpConvBoolToInt; break;
case EbtFloat: newOp = EOpConvFloatToInt; break;
default:
infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine());
return 0;
}
break;
case EbtUInt:
switch (node->getBasicType()) {
case EbtInt: newOp = EOpConvIntToUnsignedInt; break;
case EbtBool: newOp = EOpConvBoolToUnsignedInt; break;
case EbtFloat: newOp = EOpConvFloatToUnsignedInt; break;
default: default:
infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine()); infoSink.info.message(EPrefixInternalError, "Bad promotion node", node->getLine());
return 0; return 0;
...@@ -803,6 +829,7 @@ bool TIntermOperator::isConstructor() const ...@@ -803,6 +829,7 @@ bool TIntermOperator::isConstructor() const
case EOpConstructIVec3: case EOpConstructIVec3:
case EOpConstructIVec4: case EOpConstructIVec4:
case EOpConstructInt: case EOpConstructInt:
case EOpConstructUnsignedInt:
case EOpConstructBVec2: case EOpConstructBVec2:
case EOpConstructBVec3: case EOpConstructBVec3:
case EOpConstructBVec4: case EOpConstructBVec4:
...@@ -1281,7 +1308,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod ...@@ -1281,7 +1308,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
{ {
switch (getType().getBasicType()) switch (getType().getBasicType())
{ {
case EbtFloat: case EbtFloat:
if (rightUnionArray[i] == 0.0f) if (rightUnionArray[i] == 0.0f)
{ {
infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", getLine()); infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", getLine());
...@@ -1293,7 +1320,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod ...@@ -1293,7 +1320,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
} }
break; break;
case EbtInt: case EbtInt:
if (rightUnionArray[i] == 0) if (rightUnionArray[i] == 0)
{ {
infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", getLine()); infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", getLine());
...@@ -1305,7 +1332,19 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod ...@@ -1305,7 +1332,19 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
} }
break; break;
default: case EbtUInt:
if (rightUnionArray[i] == 0)
{
infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", getLine());
tempConstArray[i].setUConst(UINT_MAX);
}
else
{
tempConstArray[i].setUConst(unionArray[i].getUConst() / rightUnionArray[i].getUConst());
}
break;
default:
infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"/\"", getLine()); infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"/\"", getLine());
return 0; return 0;
} }
...@@ -1575,6 +1614,9 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC ...@@ -1575,6 +1614,9 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
case EbtInt: case EbtInt:
leftUnionArray[i].setFConst(static_cast<float>(node->getIConst(i))); leftUnionArray[i].setFConst(static_cast<float>(node->getIConst(i)));
break; break;
case EbtUInt:
leftUnionArray[i].setFConst(static_cast<float>(node->getUConst(i)));
break;
case EbtBool: case EbtBool:
leftUnionArray[i].setFConst(static_cast<float>(node->getBConst(i))); leftUnionArray[i].setFConst(static_cast<float>(node->getBConst(i)));
break; break;
...@@ -1591,6 +1633,9 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC ...@@ -1591,6 +1633,9 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
case EbtInt: case EbtInt:
leftUnionArray[i].setIConst(static_cast<int>(node->getIConst(i))); leftUnionArray[i].setIConst(static_cast<int>(node->getIConst(i)));
break; break;
case EbtUInt:
leftUnionArray[i].setIConst(static_cast<int>(node->getUConst(i)));
break;
case EbtBool: case EbtBool:
leftUnionArray[i].setIConst(static_cast<int>(node->getBConst(i))); leftUnionArray[i].setIConst(static_cast<int>(node->getBConst(i)));
break; break;
...@@ -1602,11 +1647,33 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC ...@@ -1602,11 +1647,33 @@ TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermC
return 0; return 0;
} }
break; break;
case EbtUInt:
switch (node->getType().getBasicType()) {
case EbtInt:
leftUnionArray[i].setUConst(static_cast<unsigned int>(node->getIConst(i)));
break;
case EbtUInt:
leftUnionArray[i].setUConst(static_cast<unsigned int>(node->getUConst(i)));
break;
case EbtBool:
leftUnionArray[i].setUConst(static_cast<unsigned int>(node->getBConst(i)));
break;
case EbtFloat:
leftUnionArray[i].setUConst(static_cast<unsigned int>(node->getFConst(i)));
break;
default:
infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
return 0;
}
break;
case EbtBool: case EbtBool:
switch (node->getType().getBasicType()) { switch (node->getType().getBasicType()) {
case EbtInt: case EbtInt:
leftUnionArray[i].setBConst(node->getIConst(i) != 0); leftUnionArray[i].setBConst(node->getIConst(i) != 0);
break; break;
case EbtUInt:
leftUnionArray[i].setBConst(node->getUConst(i) != 0);
break;
case EbtBool: case EbtBool:
leftUnionArray[i].setBConst(node->getBConst(i)); leftUnionArray[i].setBConst(node->getBConst(i));
break; break;
......
...@@ -1619,6 +1619,10 @@ bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node) ...@@ -1619,6 +1619,10 @@ bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node)
default: UNREACHABLE(); default: UNREACHABLE();
} }
break; break;
case EbtUInt:
// TODO
UNIMPLEMENTED();
break;
case EbtBool: case EbtBool:
switch (node->getLeft()->getNominalSize()) switch (node->getLeft()->getNominalSize())
{ {
...@@ -1680,6 +1684,7 @@ bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node) ...@@ -1680,6 +1684,7 @@ bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node)
case EOpPreIncrement: outputTriplet(visit, "(++", "", ")"); break; case EOpPreIncrement: outputTriplet(visit, "(++", "", ")"); break;
case EOpPreDecrement: outputTriplet(visit, "(--", "", ")"); break; case EOpPreDecrement: outputTriplet(visit, "(--", "", ")"); break;
case EOpConvIntToBool: case EOpConvIntToBool:
case EOpConvUnsignedIntToBool:
case EOpConvFloatToBool: case EOpConvFloatToBool:
switch (node->getOperand()->getType().getNominalSize()) switch (node->getOperand()->getType().getNominalSize())
{ {
...@@ -1692,6 +1697,7 @@ bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node) ...@@ -1692,6 +1697,7 @@ bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node)
break; break;
case EOpConvBoolToFloat: case EOpConvBoolToFloat:
case EOpConvIntToFloat: case EOpConvIntToFloat:
case EOpConvUnsignedIntToFloat:
switch (node->getOperand()->getType().getNominalSize()) switch (node->getOperand()->getType().getNominalSize())
{ {
case 1: outputTriplet(visit, "float(", "", ")"); break; case 1: outputTriplet(visit, "float(", "", ")"); break;
...@@ -1703,6 +1709,7 @@ bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node) ...@@ -1703,6 +1709,7 @@ bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node)
break; break;
case EOpConvFloatToInt: case EOpConvFloatToInt:
case EOpConvBoolToInt: case EOpConvBoolToInt:
case EOpConvUnsignedIntToInt:
switch (node->getOperand()->getType().getNominalSize()) switch (node->getOperand()->getType().getNominalSize())
{ {
case 1: outputTriplet(visit, "int(", "", ")"); break; case 1: outputTriplet(visit, "int(", "", ")"); break;
...@@ -1712,6 +1719,18 @@ bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node) ...@@ -1712,6 +1719,18 @@ bool OutputHLSL::visitUnary(Visit visit, TIntermUnary *node)
default: UNREACHABLE(); default: UNREACHABLE();
} }
break; break;
case EOpConvFloatToUnsignedInt:
case EOpConvBoolToUnsignedInt:
case EOpConvIntToUnsignedInt:
switch (node->getOperand()->getType().getCols())
{
case 1: outputTriplet(visit, "uint(", "", ")"); break;
case 2:
case 3:
case 4: UNIMPLEMENTED(); break;
default: UNREACHABLE();
}
break;
case EOpRadians: outputTriplet(visit, "radians(", "", ")"); break; case EOpRadians: outputTriplet(visit, "radians(", "", ")"); break;
case EOpDegrees: outputTriplet(visit, "degrees(", "", ")"); break; case EOpDegrees: outputTriplet(visit, "degrees(", "", ")"); break;
case EOpSin: outputTriplet(visit, "sin(", "", ")"); break; case EOpSin: outputTriplet(visit, "sin(", "", ")"); break;
...@@ -2201,6 +2220,10 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -2201,6 +2220,10 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
addConstructor(node->getType(), "ivec4", &node->getSequence()); addConstructor(node->getType(), "ivec4", &node->getSequence());
outputTriplet(visit, "ivec4(", ", ", ")"); outputTriplet(visit, "ivec4(", ", ", ")");
break; break;
case EOpConstructUnsignedInt:
addConstructor(node->getType(), "uvec1", &node->getSequence());
outputTriplet(visit, "uvec1(", "", ")");
break;
case EOpConstructMat2: case EOpConstructMat2:
addConstructor(node->getType(), "mat2", &node->getSequence()); addConstructor(node->getType(), "mat2", &node->getSequence());
outputTriplet(visit, "mat2(", ", ", ")"); outputTriplet(visit, "mat2(", ", ", ")");
...@@ -2856,6 +2879,12 @@ TString OutputHLSL::typeString(const TType &type) ...@@ -2856,6 +2879,12 @@ TString OutputHLSL::typeString(const TType &type)
case 3: return "int3"; case 3: return "int3";
case 4: return "int4"; case 4: return "int4";
} }
case EbtUInt:
switch (type.getCols())
{
case 1: return "uint";
default: UNIMPLEMENTED(); return "error";
}
case EbtBool: case EbtBool:
switch (type.getNominalSize()) switch (type.getNominalSize())
{ {
...@@ -3184,6 +3213,7 @@ const ConstantUnion *OutputHLSL::writeConstantUnion(const TType &type, const Con ...@@ -3184,6 +3213,7 @@ const ConstantUnion *OutputHLSL::writeConstantUnion(const TType &type, const Con
{ {
case EbtFloat: out << std::min(FLT_MAX, std::max(-FLT_MAX, constUnion->getFConst())); break; case EbtFloat: out << std::min(FLT_MAX, std::max(-FLT_MAX, constUnion->getFConst())); break;
case EbtInt: out << constUnion->getIConst(); break; case EbtInt: out << constUnion->getIConst(); break;
case EbtUInt: out << constUnion->getUConst(); break;
case EbtBool: out << constUnion->getBConst(); break; case EbtBool: out << constUnion->getBConst(); break;
default: UNREACHABLE(); default: UNREACHABLE();
} }
...@@ -3417,6 +3447,18 @@ GLenum OutputHLSL::glVariableType(const TType &type) ...@@ -3417,6 +3447,18 @@ GLenum OutputHLSL::glVariableType(const TType &type)
} }
else UNREACHABLE(); else UNREACHABLE();
} }
else if (type.getBasicType() == EbtUInt)
{
if (type.isScalar())
{
return GL_UNSIGNED_INT;
}
else if (type.isVector())
{
UNIMPLEMENTED();
}
else UNREACHABLE();
}
else if (type.getBasicType() == EbtBool) else if (type.getBasicType() == EbtBool)
{ {
if (type.isScalar()) if (type.isScalar())
...@@ -3462,7 +3504,7 @@ GLenum OutputHLSL::glVariablePrecision(const TType &type) ...@@ -3462,7 +3504,7 @@ GLenum OutputHLSL::glVariablePrecision(const TType &type)
default: UNREACHABLE(); default: UNREACHABLE();
} }
} }
else if (type.getBasicType() == EbtInt) else if (type.getBasicType() == EbtInt || type.getBasicType() == EbtUInt)
{ {
switch (type.getPrecision()) switch (type.getPrecision())
{ {
......
...@@ -396,7 +396,7 @@ bool TParseContext::constErrorCheck(TIntermTyped* node) ...@@ -396,7 +396,7 @@ bool TParseContext::constErrorCheck(TIntermTyped* node)
// //
bool TParseContext::integerErrorCheck(TIntermTyped* node, const char* token) bool TParseContext::integerErrorCheck(TIntermTyped* node, const char* token)
{ {
if (node->getBasicType() == EbtInt && node->isScalar()) if (node->isScalarInt())
return false; return false;
error(node->getLine(), "integer expression required", token); error(node->getLine(), "integer expression required", token);
...@@ -676,17 +676,35 @@ bool TParseContext::containsSampler(TType& type) ...@@ -676,17 +676,35 @@ bool TParseContext::containsSampler(TType& type)
bool TParseContext::arraySizeErrorCheck(int line, TIntermTyped* expr, int& size) bool TParseContext::arraySizeErrorCheck(int line, TIntermTyped* expr, int& size)
{ {
TIntermConstantUnion* constant = expr->getAsConstantUnion(); TIntermConstantUnion* constant = expr->getAsConstantUnion();
if (constant == 0 || constant->getBasicType() != EbtInt) {
if (constant == 0 || !constant->isScalarInt())
{
error(line, "array size must be a constant integer expression", ""); error(line, "array size must be a constant integer expression", "");
return true; return true;
} }
size = constant->getIConst(0); if (constant->getBasicType() == EbtUInt)
{
unsigned int uintSize = constant->getUConst(0);
if (uintSize > static_cast<unsigned int>(std::numeric_limits<int>::max()))
{
error(line, "array size too large", "");
size = 1;
return true;
}
if (size <= 0) { size = static_cast<int>(uintSize);
error(line, "array size must be a positive integer", ""); }
size = 1; else
return true; {
size = constant->getIConst(0);
if (size <= 0)
{
error(line, "array size must be a positive integer", "");
size = 1;
return true;
}
} }
return false; return false;
...@@ -1193,6 +1211,14 @@ TFunction *TParseContext::addConstructorFunc(TPublicType publicType) ...@@ -1193,6 +1211,14 @@ TFunction *TParseContext::addConstructorFunc(TPublicType publicType)
} }
break; break;
case EbtUInt:
switch(publicType.getNominalSize())
{
case 1: op = EOpConstructUnsignedInt; break;
default: UNIMPLEMENTED(); break;
}
break;
case EbtBool: case EbtBool:
switch(publicType.getNominalSize()) switch(publicType.getNominalSize())
{ {
...@@ -1359,6 +1385,10 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType* type, TOperator op, T ...@@ -1359,6 +1385,10 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType* type, TOperator op, T
basicOp = EOpConstructInt; basicOp = EOpConstructInt;
break; break;
case EOpConstructUnsignedInt:
basicOp = EOpConstructUnsignedInt;
break;
case EOpConstructBVec2: case EOpConstructBVec2:
case EOpConstructBVec3: case EOpConstructBVec3:
case EOpConstructBVec4: case EOpConstructBVec4:
......
...@@ -44,6 +44,7 @@ void TType::buildMangledName(TString& mangledName) ...@@ -44,6 +44,7 @@ void TType::buildMangledName(TString& mangledName)
switch (type) { switch (type) {
case EbtFloat: mangledName += 'f'; break; case EbtFloat: mangledName += 'f'; break;
case EbtInt: mangledName += 'i'; break; case EbtInt: mangledName += 'i'; break;
case EbtUInt: mangledName += 'u'; break;
case EbtBool: mangledName += 'b'; break; case EbtBool: mangledName += 'b'; break;
case EbtSampler2D: mangledName += "s2"; break; case EbtSampler2D: mangledName += "s2"; break;
case EbtSamplerCube: mangledName += "sC"; break; case EbtSamplerCube: mangledName += "sC"; break;
......
...@@ -342,6 +342,10 @@ public: ...@@ -342,6 +342,10 @@ public:
// Searches down the precisionStack for a precision qualifier for the specified TBasicType // Searches down the precisionStack for a precision qualifier for the specified TBasicType
TPrecision getDefaultPrecision( TBasicType type){ TPrecision getDefaultPrecision( TBasicType type){
// unsigned integers use the same precision as signed
if (type == EbtUInt) type = EbtInt;
if( type != EbtFloat && type != EbtInt ) return EbpUndefined; if( type != EbtFloat && type != EbtInt ) return EbpUndefined;
int level = static_cast<int>(precisionStack.size()) - 1; int level = static_cast<int>(precisionStack.size()) - 1;
assert( level >= 0); // Just to be safe. Should not happen. assert( level >= 0); // Just to be safe. Should not happen.
......
...@@ -195,6 +195,7 @@ public: ...@@ -195,6 +195,7 @@ public:
bool isVector() const { return primarySize > 1 && secondarySize == 1; } bool isVector() const { return primarySize > 1 && secondarySize == 1; }
bool isScalar() const { return primarySize == 1 && secondarySize == 1 && !structure; } bool isScalar() const { return primarySize == 1 && secondarySize == 1 && !structure; }
bool isScalarInt() const { return isScalar() && (type == EbtInt || type == EbtUInt); }
TTypeList* getStruct() const { return structure; } TTypeList* getStruct() const { return structure; }
void setStruct(TTypeList* s) { structure = s; computeDeepestStructNesting(); } void setStruct(TTypeList* s) { structure = s; computeDeepestStructNesting(); }
......
...@@ -79,6 +79,10 @@ public: ...@@ -79,6 +79,10 @@ public:
case EbtFloat: case EbtFloat:
mUsesFloatLoopIndex = true; mUsesFloatLoopIndex = true;
break; break;
case EbtUInt:
mUsesIntLoopIndex = true;
MarkLoopForUnroll(symbol, mLoopStack);
break;
case EbtInt: case EbtInt:
mUsesIntLoopIndex = true; mUsesIntLoopIndex = true;
MarkLoopForUnroll(symbol, mLoopStack); MarkLoopForUnroll(symbol, mLoopStack);
...@@ -269,7 +273,7 @@ bool ValidateLimitations::validateForLoopInit(TIntermLoop* node, ...@@ -269,7 +273,7 @@ bool ValidateLimitations::validateForLoopInit(TIntermLoop* node,
} }
// The loop index has type int or float. // The loop index has type int or float.
TBasicType type = symbol->getBasicType(); TBasicType type = symbol->getBasicType();
if ((type != EbtInt) && (type != EbtFloat)) { if ((type != EbtInt) && (type != EbtUInt) && (type != EbtFloat)) {
error(symbol->getLine(), error(symbol->getLine(),
"Invalid type for loop index", getBasicString(type)); "Invalid type for loop index", getBasicString(type));
return false; return false;
...@@ -492,7 +496,7 @@ bool ValidateLimitations::validateIndexing(TIntermBinary* node) ...@@ -492,7 +496,7 @@ bool ValidateLimitations::validateIndexing(TIntermBinary* node)
bool valid = true; bool valid = true;
TIntermTyped* index = node->getRight(); TIntermTyped* index = node->getRight();
// The index expression must have integral type. // The index expression must have integral type.
if (!index->isScalar() || (index->getBasicType() != EbtInt)) { if (!index->isScalarInt()) {
error(index->getLine(), error(index->getLine(),
"Index expression must have integral type", "Index expression must have integral type",
index->getCompleteString().c_str()); index->getCompleteString().c_str());
......
...@@ -69,6 +69,19 @@ static ShDataType getVariableDataType(const TType& type) ...@@ -69,6 +69,19 @@ static ShDataType getVariableDataType(const TType& type)
} else { } else {
return SH_INT; return SH_INT;
} }
case EbtUInt:
if (type.isMatrix()) {
UNREACHABLE();
} else if (type.isVector()) {
switch (type.getCols()) {
case 2: return SH_UNSIGNED_INT_VEC2;
case 3: return SH_UNSIGNED_INT_VEC3;
case 4: return SH_UNSIGNED_INT_VEC4;
default: UNREACHABLE();
}
} else {
return SH_UNSIGNED_INT;
}
case EbtBool: case EbtBool:
if (type.isMatrix()) { if (type.isMatrix()) {
UNREACHABLE(); UNREACHABLE();
......
...@@ -119,6 +119,7 @@ O [0-7] ...@@ -119,6 +119,7 @@ O [0-7]
"float" { context->lexAfterType = true; return(FLOAT_TYPE); } "float" { context->lexAfterType = true; return(FLOAT_TYPE); }
"int" { context->lexAfterType = true; return(INT_TYPE); } "int" { context->lexAfterType = true; return(INT_TYPE); }
"uint" { return ES2_ident_ES3_keyword(context, UINT_TYPE); }
"void" { context->lexAfterType = true; return(VOID_TYPE); } "void" { context->lexAfterType = true; return(VOID_TYPE); }
"bool" { context->lexAfterType = true; return(BOOL_TYPE); } "bool" { context->lexAfterType = true; return(BOOL_TYPE); }
"true" { yylval->lex.b = true; return(BOOLCONSTANT); } "true" { yylval->lex.b = true; return(BOOLCONSTANT); }
......
...@@ -122,7 +122,7 @@ extern void yyerror(TParseContext* context, const char* reason); ...@@ -122,7 +122,7 @@ extern void yyerror(TParseContext* context, const char* reason);
%} %}
%token <lex> INVARIANT HIGH_PRECISION MEDIUM_PRECISION LOW_PRECISION PRECISION %token <lex> INVARIANT HIGH_PRECISION MEDIUM_PRECISION LOW_PRECISION PRECISION
%token <lex> ATTRIBUTE CONST_QUAL BOOL_TYPE FLOAT_TYPE INT_TYPE %token <lex> ATTRIBUTE CONST_QUAL BOOL_TYPE FLOAT_TYPE INT_TYPE UINT_TYPE
%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT %token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
%token <lex> BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 VEC2 VEC3 VEC4 %token <lex> BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 VEC2 VEC3 VEC4
%token <lex> MATRIX2 MATRIX3 MATRIX4 IN_QUAL OUT_QUAL INOUT_QUAL UNIFORM VARYING %token <lex> MATRIX2 MATRIX3 MATRIX4 IN_QUAL OUT_QUAL INOUT_QUAL UNIFORM VARYING
...@@ -1458,15 +1458,14 @@ type_specifier_nonarray ...@@ -1458,15 +1458,14 @@ type_specifier_nonarray
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
$$.setBasic(EbtInt, qual, $1.line); $$.setBasic(EbtInt, qual, $1.line);
} }
| UINT_TYPE {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
$$.setBasic(EbtUInt, qual, $1.line);
}
| BOOL_TYPE { | BOOL_TYPE {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
$$.setBasic(EbtBool, qual, $1.line); $$.setBasic(EbtBool, qual, $1.line);
} }
// | UNSIGNED INT_TYPE {
// PACK_UNPACK_ONLY("unsigned", $1.line);
// TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
// $$.setBasic(EbtInt, qual, $1.line);
// }
| VEC2 { | VEC2 {
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
$$.setBasic(EbtFloat, qual, $1.line); $$.setBasic(EbtFloat, qual, $1.line);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -56,104 +56,105 @@ extern int yydebug; ...@@ -56,104 +56,105 @@ extern int yydebug;
BOOL_TYPE = 265, BOOL_TYPE = 265,
FLOAT_TYPE = 266, FLOAT_TYPE = 266,
INT_TYPE = 267, INT_TYPE = 267,
BREAK = 268, UINT_TYPE = 268,
CONTINUE = 269, BREAK = 269,
DO = 270, CONTINUE = 270,
ELSE = 271, DO = 271,
FOR = 272, ELSE = 272,
IF = 273, FOR = 273,
DISCARD = 274, IF = 274,
RETURN = 275, DISCARD = 275,
SWITCH = 276, RETURN = 276,
CASE = 277, SWITCH = 277,
DEFAULT = 278, CASE = 278,
BVEC2 = 279, DEFAULT = 279,
BVEC3 = 280, BVEC2 = 280,
BVEC4 = 281, BVEC3 = 281,
IVEC2 = 282, BVEC4 = 282,
IVEC3 = 283, IVEC2 = 283,
IVEC4 = 284, IVEC3 = 284,
VEC2 = 285, IVEC4 = 285,
VEC3 = 286, VEC2 = 286,
VEC4 = 287, VEC3 = 287,
MATRIX2 = 288, VEC4 = 288,
MATRIX3 = 289, MATRIX2 = 289,
MATRIX4 = 290, MATRIX3 = 290,
IN_QUAL = 291, MATRIX4 = 291,
OUT_QUAL = 292, IN_QUAL = 292,
INOUT_QUAL = 293, OUT_QUAL = 293,
UNIFORM = 294, INOUT_QUAL = 294,
VARYING = 295, UNIFORM = 295,
MATRIX2x3 = 296, VARYING = 296,
MATRIX3x2 = 297, MATRIX2x3 = 297,
MATRIX2x4 = 298, MATRIX3x2 = 298,
MATRIX4x2 = 299, MATRIX2x4 = 299,
MATRIX3x4 = 300, MATRIX4x2 = 300,
MATRIX4x3 = 301, MATRIX3x4 = 301,
CENTROID = 302, MATRIX4x3 = 302,
FLAT = 303, CENTROID = 303,
SMOOTH = 304, FLAT = 304,
STRUCT = 305, SMOOTH = 305,
VOID_TYPE = 306, STRUCT = 306,
WHILE = 307, VOID_TYPE = 307,
SAMPLER2D = 308, WHILE = 308,
SAMPLERCUBE = 309, SAMPLER2D = 309,
SAMPLER_EXTERNAL_OES = 310, SAMPLERCUBE = 310,
SAMPLER2DRECT = 311, SAMPLER_EXTERNAL_OES = 311,
SAMPLER3D = 312, SAMPLER2DRECT = 312,
SAMPLER3DRECT = 313, SAMPLER3D = 313,
SAMPLER2DSHADOW = 314, SAMPLER3DRECT = 314,
IDENTIFIER = 315, SAMPLER2DSHADOW = 315,
TYPE_NAME = 316, IDENTIFIER = 316,
FLOATCONSTANT = 317, TYPE_NAME = 317,
INTCONSTANT = 318, FLOATCONSTANT = 318,
BOOLCONSTANT = 319, INTCONSTANT = 319,
FIELD_SELECTION = 320, BOOLCONSTANT = 320,
LEFT_OP = 321, FIELD_SELECTION = 321,
RIGHT_OP = 322, LEFT_OP = 322,
INC_OP = 323, RIGHT_OP = 323,
DEC_OP = 324, INC_OP = 324,
LE_OP = 325, DEC_OP = 325,
GE_OP = 326, LE_OP = 326,
EQ_OP = 327, GE_OP = 327,
NE_OP = 328, EQ_OP = 328,
AND_OP = 329, NE_OP = 329,
OR_OP = 330, AND_OP = 330,
XOR_OP = 331, OR_OP = 331,
MUL_ASSIGN = 332, XOR_OP = 332,
DIV_ASSIGN = 333, MUL_ASSIGN = 333,
ADD_ASSIGN = 334, DIV_ASSIGN = 334,
MOD_ASSIGN = 335, ADD_ASSIGN = 335,
LEFT_ASSIGN = 336, MOD_ASSIGN = 336,
RIGHT_ASSIGN = 337, LEFT_ASSIGN = 337,
AND_ASSIGN = 338, RIGHT_ASSIGN = 338,
XOR_ASSIGN = 339, AND_ASSIGN = 339,
OR_ASSIGN = 340, XOR_ASSIGN = 340,
SUB_ASSIGN = 341, OR_ASSIGN = 341,
LEFT_PAREN = 342, SUB_ASSIGN = 342,
RIGHT_PAREN = 343, LEFT_PAREN = 343,
LEFT_BRACKET = 344, RIGHT_PAREN = 344,
RIGHT_BRACKET = 345, LEFT_BRACKET = 345,
LEFT_BRACE = 346, RIGHT_BRACKET = 346,
RIGHT_BRACE = 347, LEFT_BRACE = 347,
DOT = 348, RIGHT_BRACE = 348,
COMMA = 349, DOT = 349,
COLON = 350, COMMA = 350,
EQUAL = 351, COLON = 351,
SEMICOLON = 352, EQUAL = 352,
BANG = 353, SEMICOLON = 353,
DASH = 354, BANG = 354,
TILDE = 355, DASH = 355,
PLUS = 356, TILDE = 356,
STAR = 357, PLUS = 357,
SLASH = 358, STAR = 358,
PERCENT = 359, SLASH = 359,
LEFT_ANGLE = 360, PERCENT = 360,
RIGHT_ANGLE = 361, LEFT_ANGLE = 361,
VERTICAL_BAR = 362, RIGHT_ANGLE = 362,
CARET = 363, VERTICAL_BAR = 363,
AMPERSAND = 364, CARET = 364,
QUESTION = 365 AMPERSAND = 365,
QUESTION = 366
}; };
#endif #endif
......
...@@ -153,11 +153,16 @@ bool TOutputTraverser::visitUnary(Visit visit, TIntermUnary* node) ...@@ -153,11 +153,16 @@ bool TOutputTraverser::visitUnary(Visit visit, TIntermUnary* node)
case EOpPreDecrement: out << "Pre-Decrement"; break; case EOpPreDecrement: out << "Pre-Decrement"; break;
case EOpConvIntToBool: out << "Convert int to bool"; break; case EOpConvIntToBool: out << "Convert int to bool"; break;
case EOpConvUnsignedIntToBool: out << "Convert unsigned int to bool"; break;
case EOpConvFloatToBool:out << "Convert float to bool";break; case EOpConvFloatToBool:out << "Convert float to bool";break;
case EOpConvBoolToFloat:out << "Convert bool to float";break; case EOpConvBoolToFloat:out << "Convert bool to float";break;
case EOpConvIntToFloat: out << "Convert int to float"; break; case EOpConvIntToFloat: out << "Convert int to float"; break;
case EOpConvUnsignedIntToFloat: out << "Convert unsigned int to float"; break;
case EOpConvFloatToInt: out << "Convert float to int"; break; case EOpConvFloatToInt: out << "Convert float to int"; break;
case EOpConvBoolToInt: out << "Convert bool to int"; break; case EOpConvBoolToInt: out << "Convert bool to int"; break;
case EOpConvIntToUnsignedInt: out << "Convert int to unsigned int"; break;
case EOpConvFloatToUnsignedInt: out << "Convert float to unsigned int"; break;
case EOpConvBoolToUnsignedInt: out << "Convert bool to unsigned int"; break;
case EOpRadians: out << "radians"; break; case EOpRadians: out << "radians"; break;
case EOpDegrees: out << "degrees"; break; case EOpDegrees: out << "degrees"; break;
...@@ -230,6 +235,7 @@ bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate* node) ...@@ -230,6 +235,7 @@ bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate* node)
case EOpConstructIVec2: out << "Construct ivec2"; break; case EOpConstructIVec2: out << "Construct ivec2"; break;
case EOpConstructIVec3: out << "Construct ivec3"; break; case EOpConstructIVec3: out << "Construct ivec3"; break;
case EOpConstructIVec4: out << "Construct ivec4"; break; case EOpConstructIVec4: out << "Construct ivec4"; break;
case EOpConstructUnsignedInt: out << "Construct uint"; break;
case EOpConstructMat2: out << "Construct mat2"; break; case EOpConstructMat2: out << "Construct mat2"; break;
case EOpConstructMat3: out << "Construct mat3"; break; case EOpConstructMat3: out << "Construct mat3"; break;
case EOpConstructMat4: out << "Construct mat4"; break; case EOpConstructMat4: out << "Construct mat4"; break;
...@@ -334,6 +340,10 @@ void TOutputTraverser::visitConstantUnion(TIntermConstantUnion* node) ...@@ -334,6 +340,10 @@ void TOutputTraverser::visitConstantUnion(TIntermConstantUnion* node)
out << node->getUnionArrayPointer()[i].getIConst(); out << node->getUnionArrayPointer()[i].getIConst();
out << " (const int)\n"; out << " (const int)\n";
break; break;
case EbtUInt:
out << node->getUnionArrayPointer()[i].getUConst();
out << " (const uint)\n";
break;
default: default:
out.message(EPrefixInternalError, "Unknown constant", node->getLine()); out.message(EPrefixInternalError, "Unknown constant", node->getLine());
break; break;
......
...@@ -49,11 +49,17 @@ enum TOperator { ...@@ -49,11 +49,17 @@ enum TOperator {
EOpPreDecrement, EOpPreDecrement,
EOpConvIntToBool, EOpConvIntToBool,
EOpConvUnsignedIntToBool,
EOpConvFloatToBool, EOpConvFloatToBool,
EOpConvBoolToFloat, EOpConvBoolToFloat,
EOpConvIntToFloat, EOpConvIntToFloat,
EOpConvUnsignedIntToFloat,
EOpConvFloatToInt, EOpConvFloatToInt,
EOpConvBoolToInt, EOpConvBoolToInt,
EOpConvUnsignedIntToInt,
EOpConvIntToUnsignedInt,
EOpConvFloatToUnsignedInt,
EOpConvBoolToUnsignedInt,
// //
// binary operations // binary operations
...@@ -155,6 +161,7 @@ enum TOperator { ...@@ -155,6 +161,7 @@ enum TOperator {
// //
EOpConstructInt, EOpConstructInt,
EOpConstructUnsignedInt,
EOpConstructBool, EOpConstructBool,
EOpConstructFloat, EOpConstructFloat,
EOpConstructVec2, EOpConstructVec2,
...@@ -259,6 +266,7 @@ public: ...@@ -259,6 +266,7 @@ public:
bool isArray() const { return type.isArray(); } bool isArray() const { return type.isArray(); }
bool isVector() const { return type.isVector(); } bool isVector() const { return type.isVector(); }
bool isScalar() const { return type.isScalar(); } bool isScalar() const { return type.isScalar(); }
bool isScalarInt() const { return type.isScalarInt(); }
const char* getBasicString() const { return type.getBasicString(); } const char* getBasicString() const { return type.getBasicString(); }
const char* getQualifierString() const { return type.getQualifierString(); } const char* getQualifierString() const { return type.getQualifierString(); }
TString getCompleteString() const { return type.getCompleteString(); } TString getCompleteString() const { return type.getCompleteString(); }
...@@ -368,6 +376,7 @@ public: ...@@ -368,6 +376,7 @@ public:
ConstantUnion* getUnionArrayPointer() const { return unionArrayPointer; } ConstantUnion* getUnionArrayPointer() const { return unionArrayPointer; }
int getIConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getIConst() : 0; } int getIConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getIConst() : 0; }
int getUConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getUConst() : 0; }
float getFConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getFConst() : 0.0f; } float getFConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getFConst() : 0.0f; }
bool getBConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getBConst() : false; } bool getBConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getBConst() : false; }
......
...@@ -50,6 +50,7 @@ namespace gl_d3d ...@@ -50,6 +50,7 @@ namespace gl_d3d
case GL_INT_VEC2: return "int2"; case GL_INT_VEC2: return "int2";
case GL_INT_VEC3: return "int3"; case GL_INT_VEC3: return "int3";
case GL_INT_VEC4: return "int4"; case GL_INT_VEC4: return "int4";
case GL_UNSIGNED_INT: return "uint";
case GL_FLOAT_MAT2: return "float2x2"; case GL_FLOAT_MAT2: return "float2x2";
case GL_FLOAT_MAT3: return "float3x3"; case GL_FLOAT_MAT3: return "float3x3";
case GL_FLOAT_MAT4: return "float4x4"; case GL_FLOAT_MAT4: return "float4x4";
......
...@@ -533,6 +533,10 @@ GLenum Shader::parseType(const std::string &type) ...@@ -533,6 +533,10 @@ GLenum Shader::parseType(const std::string &type)
{ {
return GL_INT_VEC4; return GL_INT_VEC4;
} }
else if (type == "uint")
{
return GL_UNSIGNED_INT;
}
else UNREACHABLE(); else UNREACHABLE();
return GL_NONE; return GL_NONE;
...@@ -560,6 +564,7 @@ static void makeVaryingPriorityMap() ...@@ -560,6 +564,7 @@ static void makeVaryingPriorityMap()
varyingPriorities[GL_INT_VEC2] = 111; varyingPriorities[GL_INT_VEC2] = 111;
varyingPriorities[GL_FLOAT] = 120; varyingPriorities[GL_FLOAT] = 120;
varyingPriorities[GL_INT] = 125; varyingPriorities[GL_INT] = 125;
varyingPriorities[GL_UNSIGNED_INT] = 130;
} }
// true if varying x has a higher priority in packing than y // true if varying x has a higher priority in packing than y
......
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