Fix part of #2070: Correctly handle promotion for <unary-op>(int).

This still only handles a scalar correctly, and some
vector cases need additional fixes.
This commit is contained in:
John Kessenich 2020-02-11 06:23:48 -07:00
parent 113d07a6eb
commit abfc4c2ceb
6 changed files with 413 additions and 64 deletions

View file

@ -3237,10 +3237,17 @@ bool TIntermediate::promoteUnary(TIntermUnary& node)
return false;
break;
default:
if (operand->getBasicType() != EbtFloat)
// HLSL uses this path for initial function signature finding for built-ins
// taking a single argument, which generally don't participate in
// operator-based type promotion (type conversion will occur later).
// For now, scalar argument cases are relying on the setType() call below.
if (getSource() == EShSourceHlsl)
break;
// GLSL only allows integer arguments for the cases identified above in the
// case statements.
if (operand->getBasicType() != EbtFloat)
return false;
}