Skip to content
Snippets Groups Projects

vkd3d-shader/hlsl: Support SM1 relative addressing of uniforms, version 2.

Merged Francisco Casas requested to merge fcasas/vkd3d:partial_temp_copy_simple2 into master
1 unresolved thread

Basically !1389 (closed) but rebased, removing all the overlapping things with !1388 (merged), and relying on non-constant deref copy-prop.

Merge request reports

Merge request pipeline #40377 skipped

Merge request pipeline skipped for 3ead8d53

Approval is optional

Merged by Henri VerbeetHenri Verbeet 2 weeks ago (Apr 2, 2025 5:43pm UTC)

Merge details

  • Changes merged into master with 3ead8d53.
  • Did not delete the source branch.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Francisco Casas mentioned in merge request !1389 (closed)

    mentioned in merge request !1389 (closed)

  • Francisco Casas added 5 commits

    added 5 commits

    • fbb7a369 - tests: Test SM1 vertex shader uniform allocation on relative addressing.
    • c5d61a41 - vkd3d-shader/d3dbc: Respect idx_count when writing registers.
    • 58f9eaba - vkd3d-shader/hlsl: Support SM1 relative addressing.
    • 0cf4b869 - vkd3d-shader/ir: Normalise MOVA and SM1 relative addressing.
    • 2fc82696 - vkd3d-shader/hlsl: Allow non-constant deref propagation on SM1.

    Compare with previous version

  • Elizabeth Figura approved this merge request

    approved this merge request

  • Henri Verbeet added 6 commits

    added 6 commits

    • d439acd6 - tests/hlsl: Test vertex shader uniform indirect addressing.
    • a1a34693 - tests/hlsl: Test SM1 vertex shader uniform allocation on indirect addressing.
    • 3bab01c5 - vkd3d-shader/d3dbc: Respect "idx_count" when writing registers.
    • 628c00bd - vkd3d-shader/hlsl: Implement indirect addressing for d3dbc target profiles.
    • 456b8e79 - vkd3d-shader/ir: Normalise MOVA and d3dbc indirect addressing.
    • 65a98f93 - vkd3d-shader/hlsl: Allow non-constant deref propagation on SM1.

    Compare with previous version

    • +static enum vkd3d_result vsir_program_normalize_addr(struct vsir_program *program,
      +        struct vsir_transformation_context *ctx)
      +{
      +    struct vkd3d_shader_instruction *ins;
      +    unsigned int tmp_idx = ~0u;
      +    unsigned int i, k, r;
      +
      +    for (i = 0; i < program->instructions.count; ++i)
      +    {
      +        ins = &program->instructions.elements[i];
      +
      +        if (ins->opcode == VKD3DSIH_MOVA)
      +        {
      +            if (tmp_idx == ~0u)
      +                tmp_idx = program->temp_count++;
      +
      +            ins->opcode = VKD3DSIH_FTOU;
      +            vsir_register_init(&ins->dst[0].reg, VKD3DSPR_TEMP, VKD3D_DATA_UINT, 1);
      +            ins->dst[0].reg.idx[0].offset = tmp_idx;
      +            ins->dst[0].reg.dimension = VSIR_DIMENSION_VEC4;
      +        }

      That's not right; MOVA is supposed to round. (See also test_mova() in Wine's d3d9 tests.) We'll likely either want ROUND_NE here, or something similar to lower_round(). Note also that MOVA doesn't exist before vs_2_0, and MOV should be used instead. (And it doesn't round like MOVA.)

      I had started to apply this before noticing that issue, and made some minor fixups; I've pushed those to this MR.

    • Author Developer

      I see, thanks.

      I updated the implementation to perform a ROUND_NE before the FTOU. I also added handling of a plain MOV to an ADDR register and I updated hlsl_codegen.c to generate a MOV in case we work with profiles lower than 2.

    • Please register or sign in to reply
  • Francisco Casas added 6 commits

    added 6 commits

    • 50c19c17 - tests/hlsl: Test vertex shader uniform indirect addressing.
    • c1717e2b - tests/hlsl: Test SM1 vertex shader uniform allocation on indirect addressing.
    • d70b3289 - vkd3d-shader/d3dbc: Respect "idx_count" when writing registers.
    • 1b74e7f2 - vkd3d-shader/hlsl: Implement relative addressing for d3dbc target profiles.
    • 2b0eda94 - vkd3d-shader/ir: Normalise MOVA and d3dbc indirect addressing.
    • e4fbb629 - vkd3d-shader/hlsl: Allow non-constant deref propagation on SM1.

    Compare with previous version

  • Francisco Casas added 6 commits

    added 6 commits

    • 8be0ea50 - tests/hlsl: Test vertex shader uniform relative addressing.
    • 4f93ca8e - tests/hlsl: Test SM1 vertex shader uniform allocation on relative addressing.
    • 1927f62a - vkd3d-shader/d3dbc: Respect "idx_count" when writing registers.
    • 45ee1950 - vkd3d-shader/hlsl: Implement relative addressing for d3dbc target profiles.
    • e6851491 - vkd3d-shader/ir: Normalise MOVA and d3dbc relative addressing.
    • 3d3dfa0d - vkd3d-shader/hlsl: Allow non-constant deref propagation on SM1.

    Compare with previous version

  • Henri Verbeet approved this merge request

    approved this merge request

  • Henri Verbeet added 31 commits

    added 31 commits

    • 3d3dfa0d...20b76f87 - 25 commits from branch wine:master
    • b6ce1479 - tests/hlsl: Test vertex shader uniform indirect addressing.
    • 2327f87e - tests/hlsl: Test SM1 vertex shader uniform allocation on indirect addressing.
    • 0e0ed726 - vkd3d-shader/d3dbc: Respect "idx_count" when writing registers.
    • fd02d69d - vkd3d-shader/hlsl: Implement indirect addressing for d3dbc target profiles.
    • f65e6265 - vkd3d-shader/ir: Normalise MOVA and d3dbc indirect addressing.
    • 3ead8d53 - vkd3d-shader/hlsl: Allow non-constant deref propagation on SM1.

    Compare with previous version

  • merged

Please register or sign in to reply
Loading