Add asdouble, fma, & mad intrinsics and change profile to allow doubles when parsing prototypes
This commit is contained in:
@@ -1168,6 +1168,35 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
|
||||
break;
|
||||
}
|
||||
|
||||
case EOpAsDouble:
|
||||
{
|
||||
// asdouble accepts two 32 bit ints. we can use EOpUint64BitsToDouble, but must
|
||||
// first construct a uint64.
|
||||
TIntermTyped* arg0 = argAggregate->getSequence()[0]->getAsTyped();
|
||||
TIntermTyped* arg1 = argAggregate->getSequence()[1]->getAsTyped();
|
||||
|
||||
if (arg0->getType().isVector()) { // TODO: ...
|
||||
error(loc, "double2 conversion not implemented", "asdouble", "");
|
||||
break;
|
||||
}
|
||||
|
||||
TIntermAggregate* uint64 = new TIntermAggregate(EOpConstructUVec2);
|
||||
|
||||
uint64->getSequence().push_back(arg0);
|
||||
uint64->getSequence().push_back(arg1);
|
||||
uint64->setType(TType(EbtUint, EvqTemporary, 2)); // convert 2 uints to a uint2
|
||||
uint64->setLoc(loc);
|
||||
|
||||
// bitcast uint2 to a double
|
||||
TIntermTyped* convert = new TIntermUnary(EOpUint64BitsToDouble);
|
||||
convert->getAsUnaryNode()->setOperand(uint64);
|
||||
convert->setLoc(loc);
|
||||
convert->setType(TType(EbtDouble, EvqTemporary));
|
||||
node = convert;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case EOpF16tof32:
|
||||
case EOpF32tof16:
|
||||
{
|
||||
|
||||
@@ -158,9 +158,7 @@ inline bool IsValidGlsl(const char* cname, char retOrder, char retType, char arg
|
||||
const bool isVec = dim0Max > 1 || argType == 'V';
|
||||
const bool isMat = dim1Max > 1 || argType == 'M';
|
||||
|
||||
if (argType == 'D' || // avoid double args
|
||||
retType == 'D' || // avoid double return
|
||||
(isVec && dim0 == 1) || // avoid vec1
|
||||
if ((isVec && dim0 == 1) || // avoid vec1
|
||||
(isMat && dim0 == 1 && dim1 == 1)) // avoid mat1x1
|
||||
return false;
|
||||
|
||||
@@ -582,7 +580,7 @@ void TBuiltInParseablesHlsl::identifyBuiltIns(int version, EProfile profile, con
|
||||
symbolTable.relateToOperator("AllMemoryBarrier", EOpMemoryBarrier);
|
||||
symbolTable.relateToOperator("AllMemoryBarrierWithGroupSync", EOpAllMemoryBarrierWithGroupSync);
|
||||
symbolTable.relateToOperator("any", EOpAny);
|
||||
symbolTable.relateToOperator("asdouble", EOpUint64BitsToDouble);
|
||||
symbolTable.relateToOperator("asdouble", EOpAsDouble);
|
||||
symbolTable.relateToOperator("asfloat", EOpIntBitsToFloat);
|
||||
symbolTable.relateToOperator("asin", EOpAsin);
|
||||
symbolTable.relateToOperator("asint", EOpFloatBitsToInt);
|
||||
@@ -651,7 +649,7 @@ void TBuiltInParseablesHlsl::identifyBuiltIns(int version, EProfile profile, con
|
||||
symbolTable.relateToOperator("log", EOpLog);
|
||||
symbolTable.relateToOperator("log10", EOpLog10);
|
||||
symbolTable.relateToOperator("log2", EOpLog2);
|
||||
// symbolTable.relateToOperator("mad");
|
||||
symbolTable.relateToOperator("mad", EOpFma);
|
||||
symbolTable.relateToOperator("max", EOpMax);
|
||||
symbolTable.relateToOperator("min", EOpMin);
|
||||
symbolTable.relateToOperator("modf", EOpModf);
|
||||
|
||||
Reference in New Issue
Block a user