vkd3d-shader: Fold negations of constant integers.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-08-09 21:56:16 -05:00 committed by Alexandre Julliard
parent b956efcaa4
commit ae3df158d8

View File

@ -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];