Skip to content
Snippets Groups Projects

vkd3d-shader/dxil: Handle some issues with pointers.

Merged Conor McCarthy requested to merge cmccarthy/vkd3d:pointers into master
1 unresolved thread

Forward pointers currently won't work because we don't emit an SSA value for pointers, so we can't allocate an id which will be defined later. Making VSIR support access chains is one way to resolve this. But if we do that, we should probably handle forward referenced resource handles the same way, and it would result in quite a bit of extra backend code. We probably don't need to deal with forward pointers before the next release. It would be nice to have though.

It's difficult to make dxcompiler emit forward pointer refs, so there are no tests for those.

Edited by Conor McCarthy

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Conor McCarthy added 2 commits

    added 2 commits

    • 5d1a1d5c - tests/hlsl: Add a test for constexpr pointer cast.
    • bdc093b9 - vkd3d-shader/dxil: Handle constexpr pointer cast.

    Compare with previous version

  • Conor McCarthy added 6 commits

    added 6 commits

    • 6a307f35 - vkd3d-shader/dxil: Emit an error if a LOAD instruction uses a forward-referenced pointer.
    • 941eb7b5 - vkd3d-shader/dxil: Emit an error if a STORE instruction uses a forward-referenced pointer.
    • 2c161129 - vkd3d-shader/dxil: Emit an error if a ATOMICRMW instruction uses a forward-referenced pointer.
    • 0efbf736 - vkd3d-shader/dxil: Emit an error if a CMPXCHG instruction uses a forward-referenced pointer.
    • 360f3570 - tests/hlsl: Add a test for constexpr pointer cast.
    • 88fc2352 - vkd3d-shader/dxil: Handle constexpr pointer cast.

    Compare with previous version

  • Conor McCarthy added 2 commits

    added 2 commits

    • 04a59825 - tests/hlsl: Add a test for constexpr pointer cast.
    • 4b845e3c - vkd3d-shader/dxil: Handle constexpr pointer cast.

    Compare with previous version

  • even more difficult to arrange forward pointer refs, so there are no tests.

    But have you seen forward constexpr pointer casts in the wild? My concern with the current implementation is that a forward reference might point to a value which is itself a forward reference, and if you just go through them in their definition order you might be copying an invalid register. In theory you'd need to first topologically sort the forward references and then process them in that order. Even if we keep the current implementation we probably want to error out if you find a forward reference (i.e., a register with type VKD3DSPR_COUNT) while resolving forward references.

    • I forgot to edit the description. There are now tests for constexpr pointer casts, and such casts only apply to globals, so forward references are not an issue. The forward pointer problem occurs where a GEP, or perhaps even an ALLOCA, occurs downstream of its use.

    • I still don't feel completely comfortable with the current implementation. Could you add a check that src->u.reg.type != VKD3DSPR_COUNT and fail if it is?

    • Please register or sign in to reply
  • Conor McCarthy changed the description

    changed the description

  • added 1 commit

    • 8538f561 - vkd3d-shader/dxil: Handle constexpr pointer cast.

    Compare with previous version

  • Giovanni Mascellani approved this merge request

    approved this merge request

  • Henri Verbeet approved this merge request

    approved this merge request

  • added 13 commits

    • 8538f561...91762a62 - 7 commits from branch wine:master
    • b4b5af66 - vkd3d-shader/dxil: Emit an error if a LOAD instruction uses a forward-referenced pointer.
    • 9615c389 - vkd3d-shader/dxil: Emit an error if a STORE instruction uses a forward-referenced pointer.
    • b67a68b4 - vkd3d-shader/dxil: Emit an error if a ATOMICRMW instruction uses a forward-referenced pointer.
    • 05510c11 - vkd3d-shader/dxil: Emit an error if a CMPXCHG instruction uses a forward-referenced pointer.
    • 2fc32c3d - tests/hlsl: Add a test for constexpr pointer cast.
    • fb730b11 - vkd3d-shader/dxil: Handle constexpr pointer cast.

    Compare with previous version

  • Alexandre Julliard approved this merge request

    approved this merge request

Please register or sign in to reply
Loading