Conversation
# Conflicts: # crates/bevy_render/src/options.rs # Conflicts: # crates/bevy_render/src/options.rs
| "bevy_internal/bevy_ui", | ||
| ] | ||
|
|
||
| spirv_shader_passthrough = ["bevy_internal/spirv_shader_passthrough" ] |
There was a problem hiding this comment.
Please add this to the feature docs and note that it is incompatible with wasm.
There was a problem hiding this comment.
And any other system which doesn't support spirv, i.e dx12 and metal, afaik.
There was a problem hiding this comment.
I think it is only compatible with Vulkan. Maybe easier to say that.
There was a problem hiding this comment.
@molikto please add documentation of the feature to docs/cargo_features.md and make note that it is only supported for Vulkan, if that is indeed correct.
|
I am more in favor of #3997 so until we decided which PR to take I am not addressing comments to this PR :-) |
superdump
left a comment
There was a problem hiding this comment.
I made a couple of suggestions that allow enabling the feature but not failing if the backend does not support it, rather falling back to non-passthrough behaviour. Code that wants/needs passthrough can then used RenderDevice::features() to check for support at runtime and load the appropriate shader.
Co-authored-by: Robert Swain <robert.swain@gmail.com>
Co-authored-by: Robert Swain <robert.swain@gmail.com>
Co-authored-by: Robert Swain <robert.swain@gmail.com>
superdump
left a comment
There was a problem hiding this comment.
This looks good to me but it needs updating and the build is failing. I prefer this PR to the other one as this one allows people to enable the feature if they need it, and if they need it, it is only available based on whether it is actually supported or not as indicated by the render device wgpu::Features.
superdump
left a comment
There was a problem hiding this comment.
LGTM just missing some documentation.
| "bevy_internal/bevy_ui", | ||
| ] | ||
|
|
||
| spirv_shader_passthrough = ["bevy_internal/spirv_shader_passthrough" ] |
There was a problem hiding this comment.
@molikto please add documentation of the feature to docs/cargo_features.md and make note that it is only supported for Vulkan, if that is indeed correct.
|
I’m also confused by this being closed. I was wondering if I would see another PR open in its place… |
|
personally I don't like this approach anymore, it adds a feature flag to bevy and I think it's just confusing for people that don't care about this feature at all. I think maybe a proper solution is when we have asset |
|
I've come across a need for this while developing I've verified that the affected shaders function as intended after manually patching this PR into my own bevy branch. To wit, I'm interested in adopting this PR @cart @superdump; it still compiles with up-to-date bevy, so should be mergeable in its current state if there are no additional changes that might be desirable in hindsight. |
| "bevy_internal/bevy_ui", | ||
| ] | ||
|
|
||
| spirv_shader_passthrough = ["bevy_internal/spirv_shader_passthrough" ] |
|
Great 🙂 will do. Unfortunately it looks like molikto deleted their branch, so I'll have to reimplement and add credit in the commit messages / upcoming PR. Will do some research on the current state of SPIR-V support for various APIs, sort the docs, and open a new pull. |
**Note:** This is an adoption of @Shfty 's adoption (#8131) of #3996! All I've done is updated the branch and run the docs CI. > **Note:** This is an adoption of #3996, originally authored by @molikto > > # Objective > Allow use of `wgpu::Features::SPIRV_SHADER_PASSTHROUGH` and the corresponding `wgpu::Device::create_shader_module_spirv` for SPIR-V shader assets. > > This enables use-cases where naga is not sufficient to load a given (valid) SPIR-V module, i.e. cases where naga lacks support for a given SPIR-V feature employed by a third-party codegen backend like `rust-gpu`. > > ## Solution > * Reimplemented the changes from [Spirv shader bypass #3996](#3996), on account of the original branch having been deleted. > * Documented the new `spirv_shader_passthrough` feature flag with the appropriate platform support context from [wgpu's documentation](https://docs.rs/wgpu/latest/wgpu/struct.Features.html#associatedconstant.SPIRV_SHADER_PASSTHROUGH). > > ## Changelog > * Adds a `spirv_shader_passthrough` feature flag to the following crates: > > * `bevy` > * `bevy_internal` > * `bevy_render` > * Extends `RenderDevice::create_shader_module` with a conditional call to `wgpu::Device::create_shader_module_spirv` if `spirv_shader_passthrough` is enabled and `wgpu::Features::SPIRV_SHADER_PASSTHROUGH` is present for the current platform. > * Documents the relevant `wgpu` platform support in `docs/cargo_features.md` --------- Co-authored-by: Josh Palmer <1253239+Shfty@users.noreply.github.com> Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Objective
Expose wgpu spirv-shader-passthrough as a bevy feature.
Solution
add a feature to
bevy_renderandbevyitself.alternative: #3997
More alternative:
passthrough.spv(But I didn't implement these, because the passthrough is hopefully only temporary, and I don't see why people want some passthrough but some doesn't.)