Skip to content
Snippets Groups Projects

hlsl: Replace bare list pointers with hlsl_block, part 1.

Merged Elizabeth Figura requested to merge zfigura/vkd3d:pr5 into master
2 unresolved threads

This introduces temporary helpers block_to_list and list_to_block.

The job of block_to_list(), at least, could be done by simply writing "&block->instrs" everywhere instead. Using the helper instead ensures that all of these instances will eventually be converted.

Merge request reports

Merge request pipeline #11871 skipped

Merge request pipeline skipped for 9ccba35d

Merged by Alexandre JulliardAlexandre Julliard 1 year ago (Jun 28, 2023 9:03pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
    • +static struct list *block_to_list(struct hlsl_block *block)
      +{
      +    /* This is a temporary hack to ease the transition from lists to blocks.
      +     * It takes advantage of the fact that an allocated hlsl_block pointer is
      +     * byte-compatible with an allocated list pointer. */
      +    return (struct list *)block;
      +}
      +
      +static struct hlsl_block *list_to_block(struct list *list)
      +{
      +    /* This is a temporary hack to ease the transition from lists to blocks.
      +     * It takes advantage of the fact that an allocated hlsl_block pointer is
      +     * byte-compatible with an allocated list pointer. */
      +    return (struct hlsl_block *)list;
      +}

      We probably don't care all that much for something temporary like this, but we could as well have done this properly as "return &block->instrs;" and "return CONTAINING_RECORD(list, struct hlsl_block, instrs);".

    • Author Developer

      Changed since I was resending anyway.

    • Please register or sign in to reply
  • Giovanni Mascellani
    Giovanni Mascellani @giomasce started a thread on an outdated change in commit 980e3ca5
5760 5760 KW_IF '(' expr ')' if_body
5761 5761 {
5762 5762 struct hlsl_ir_node *condition = node_from_list($3);
5763 struct hlsl_block then_block, else_block;
5764 5763 struct hlsl_ir_node *instr;
5765 5764
5766 hlsl_block_init(&then_block);
5767 list_move_tail(&then_block.instrs, $5.then_block);
5768 hlsl_block_init(&else_block);
5769 if ($5.else_block)
5770 list_move_tail(&else_block.instrs, $5.else_block);
5765 if (!(instr = hlsl_new_if(ctx, condition, $5.then_block, $5.else_block, &@1)))
5766 {
5767 vkd3d_free($5.then_block);
  • Elizabeth Figura added 2 commits

    added 2 commits

    • 1626a9f2 - vkd3d-shader/hlsl: Store the "instrs" field of struct parse_initializer as a hlsl_block pointer.
    • a3c07f60 - vkd3d-shader/hlsl: Store the fields of struct parse_if_body as hlsl_block pointers.

    Compare with previous version

  • Elizabeth Figura added 9 commits

    added 9 commits

    • a3c07f60...df0a031a - 4 commits from branch wine:master
    • b653b36e - vkd3d-shader/hlsl: Factor out add_binary_expr_merge().
    • ceac8b7c - vkd3d-shader/hlsl: Use add_unary_arithmetic_expr() in the subtraction rule.
    • 5e57b77a - vkd3d-shader/hlsl: Merge the "discard_statement" rule into "jump_statement".
    • 67c9b02c - vkd3d-shader/hlsl: Store the "instrs" field of struct parse_initializer as a hlsl_block pointer.
    • 651b2a18 - vkd3d-shader/hlsl: Store the fields of struct parse_if_body as hlsl_block pointers.

    Compare with previous version

  • Giovanni Mascellani approved this merge request

    approved this merge request

  • Elizabeth Figura added 42 commits

    added 42 commits

    • 651b2a18...3aee386e - 37 commits from branch wine:master
    • 54caa34f - vkd3d-shader/hlsl: Factor out add_binary_expr_merge().
    • 49b96df8 - vkd3d-shader/hlsl: Use add_unary_arithmetic_expr() in the subtraction rule.
    • 1301907f - vkd3d-shader/hlsl: Merge the "discard_statement" rule into "jump_statement".
    • 3a0e3bb8 - vkd3d-shader/hlsl: Store the "instrs" field of struct parse_initializer as a hlsl_block pointer.
    • 28d93781 - vkd3d-shader/hlsl: Store the fields of struct parse_if_body as hlsl_block pointers.

    Compare with previous version

  • added 1 commit

    • 88731986 - vkd3d-shader/hlsl: Store the fields of struct parse_if_body as hlsl_block pointers.

    Compare with previous version

  • Henri Verbeet approved this merge request

    approved this merge request

  • added 5 commits

    • b4bf5af4 - vkd3d-shader/hlsl: Factor out add_binary_expr_merge().
    • 588784e4 - vkd3d-shader/hlsl: Use add_unary_arithmetic_expr() in the subtraction rule.
    • 7d521db3 - vkd3d-shader/hlsl: Merge the "discard_statement" rule into "jump_statement".
    • 8fa17502 - vkd3d-shader/hlsl: Store the "instrs" field of struct parse_initializer as a hlsl_block pointer.
    • 9ccba35d - vkd3d-shader/hlsl: Store the fields of struct parse_if_body as hlsl_block pointers.

    Compare with previous version

  • Alexandre Julliard approved this merge request

    approved this merge request

  • Please register or sign in to reply
    Loading