Skip to content

Initial precompiled shaders implementation #7834

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 15 commits into
base: trunk
Choose a base branch
from

Conversation

SupaMaggie70Incorporated
Copy link
Contributor

@SupaMaggie70Incorporated SupaMaggie70Incorporated commented Jun 20, 2025

Connections
Works towards #3103
Depends on #7831

Also, as this is the start of a big change, I'd like to ping @cwfitzgerald to at least make sure I haven't gone off in the wrong direction.

Description
This adds a CreateShaderModuleDescriptorPassthrough::Generic enum variant which contains code for multiple types of shader source,allows creating passthrough shaders without writing backend specific code (if on metal pass MSL, etc). This variant also includes an optional reflection thing. For now, I don't know exactly what reflection info is needed, but if possible, we should make sure this can live in wgpu-types or wgpu-core to avoid dependency on naga. It seems the best model for this is the wgpu_core::validation::Interface, we might just have to replace some of the naga types.

Using this requires enabling the EXPERIMENTAL_PRECOMPILED_SHADERS feature. This feature is only supported on DX12, Vulkan, and Metal. Logic on these backends is otherwise identical to the respective specific passthrough methods.

Nothing is currently done with the reflection info.

An overview of my approach can be found in this comment. If this process takes longer than expected we can make a tracking issue. For now I will be posting updates by editing that comment and referencing it in PRs.

Testing
No testing yet. However, the code seems somewhat small and robust.

Squash pls

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.

@SupaMaggie70Incorporated SupaMaggie70Incorporated marked this pull request as ready for review June 21, 2025 02:45
@SupaMaggie70Incorporated SupaMaggie70Incorporated requested a review from a team as a code owner June 21, 2025 02:45
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