Commit c0f7c619 by Nicolas Capens Committed by Shannon Woods

Fix some uint handling.

TRAC #23185 Signed-off-by: Geoff Lang Signed-off-by: Shannon Woods Author: Nicolas Capens
parent ab60b934
......@@ -24,7 +24,7 @@ public:
void setBConst(bool b) {bConst = b; type = EbtBool; }
int getIConst() const { return iConst; }
int getUConst() const { return uConst; }
unsigned int getUConst() const { return uConst; }
float getFConst() const { return fConst; }
bool getBConst() const { return bConst; }
......
......@@ -1576,21 +1576,22 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
case EOpNegative:
switch (getType().getBasicType())
{
case EbtFloat: tempConstArray[i].setFConst(-unionArray[i].getFConst()); break;
case EbtInt: tempConstArray[i].setIConst(-unionArray[i].getIConst()); break;
default:
infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
return 0;
case EbtFloat: tempConstArray[i].setFConst(-unionArray[i].getFConst()); break;
case EbtInt: tempConstArray[i].setIConst(-unionArray[i].getIConst()); break;
case EbtUInt: tempConstArray[i].setUConst(static_cast<unsigned int>(-static_cast<int>(unionArray[i].getUConst()))); break;
default:
infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
return 0;
}
break;
case EOpLogicalNot: // this code is written for possible future use, will not get executed currently
switch (getType().getBasicType())
{
case EbtBool: tempConstArray[i].setBConst(!unionArray[i].getBConst()); break;
default:
infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
return 0;
case EbtBool: tempConstArray[i].setBConst(!unionArray[i].getBConst()); break;
default:
infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
return 0;
}
break;
......
......@@ -3259,7 +3259,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 EbtInt: out << constUnion->getIConst(); break;
case EbtUInt: out << constUnion->getUConst(); break;
case EbtUInt: out << constUnion->getUConst(); break;
case EbtBool: out << constUnion->getBConst(); break;
default: UNREACHABLE();
}
......
......@@ -237,6 +237,9 @@ bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate* node)
case EOpConstructIVec3: out << "Construct ivec3"; break;
case EOpConstructIVec4: out << "Construct ivec4"; break;
case EOpConstructUInt: out << "Construct uint"; break;
case EOpConstructUVec2: out << "Construct uvec2"; break;
case EOpConstructUVec3: out << "Construct uvec3"; break;
case EOpConstructUVec4: out << "Construct uvec4"; break;
case EOpConstructMat2: out << "Construct mat2"; break;
case EOpConstructMat3: out << "Construct mat3"; break;
case EOpConstructMat4: out << "Construct mat4"; break;
......
......@@ -379,7 +379,7 @@ public:
ConstantUnion* getUnionArrayPointer() const { return unionArrayPointer; }
int getIConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getIConst() : 0; }
int getUConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getUConst() : 0; }
unsigned int getUConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getUConst() : 0; }
float getFConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getFConst() : 0.0f; }
bool getBConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getBConst() : false; }
......
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