Skip to content

d3d12: Port from windows to d3d12-agility - #319

Draft
MarijnS95 wants to merge 1 commit into
mainfrom
d3d12-agility
Draft

MarijnS95 wants to merge 1 commit into
mainfrom
d3d12-agility

Conversation

@MarijnS95

Copy link
Copy Markdown
Member

Switches the d3d12 backend from windows to d3d12-agility + windows-core 0.100.

Note

Draft until d3d12-agility is public and published to crates.io. It is currently an internal git dependency, so CI cannot fetch it yet and cargo publish would reject the git-only dependency.

Background

windows 0.100 / windows-sys 0.100 were never published to crates.io (only the smaller windows-core, windows-bindgen, ... crates were; see microsoft/windows-rs#4867). Instead of patching a forked windows across every crate in our tree, D3D12/DXGI bindings now come from d3d12-agility: self-contained bindings generated from the latest DirectX 12 Agility SDK headers on top of windows-core 0.100, so breda and all D3D12-facing libraries share one set of types.

Changes

  • d3d12 = ["dep:d3d12-agility", "dep:windows-core"]; the windows dependency and dev-dependency are gone.
  • Breaking: every D3D12/DXGI type in gpu_allocator::d3d12 (ID3D12Device, ID3D12Device10/12, ID3D12Heap, ID3D12Resource, D3D12_RESOURCE_DESC, D3D12_HEAP_PROPERTIES, D3D12_HEAP_FLAGS, D3D12_CLEAR_VALUE, D3D12_RESOURCE_STATES, D3D12_BARRIER_LAYOUT, DXGI_FORMAT) now comes from d3d12_agility. Enums/flags are plain integer aliases rather than newtypes. gpu-allocator's own signatures are unchanged.
  • E_OUTOFMEMORY / DXGI_ERROR_DEVICE_REMOVED are defined locally as they aren't part of d3d12-agility.
  • MSRV 1.95 crate-wide: the git dependency's edition-2024 manifest must be parsed by Cargo for every target/feature set.

Testing

  • cargo build/clippy -D warnings/test/doc with d3d12 (+ std, hashbrown, visualizer, vulkan) feature combinations on Windows.
  • d3d12-buffer-winrs example ran successfully on a real GPU (FL 12_0).
  • The README was updated by hand; cargo readme should be rerun to confirm it matches.

🤖 Generated with Claude Code

Replace the `windows` crate (0.53..=0.62) with the self-contained
`d3d12-agility` bindings (generated from the D3D12 Agility SDK
1.722-preview headers on top of `windows-core` 0.100), so that the
D3D12 types in our public API are shared with the rest of the
`d3d12-agility` ecosystem.  This is an intentional breaking change:
every D3D12/DXGI type in the `d3d12` module API now comes from
`d3d12_agility` instead of `windows::Win32::Graphics::*`.

- Enums and flags are plain integer aliases now, so `.0` accesses in the
  visualizer are gone.
- `CheckFeatureSupport()` returns a raw `HRESULT` that we `.ok()`.
- Castable formats are passed as explicit count + pointer pairs.
- `E_OUTOFMEMORY` and `DXGI_ERROR_*` codes are not part of
  `d3d12-agility`, so they are defined locally.
- The example no longer needs `windows` either.

`d3d12-agility` requires Rust 1.95 and, being a git dependency with
`edition = "2024"`, its manifest must be parsed by Cargo for every
target and feature set.  Bump the crate MSRV to 1.95 accordingly (also
in CI and the README), which in turn enables `clippy::manual_is_multiple_of`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

1 participant