Skip to content

Conversation

inner-daemons
Copy link
Collaborator

@inner-daemons inner-daemons commented Aug 16, 2025

Connections
Addresses #7219, a sub-issue of #7197

Description
This adds a DX12 backend for mesh shaders

Current issues:

  • Limits aren't calculated properly
  • In the pipeline stream descriptor, we could figure out the maximum length and possibly avoid allocations and vec's if that's desirable

Testing
I have updated the mesh shader example to use DXILpassthrough to test this, and it works.

Squash or Rebase?
Squash

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.

@inner-daemons inner-daemons requested a review from a team as a code owner August 16, 2025 04:01
@inner-daemons inner-daemons marked this pull request as draft August 16, 2025 04:01
@inner-daemons inner-daemons mentioned this pull request Aug 15, 2025
34 tasks
@inner-daemons inner-daemons marked this pull request as ready for review August 16, 2025 20:22
@cwfitzgerald cwfitzgerald changed the title Mesh shading/dx12 backend [hal/dx12] Mesh Shaders Aug 20, 2025
@inner-daemons inner-daemons mentioned this pull request Aug 24, 2025
6 tasks
@inner-daemons
Copy link
Collaborator Author

@cwfitzgerald Going to ping you again, not super urgent but it is something I'd like to get reviewed soon-ish.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds DirectX12 backend support for mesh shaders, expanding WGPU's mesh shader capabilities beyond Vulkan. The implementation includes direct draw commands, indirect draw variants, and proper pipeline state handling for both task and mesh shaders.

  • Implements mesh shader pipeline creation using D3D12's pipeline stream API
  • Adds mesh shader draw command implementations (direct and indirect variants)
  • Updates examples and tests to support both Vulkan and DX12 backends

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
wgpu-hal/src/dx12/mod.rs Adds mesh shader pipeline state stream structure and command signature support
wgpu-hal/src/dx12/device.rs Implements mesh shader pipeline creation and command signature setup
wgpu-hal/src/dx12/command.rs Implements mesh shader draw commands (direct and indirect variants)
wgpu-hal/src/dx12/adapter.rs Adds mesh shader feature detection and limit configuration
tests/tests/wgpu-gpu/mesh_shader/mod.rs Updates tests to support both Vulkan and DX12 backends with shader compilation
examples/features/src/mesh_shader/mod.rs Updates example to support DX12 backend with HLSL shader compilation
naga/src/back/hlsl/mod.rs Adds HLSL stage string mappings for task and mesh shaders

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

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

Got some nits, but we're good here once those are resolved.

@inner-daemons
Copy link
Collaborator Author

@cwfitzgerald I've addressed all comments I think. Good to merge?

@cwfitzgerald
Copy link
Member

CI mad

@inner-daemons
Copy link
Collaborator Author

@cwfitzgerald Should be good now lmao

@cwfitzgerald cwfitzgerald enabled auto-merge (squash) September 25, 2025 03:01
@cwfitzgerald cwfitzgerald enabled auto-merge (squash) September 25, 2025 03:02
@cwfitzgerald cwfitzgerald merged commit 05cc6dc into gfx-rs:trunk Sep 25, 2025
41 checks passed
@vorporeal
Copy link
Contributor

FYI: This PR appears to cause a STATUS_ACCESS_VIOLATION error when trying to initialize a DX12 backend using an Intel(R) Iris(R) Xe Graphics device (driver version 32.0.101.6913).

I bisected commits on trunk, and the commit before this runs fine but this one crashes.

Here's the relevant part of the stack trace, from windbg:

image

Let me know if you'd like me to open an explicit issue for this; figured I'd start by leaving a comment on the offending PR.

@inner-daemons
Copy link
Collaborator Author

inner-daemons commented Oct 3, 2025

@vorporeal Thanks for reporting this and doing the work to bisect it. Definitely file an issue. I won't personally be able to get to this for at least a few days since I'll be away from my windows machine. It seems like it will be a big issue for many people so definitely get it on the radar of more maintainers.

CC: @cwfitzgerald

@cwfitzgerald
Copy link
Member

Yup, definitely file an issue, if you have reproduction code too, that should be good.

@vorporeal
Copy link
Contributor

Filed #8296; will see if I can reproduce with any of the examples and update that issue accordingly.

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.

3 participants