Skip to content

Miscellaneous improvements in the D3D12 backend #7490

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

Merged

Conversation

cwfitzgerald
Copy link
Member

Connections

Enables work on #4150

Description

This continues the refactoring of D3D12 suballocation internals started #7476. Importantly it now draws the abstraction lines in very easy to understand ways, and allows internal backend code to easily make and destroy buffers without needing to duplicate significant code.

Additionally, there are some smaller changes in here which make life in the D3D12 backend easier.

Previously when the suballocation support was false, the memory counters did nothing. Now with unified code paths, these counters are always as close as possible to accurate.

Testing

CI

Squash or Rebase?

Rebase

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy --tests. If applicable, add:
    • --target wasm32-unknown-unknown
  • Run cargo xtask test to run tests.
  • If this contains user-facing changes, add a CHANGELOG.md entry.

@cwfitzgerald cwfitzgerald requested a review from a team as a code owner April 7, 2025 23:10
Comment on lines +3564 to +3565
// One f32 per pixel, plus one u8 per pixel, with 3 bytes intermediary padding
Self::Depth32FloatStencil8 => 8,
Copy link
Member

Choose a reason for hiding this comment

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

thought: Sorta weird that this is padded to an alignment of 8, but others aren't. 🤔 Wish I knew more about this domain!

Copy link
Member Author

Choose a reason for hiding this comment

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

This is some random bit of knowledge about how... nvidia packs these buffers, iirc. It is two elements, one f32, one u8, but with align 4 on the structure, so you get 3 bytes of padding.

@ErichDonGubler ErichDonGubler merged commit a6d7e0d into gfx-rs:trunk Apr 8, 2025
37 checks passed
@cwfitzgerald cwfitzgerald deleted the cw/d3d12-misc-improvements-2 branch April 8, 2025 02:13
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.

2 participants