Commit e9f18fd9 by John Kessenich Committed by GitHub

Merge pull request #831 from steve-lunarg/isfinite

HLSL: fix return type for isfinite
parents ae79697d 9e5a19fd
uniform float f; uniform float f;
uniform float2 f2;
uniform float3 f3;
bool test1(float v)
{
return !isnan(v) && isfinite(v);
}
float4 main() : SV_Target0 float4 main() : SV_Target0
{ {
isfinite(f); isfinite(f);
isfinite(f2);
isfinite(f3);
return 0; return 0;
} }
...@@ -3907,25 +3907,27 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*& ...@@ -3907,25 +3907,27 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
TIntermAggregate* compoundStatement = intermediate.makeAggregate(tmpArgAssign, loc); TIntermAggregate* compoundStatement = intermediate.makeAggregate(tmpArgAssign, loc);
const TType boolType(EbtBool, EvqTemporary, arg0->getVectorSize(), arg0->getMatrixCols(), arg0->getMatrixRows());
TIntermTyped* isnan = handleUnaryMath(loc, "isnan", EOpIsNan, intermediate.addSymbol(*tempArg, loc)); TIntermTyped* isnan = handleUnaryMath(loc, "isnan", EOpIsNan, intermediate.addSymbol(*tempArg, loc));
isnan->setType(TType(EbtBool)); isnan->setType(boolType);
TIntermTyped* notnan = handleUnaryMath(loc, "!", EOpLogicalNot, isnan); TIntermTyped* notnan = handleUnaryMath(loc, "!", EOpLogicalNot, isnan);
notnan->setType(TType(EbtBool)); notnan->setType(boolType);
TIntermTyped* isinf = handleUnaryMath(loc, "isinf", EOpIsInf, intermediate.addSymbol(*tempArg, loc)); TIntermTyped* isinf = handleUnaryMath(loc, "isinf", EOpIsInf, intermediate.addSymbol(*tempArg, loc));
isinf->setType(TType(EbtBool)); isinf->setType(boolType);
TIntermTyped* notinf = handleUnaryMath(loc, "!", EOpLogicalNot, isinf); TIntermTyped* notinf = handleUnaryMath(loc, "!", EOpLogicalNot, isinf);
notinf->setType(TType(EbtBool)); notinf->setType(boolType);
TIntermTyped* andNode = handleBinaryMath(loc, "and", EOpLogicalAnd, notnan, notinf); TIntermTyped* andNode = handleBinaryMath(loc, "and", EOpLogicalAnd, notnan, notinf);
andNode->setType(TType(EbtBool)); andNode->setType(boolType);
compoundStatement = intermediate.growAggregate(compoundStatement, andNode); compoundStatement = intermediate.growAggregate(compoundStatement, andNode);
compoundStatement->setOperator(EOpSequence); compoundStatement->setOperator(EOpSequence);
compoundStatement->setLoc(loc); compoundStatement->setLoc(loc);
compoundStatement->setType(TType(EbtVoid)); compoundStatement->setType(boolType);
node = compoundStatement; node = compoundStatement;
......
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