hlsl: Return hlsl_ir_node pointers from instruction constructors, part 1.
Merged
hlsl: Return hlsl_ir_node pointers from instruction constructors, part 1.
zfigura/vkd3d:pr0
into
master
3 unresolved threads
3 unresolved threads
The motivation for this is twofold.
Firstly, this makes code a little nicer to read, by virtue of removing a ubiquitous &(...)->node.
Secondly, and more importantly, this allows for the possibility of constructors returning a different instruction type than intended. The ultimate goal here is to return a preallocated "error" instruction when allocation fails, instead of returning NULL and propagating out-of-memory handling to the caller.
Merge request reports
Activity
added 34 commits
-
5ce22b2c...8ed74377 - 29 commits from branch
wine:master
- 79b02ad4 - vkd3d-shader/hlsl: Return an hlsl_ir_node pointer from hlsl_new_bool_constant().
- d5bd523d - vkd3d-shader/hlsl: Return an hlsl_ir_node pointer from hlsl_new_cast() and hlsl_new_copy().
- 5f6c5b1e - vkd3d-shader/hlsl: Return an hlsl_ir_node pointer from hlsl_new_float_constant().
- b1ba2bb9 - vkd3d-shader/hlsl: Pass hlsl_block pointers to hlsl_new_if().
- 4fd616ed - vkd3d-shader/hlsl: Return an hlsl_ir_node pointer from hlsl_new_if().
Toggle commit list-
5ce22b2c...8ed74377 - 29 commits from branch
1210 1210 1211 struct hlsl_ir_if *hlsl_new_if(struct hlsl_ctx *ctx, struct hlsl_ir_node *condition, struct vkd3d_shader_location loc) 1211 struct hlsl_ir_if *hlsl_new_if(struct hlsl_ctx *ctx, struct hlsl_ir_node *condition, 1212 struct hlsl_block *then_block, struct hlsl_block *else_block, const struct vkd3d_shader_location *loc) 1212 1213 { 1213 1214 struct hlsl_ir_if *iff; 1214 1215 1215 1216 if (!(iff = hlsl_alloc(ctx, sizeof(*iff)))) 1216 1217 return NULL; 1217 init_node(&iff->node, HLSL_IR_IF, NULL, &loc); 1218 init_node(&iff->node, HLSL_IR_IF, NULL, loc); 1218 1219 hlsl_src_from_node(&iff->condition, condition); 1219 hlsl_block_init(&iff->then_instrs); 1220 hlsl_block_init(&iff->else_instrs); 1220 hlsl_block_init(&iff->then_block); 1221 list_move_tail(&iff->then_block.instrs, &then_block->instrs); changed this line in version 3 of the diff
1514 1518 1515 1519 static struct hlsl_ir_node *clone_if(struct hlsl_ctx *ctx, struct clone_instr_map *map, struct hlsl_ir_if *src) 1516 1520 { 1521 struct hlsl_block then_block, else_block; 1517 1522 struct hlsl_ir_if *dst; 1518 1523 1519 if (!(dst = hlsl_new_if(ctx, map_instr(map, src->condition.node), src->node.loc))) 1524 if (!clone_block(ctx, &then_block, &src->then_block, map)) 1520 1525 return NULL; 1526 if (!clone_block(ctx, &else_block, &src->else_block, map)) 1527 { 1528 hlsl_free_instr_list(&then_block.instrs); changed this line in version 3 of the diff
1514 1518 1515 1519 static struct hlsl_ir_node *clone_if(struct hlsl_ctx *ctx, struct clone_instr_map *map, struct hlsl_ir_if *src) 1516 1520 { 1521 struct hlsl_block then_block, else_block; 1517 1522 struct hlsl_ir_if *dst; 1518 1523 1519 if (!(dst = hlsl_new_if(ctx, map_instr(map, src->condition.node), src->node.loc))) 1524 if (!clone_block(ctx, &then_block, &src->then_block, map)) added 4 commits
Toggle commit list
Please register or sign in to reply