vkd3d-shader/hlsl: Introduce a hlsl_new_bool_constant() helper.

This commit is contained in:
Zebediah Figura
2022-09-26 18:54:03 -05:00
committed by Alexandre Julliard
parent 4c5fd9c7b9
commit 3fc2fdc37f
Notes: Alexandre Julliard 2022-10-18 00:13:00 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/22
3 changed files with 18 additions and 6 deletions

View File

@@ -2800,7 +2800,7 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
struct hlsl_type *type;
INT intval;
FLOAT floatval;
BOOL boolval;
bool boolval;
char *name;
DWORD modifiers;
struct hlsl_ir_node *instr;
@@ -3857,11 +3857,11 @@ initializer_expr_list:
boolean:
KW_TRUE
{
$$ = TRUE;
$$ = true;
}
| KW_FALSE
{
$$ = FALSE;
$$ = false;
}
statement_list:
@@ -4001,12 +4001,13 @@ primary_expr:
{
struct hlsl_ir_constant *c;
if (!(c = hlsl_alloc(ctx, sizeof(*c))))
if (!(c = hlsl_new_bool_constant(ctx, $1, &@1)))
YYABORT;
init_node(&c->node, HLSL_IR_CONSTANT, hlsl_get_scalar_type(ctx, HLSL_TYPE_BOOL), @1);
c->value[0].u = $1 ? ~0u : 0;
if (!($$ = make_list(ctx, &c->node)))
{
hlsl_free_instr(&c->node);
YYABORT;
}
}
| VAR_IDENTIFIER
{