HLSL: Fix boolean conversion bug and add more tests for ?:.

Null-conversion needs the right sized vectors to kick out with matching types.
This commit is contained in:
John Kessenich 2017-04-11 20:17:23 -06:00
parent 636b62db8b
commit b5e739c20e
4 changed files with 626 additions and 472 deletions

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,13 @@ float f;
float4 vectorCond()
{
return (c4 ? t4 : f4) +
(c4 ? t : f );
(c4 ? t : f ) +
(t4 < f4 ? t4 : f4);
}
float2 fbSelect(bool2 cnd, float2 src0, float2 src1)
{
return cnd ? src0 : src1;
}
float4 PixelShaderFunction(float4 input) : COLOR0
@ -24,5 +30,6 @@ float4 PixelShaderFunction(float4 input) : COLOR0
e = a = b ? c = d : 10, b = a ? d = c : 11;
float4 f;
f = ret.x < input.y ? c * input : d * input;
return e * ret + f + vectorCond();
return e * ret + f + vectorCond() +
float4(fbSelect(bool2(true, false), float2(1.0, 2.0), float2(3.0, 4.0)), 10.0, 10.0);
}

View File

@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "Overload400-PrecQual.1992"
#define GLSLANG_REVISION "Overload400-PrecQual.1994"
#define GLSLANG_DATE "11-Apr-2017"

View File

@ -4536,7 +4536,7 @@ TIntermTyped* HlslParseContext::convertConditionalExpression(const TSourceLoc& l
return nullptr;
}
return intermediate.addConversion(EOpConstructBool, TType(EbtBool), condition);
return intermediate.addConversion(EOpConstructBool, TType(EbtBool, EvqTemporary, condition->getVectorSize()), condition);
}
//