Skip to content

DX12: Align copies b/w textures and buffers when D3D12_FEATURE_DATA_D3D12_OPTIONS13.UnrestrictedBufferTextureCopyPitchSupported is false #7721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: trunk
Choose a base branch
from

Conversation

ErichDonGubler
Copy link
Member

@ErichDonGubler ErichDonGubler commented May 23, 2025

Connections

Testing

  • @teoxoy and I proved on some custom DLLs copied from an old Windows machine that this works, both on older WARP adapters and when forcefully done in updated DX12 runtimes. So, we're definitely not breaking anything! It's hard to set up an environment to specifically test this, though.

Squash or Rebase?

rebase plz

Checklist

  • If this contains user-facing changes, add a CHANGELOG.md entry.

@ErichDonGubler

This comment was marked as resolved.

@ErichDonGubler ErichDonGubler marked this pull request as ready for review June 13, 2025 07:50
@ErichDonGubler ErichDonGubler requested a review from a team as a code owner June 13, 2025 07:50
@ErichDonGubler ErichDonGubler force-pushed the dx12-aligned-texbuf-copy-offset branch from 60d2d96 to 505438d Compare June 13, 2025 07:53
@teoxoy

This comment was marked as resolved.

@ErichDonGubler

This comment was marked as resolved.

@cwfitzgerald

This comment was marked as resolved.

@ErichDonGubler
Copy link
Member Author

Got the CI issue resolved! I was definitely doing something wrong. 👉🏻👈🏻 From community chat:

@ErichDonGubler:

I just paired with Teo, and we actually FIGGERED IT OUT!

@teoxoy and I sideloaded a bunch of DLLs from an ancient Windows 10 computer I had, which happened to have a WARP adapter that did not support low-alignment buffer-to-texture copies.

...turns out I accidentally swapped the alignment requirement branches. 😅

We had to work around:

  • Not having the right DLLs (because new versions have lower alignment needs) and stealing them from an old machine I happened to have around.
  • Crashing when trying to compile indirect buffer validation shaders (because old versions?)
  • Feature unification working against us when trying to use WGPU_VALIDATION_INDIRECT_CALL=0
  • Erich being dumb and necessitating debugging in the first place

It was an hours-long adventure, lemmetellyawhat.

@teoxoy:

It was fun :)

@cwfitzgerald:

oh boy!

that sounds like an adventure indeed

@ErichDonGubler ErichDonGubler force-pushed the dx12-aligned-texbuf-copy-offset branch 3 times, most recently from 335c9ab to fd850ff Compare July 25, 2025 21:16
Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall but we should also enable some CTS tests like the one in #5285.

Comment on lines +801 to +802
src_offset: orig_offset,
dst_offset: 0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These seem swapped.

copy_info.unwrap().bytes_in_copy
};

let size = wgt::BufferSize::new(size)?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can unwrap here, since it would simplify the code and 0 sized copies shouldn't appear at the hal level.

@ErichDonGubler ErichDonGubler force-pushed the dx12-aligned-texbuf-copy-offset branch from 5fa4092 to 698316c Compare August 6, 2025 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[d3d12] Panic in end_encoding
3 participants