vkd3d-shader/hlsl: Store boolean constants as unsigned.

With this change it is possible to store booleans as 0xffffffff,
similarly as what happens at runtime.

Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Francisco Casas <fcasas@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:
Giovanni Mascellani
2022-04-05 12:33:12 +02:00
committed by Alexandre Julliard
parent 5b24f7a06c
commit d9dc79de66
5 changed files with 14 additions and 15 deletions

View File

@@ -867,7 +867,7 @@ static unsigned int evaluate_array_dimension(struct hlsl_ir_node *node)
case HLSL_TYPE_DOUBLE:
return value->d;
case HLSL_TYPE_BOOL:
return value->b;
return !!value->u;
default:
assert(0);
return 0;
@@ -3444,7 +3444,7 @@ primary_expr:
if (!(c = hlsl_alloc(ctx, sizeof(*c))))
YYABORT;
init_node(&c->node, HLSL_IR_CONSTANT, hlsl_get_scalar_type(ctx, HLSL_TYPE_BOOL), @1);
c->value[0].b = $1;
c->value[0].u = $1 ? ~0u : 0;
if (!($$ = make_list(ctx, &c->node)))
YYABORT;
}