vkd3d-shader/hlsl: Fold floating point maximum expressions.

This commit is contained in:
Giovanni Mascellani 2023-06-09 22:30:12 +02:00 committed by Alexandre Julliard
parent 358d656262
commit 2a2943c2cf
Notes: Alexandre Julliard 2023-06-27 23:34:59 +02:00
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/232

View File

@ -497,6 +497,15 @@ static bool fold_max(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, cons
{ {
switch (type) switch (type)
{ {
case HLSL_TYPE_FLOAT:
case HLSL_TYPE_HALF:
dst->u[k].f = fmaxf(src1->value.u[k].f, src2->value.u[k].f);
break;
case HLSL_TYPE_DOUBLE:
dst->u[k].d = fmax(src1->value.u[k].d, src2->value.u[k].d);
break;
case HLSL_TYPE_INT: case HLSL_TYPE_INT:
dst->u[k].i = max(src1->value.u[k].i, src2->value.u[k].i); dst->u[k].i = max(src1->value.u[k].i, src2->value.u[k].i);
break; break;