Zebediah Figura : vkd3d-shader: Fold negations of constant integers.

Alexandre Julliard julliard at winehq.org
Wed Aug 11 16:33:48 CDT 2021


Module: vkd3d
Branch: master
Commit: ae3df158d8825274e1054ae5333f2119611b736a
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=ae3df158d8825274e1054ae5333f2119611b736a

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Mon Aug  9 21:56:16 2021 -0500

vkd3d-shader: Fold negations of constant integers.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/vkd3d-shader/hlsl_codegen.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c
index 398be34..bef9ea8 100644
--- a/libs/vkd3d-shader/hlsl_codegen.c
+++ b/libs/vkd3d-shader/hlsl_codegen.c
@@ -401,6 +401,11 @@ static bool fold_constants(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, voi
         {
             switch (expr->op)
             {
+                case HLSL_IR_UNOP_NEG:
+                    for (i = 0; i < instr->data_type->dimx; ++i)
+                        res->value.u[i] = -arg1->value.u[i];
+                    break;
+
                 case HLSL_IR_BINOP_ADD:
                     for (i = 0; i < instr->data_type->dimx; ++i)
                         res->value.u[i] = arg1->value.u[i] + arg2->value.u[i];




More information about the wine-cvs mailing list