HLSL: More clip fix: It is more involved than previous commit. Complete.

This commit is contained in:
John Kessenich 2017-10-16 13:11:53 -06:00
parent 4ce5b562bb
commit 1a4bbc4a95
2 changed files with 11 additions and 4 deletions

View file

@ -88,7 +88,7 @@ gl_FragCoord origin is upper left
0:34 Compare Less Than ( temp bool) 0:34 Compare Less Than ( temp bool)
0:34 'r005' ( temp int) 0:34 'r005' ( temp int)
0:34 Constant: 0:34 Constant:
0:34 0.000000 0:34 0 (const int)
0:34 true case 0:34 true case
0:34 Branch: Kill 0:34 Branch: Kill
0:35 Sequence 0:35 Sequence
@ -2906,7 +2906,7 @@ gl_FragCoord origin is upper left
0:34 Compare Less Than ( temp bool) 0:34 Compare Less Than ( temp bool)
0:34 'r005' ( temp int) 0:34 'r005' ( temp int)
0:34 Constant: 0:34 Constant:
0:34 0.000000 0:34 0 (const int)
0:34 true case 0:34 true case
0:34 Branch: Kill 0:34 Branch: Kill
0:35 Sequence 0:35 Sequence

View file

@ -4503,6 +4503,9 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
std::max(arg0->getType().getMatrixRows(), 1); std::max(arg0->getType().getMatrixRows(), 1);
TConstUnion zero; TConstUnion zero;
if (arg0->getType().isIntegerDomain())
zero.setDConst(0);
else
zero.setDConst(0.0); zero.setDConst(0.0);
TConstUnionArray zeros(constComponentCount, zero); TConstUnionArray zeros(constComponentCount, zero);
@ -4510,7 +4513,11 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
compareNode = intermediate.addBuiltInFunctionCall(loc, EOpAny, true, less, TType(EbtBool)); compareNode = intermediate.addBuiltInFunctionCall(loc, EOpAny, true, less, TType(EbtBool));
} else { } else {
TIntermTyped* zero = intermediate.addConstantUnion(0, type0, loc, true); TIntermTyped* zero;
if (arg0->getType().isIntegerDomain())
zero = intermediate.addConstantUnion(0, loc, true);
else
zero = intermediate.addConstantUnion(0.0, type0, loc, true);
compareNode = handleBinaryMath(loc, "clip", EOpLessThan, arg0, zero); compareNode = handleBinaryMath(loc, "clip", EOpLessThan, arg0, zero);
} }