From d053f3665da02315ab62e0fd5ee34394dd6c1e9b Mon Sep 17 00:00:00 2001 From: Elizabeth Figura Date: Sun, 8 Dec 2024 23:03:16 -0600 Subject: [PATCH] vkd3d-shader/hlsl: Pass a block to hlsl_new_void_expr(). --- libs/vkd3d-shader/hlsl.c | 2 +- libs/vkd3d-shader/hlsl.h | 3 --- libs/vkd3d-shader/hlsl.y | 25 +++++++------------------ 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 571c7056..80f1af3c 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -1668,7 +1668,7 @@ struct hlsl_ir_node *hlsl_new_null_constant(struct hlsl_ctx *ctx, const struct v return hlsl_new_constant(ctx, ctx->builtin_types.null, &value, loc); } -struct hlsl_ir_node *hlsl_new_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, +static struct hlsl_ir_node *hlsl_new_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, struct hlsl_ir_node *operands[HLSL_MAX_OPERANDS], struct hlsl_type *data_type, const struct vkd3d_shader_location *loc) { diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index f8afbfb6..77253c38 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -1591,9 +1591,6 @@ struct hlsl_ir_node *hlsl_new_cast(struct hlsl_ctx *ctx, struct hlsl_ir_node *no struct hlsl_ir_node *hlsl_new_constant(struct hlsl_ctx *ctx, struct hlsl_type *type, const struct hlsl_constant_value *value, const struct vkd3d_shader_location *loc); struct hlsl_ir_node *hlsl_new_copy(struct hlsl_ctx *ctx, struct hlsl_ir_node *node); -struct hlsl_ir_node *hlsl_new_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, - struct hlsl_ir_node *operands[HLSL_MAX_OPERANDS], - struct hlsl_type *data_type, const struct vkd3d_shader_location *loc); struct hlsl_ir_function_decl *hlsl_new_func_decl(struct hlsl_ctx *ctx, struct hlsl_type *return_type, const struct hlsl_func_parameters *parameters, const struct hlsl_semantic *semantic, const struct vkd3d_shader_location *loc); diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index a292c4d5..afe73744 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -3097,11 +3097,12 @@ static struct hlsl_ir_function_decl *find_function_call(struct hlsl_ctx *ctx, return decl; } -static struct hlsl_ir_node *hlsl_new_void_expr(struct hlsl_ctx *ctx, const struct vkd3d_shader_location *loc) +static void add_void_expr(struct hlsl_ctx *ctx, struct hlsl_block *block, + const struct vkd3d_shader_location *loc) { struct hlsl_ir_node *operands[HLSL_MAX_OPERANDS] = {0}; - return hlsl_new_expr(ctx, HLSL_OP0_VOID, operands, ctx->builtin_types.Void, loc); + hlsl_block_add_expr(ctx, block, HLSL_OP0_VOID, operands, ctx->builtin_types.Void, loc); } static struct hlsl_ir_node *add_user_call(struct hlsl_ctx *ctx, @@ -3221,11 +3222,7 @@ static struct hlsl_ir_node *add_user_call(struct hlsl_ctx *ctx, } else { - struct hlsl_ir_node *expr; - - if (!(expr = hlsl_new_void_expr(ctx, loc))) - return false; - hlsl_block_add_instr(args->instrs, expr); + add_void_expr(ctx, args->instrs, loc); } return call; @@ -5241,8 +5238,7 @@ static bool intrinsic_GetRenderTargetSampleCount(struct hlsl_ctx *ctx, static bool intrinsic_interlocked(struct hlsl_ctx *ctx, enum hlsl_interlocked_op op, const struct parse_initializer *params, const struct vkd3d_shader_location *loc, const char *name) { - struct hlsl_ir_node *lhs, *coords, *val, *cmp_val = NULL, *orig_val = NULL; - struct hlsl_ir_node *interlocked, *void_ret; + struct hlsl_ir_node *interlocked, *lhs, *coords, *val, *cmp_val = NULL, *orig_val = NULL; struct hlsl_type *lhs_type, *val_type; struct vkd3d_string_buffer *string; struct hlsl_deref dst_deref; @@ -5356,10 +5352,7 @@ static bool intrinsic_interlocked(struct hlsl_ctx *ctx, enum hlsl_interlocked_op return false; } - if (!(void_ret = hlsl_new_void_expr(ctx, loc))) - return false; - hlsl_block_add_instr(params->instrs, void_ret); - + add_void_expr(ctx, params->instrs, loc); return true; } @@ -6313,7 +6306,6 @@ static bool add_getdimensions_method_call(struct hlsl_ctx *ctx, struct hlsl_bloc struct hlsl_resource_load_params load_params; struct hlsl_ir_node *sample_info, *res_info; struct hlsl_type *uint_type, *float_type; - struct hlsl_ir_node *void_ret; unsigned int i, j; enum func_argument { @@ -6454,10 +6446,7 @@ static bool add_getdimensions_method_call(struct hlsl_ctx *ctx, struct hlsl_bloc return false; } - if (!(void_ret = hlsl_new_void_expr(ctx, loc))) - return false; - hlsl_block_add_instr(block, void_ret); - + add_void_expr(ctx, block, loc); return true; }