14 Apr
2023
14 Apr
'23
9:46 a.m.
Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/hlsl.c:
static struct hlsl_ir_node *clone_if(struct hlsl_ctx *ctx, struct clone_instr_map *map, struct hlsl_ir_if *src) { + struct hlsl_block then_block, else_block; struct hlsl_ir_if *dst;
- if (!(dst = hlsl_new_if(ctx, map_instr(map, src->condition.node), src->node.loc))) + if (!clone_block(ctx, &then_block, &src->then_block, map)) return NULL; + if (!clone_block(ctx, &else_block, &src->else_block, map)) + { + hlsl_free_instr_list(&then_block.instrs);
Not really related to this MR, but why didn't you add `hlsl_block_destroy()`, to keep the encapsulation here too? -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/153#note_30059