Commit 33bf7b2f by John Kessenich Committed by GitHub

Merge pull request #974 from LoopDawg/anyall-types

HLSL: handle type conversion for any/all intrinsics
parents 17b5f917 54b9ff9c
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -4101,6 +4101,28 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
break;
}
case EOpAny: // fall through
case EOpAll:
{
TIntermTyped* typedArg = arguments->getAsTyped();
// HLSL allows float/etc types here, and the SPIR-V opcode requires a bool.
// We'll convert here. Note that for efficiency, we could add a smarter
// decomposition for some type cases, e.g, maybe by decomposing a dot product.
if (typedArg->getType().getBasicType() != EbtBool) {
const TType boolType(EbtBool, EvqTemporary,
typedArg->getVectorSize(),
typedArg->getMatrixCols(),
typedArg->getMatrixRows(),
typedArg->isVector());
typedArg = intermediate.addConversion(EOpConstructBool, boolType, typedArg);
node->getAsUnaryNode()->setOperand(typedArg);
}
break;
}
case EOpSaturate:
{
// saturate(a) -> clamp(a,0,1)
......
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