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
diff --git a/src/compiler/OutputHLSL.cpp b/src/compiler/OutputHLSL.cpp
index 1c52ec4..bb0fc11 100644
--- a/src/compiler/OutputHLSL.cpp
+++ b/src/compiler/OutputHLSL.cpp
@@ -1619,6 +1619,10 @@
default: UNREACHABLE();
}
break;
+ case EbtUInt:
+ // TODO
+ UNIMPLEMENTED();
+ break;
case EbtBool:
switch (node->getLeft()->getNominalSize())
{
@@ -1680,6 +1684,7 @@
case EOpPreIncrement: outputTriplet(visit, "(++", "", ")"); break;
case EOpPreDecrement: outputTriplet(visit, "(--", "", ")"); break;
case EOpConvIntToBool:
+ case EOpConvUnsignedIntToBool:
case EOpConvFloatToBool:
switch (node->getOperand()->getType().getNominalSize())
{
@@ -1692,6 +1697,7 @@
break;
case EOpConvBoolToFloat:
case EOpConvIntToFloat:
+ case EOpConvUnsignedIntToFloat:
switch (node->getOperand()->getType().getNominalSize())
{
case 1: outputTriplet(visit, "float(", "", ")"); break;
@@ -1703,6 +1709,7 @@
break;
case EOpConvFloatToInt:
case EOpConvBoolToInt:
+ case EOpConvUnsignedIntToInt:
switch (node->getOperand()->getType().getNominalSize())
{
case 1: outputTriplet(visit, "int(", "", ")"); break;
@@ -1712,6 +1719,18 @@
default: UNREACHABLE();
}
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 EOpDegrees: outputTriplet(visit, "degrees(", "", ")"); break;
case EOpSin: outputTriplet(visit, "sin(", "", ")"); break;
@@ -2201,6 +2220,10 @@
addConstructor(node->getType(), "ivec4", &node->getSequence());
outputTriplet(visit, "ivec4(", ", ", ")");
break;
+ case EOpConstructUnsignedInt:
+ addConstructor(node->getType(), "uvec1", &node->getSequence());
+ outputTriplet(visit, "uvec1(", "", ")");
+ break;
case EOpConstructMat2:
addConstructor(node->getType(), "mat2", &node->getSequence());
outputTriplet(visit, "mat2(", ", ", ")");
@@ -2856,6 +2879,12 @@
case 3: return "int3";
case 4: return "int4";
}
+ case EbtUInt:
+ switch (type.getCols())
+ {
+ case 1: return "uint";
+ default: UNIMPLEMENTED(); return "error";
+ }
case EbtBool:
switch (type.getNominalSize())
{
@@ -3184,6 +3213,7 @@
{
case EbtFloat: out << std::min(FLT_MAX, std::max(-FLT_MAX, constUnion->getFConst())); break;
case EbtInt: out << constUnion->getIConst(); break;
+ case EbtUInt: out << constUnion->getUConst(); break;
case EbtBool: out << constUnion->getBConst(); break;
default: UNREACHABLE();
}
@@ -3417,6 +3447,18 @@
}
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)
{
if (type.isScalar())
@@ -3462,7 +3504,7 @@
default: UNREACHABLE();
}
}
- else if (type.getBasicType() == EbtInt)
+ else if (type.getBasicType() == EbtInt || type.getBasicType() == EbtUInt)
{
switch (type.getPrecision())
{