Module: vkd3d Branch: master Commit: 2a2943c2cf962c90eda6732288b6bd0c3c873050 URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/2a2943c2cf962c90eda6732288b6bd...
Author: Giovanni Mascellani gmascellani@codeweavers.com Date: Fri Jun 9 22:30:12 2023 +0200
vkd3d-shader/hlsl: Fold floating point maximum expressions.
---
libs/vkd3d-shader/hlsl_constant_ops.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/libs/vkd3d-shader/hlsl_constant_ops.c b/libs/vkd3d-shader/hlsl_constant_ops.c index 00bacbf5..edfc898e 100644 --- a/libs/vkd3d-shader/hlsl_constant_ops.c +++ b/libs/vkd3d-shader/hlsl_constant_ops.c @@ -497,6 +497,15 @@ static bool fold_max(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, cons { 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: dst->u[k].i = max(src1->value.u[k].i, src2->value.u[k].i); break;