vkd3d-shader/hlsl: Return an error expr from hlsl_add_load_component() on allocation failure.

This commit is contained in:
Elizabeth Figura
2024-12-09 13:54:14 -06:00
committed by Henri Verbeet
parent 009f5765df
commit 7b486fe239
Notes: Henri Verbeet 2025-03-05 14:16:50 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Francisco Casas (@fcasas)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1401
2 changed files with 25 additions and 52 deletions

View File

@@ -1153,10 +1153,7 @@ static bool lower_complex_casts(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr
}
dst_comp_type = hlsl_type_get_component_type(ctx, dst_type, dst_idx);
if (!(component_load = hlsl_add_load_component(ctx, block, arg, src_idx, &arg->loc)))
return false;
component_load = hlsl_add_load_component(ctx, block, arg, src_idx, &arg->loc);
cast = hlsl_block_add_cast(ctx, block, component_load, dst_comp_type, &arg->loc);
hlsl_block_add_store_component(ctx, block, &var_deref, dst_idx, cast);
@@ -1200,9 +1197,7 @@ static bool lower_matrix_swizzles(struct hlsl_ctx *ctx, struct hlsl_ir_node *ins
k = swizzle->u.matrix.components[i].y * matrix_type->e.numeric.dimx + swizzle->u.matrix.components[i].x;
if (!(load = hlsl_add_load_component(ctx, block, swizzle->val.node, k, &instr->loc)))
return false;
load = hlsl_add_load_component(ctx, block, swizzle->val.node, k, &instr->loc);
hlsl_block_add_store_component(ctx, block, &var_deref, i, load);
}
@@ -4168,9 +4163,7 @@ static bool lower_discard_neg(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
count = hlsl_type_component_count(cmp_type);
for (i = 0; i < count; ++i)
{
if (!(load = hlsl_add_load_component(ctx, &block, cmp, i, &instr->loc)))
return false;
load = hlsl_add_load_component(ctx, &block, cmp, i, &instr->loc);
or = hlsl_block_add_binary_expr(ctx, &block, HLSL_OP2_LOGIC_OR, or, load);
}