-
Notifications
You must be signed in to change notification settings - Fork 72
run-wasm
helper (cargo-run-wasm
) for testing the wgpu runner on the web.
#387
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
Conversation
065edda
to
1ea004b
Compare
run-wasm
helper (cargo-run-wasm
) for testing the wgpu runner on the web.run-wasm
helper (cargo-run-wasm
) for testing the wgpu runner on the web.
I just wanted to rebase and share this branch, but I spent a few minutes on it and I think I fixed all remaining issues (the screenshot in the description is from the current state of the branch). Ironically(?), the sky shader doesn't work because of it demoing pipeline-overridable constants (Vulkan specialization constants), but I am happy to default to the mouse shader because of the interactivity. |
compiled_shader_modules: CompiledShaderModules, | ||
mut compiled_shader_modules: CompiledShaderModules, | ||
) -> wgpu::RenderPipeline { | ||
if options.emulate_push_constants_with_storage_buffer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like it should be somewhere reusable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been a while since I whipped up that transformation, because WebGPU launched w/o push constants:
But given that I'm doing this on the SPIR-V module, before Naga sees it, it should maybe be:
- part of
wgpu
/Naga, which would let otherwgpu
users reuse this emulation- or at least implemented here on Naga IR, then passing WGSL/
naga::Module
towgpu
- or at least implemented here on Naga IR, then passing WGSL/
- done as part of the build script, and potentially implemented in
rustc_codegen_spirv
/SPIR-T- @Firestar99's ideas around a WGSL-outputting target would also be relevant here
- for wasm, it'd likely be best to disable runtime Naga, and embed the WGSL directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loved this demo when I saw it.
Oops, forgot about this. EDIT: oh and |
Originally submitted as:
run-wasm
helper (cargo-run-wasm
) for testing the wgpu runner on the web. EmbarkStudios/rust-gpu#1016(kept below the main part of that description that is still relevant, and updated it)
Had to work around some sRGB complications (and push constants) but it finally works!
rustup target add wasm32-unknown-unknown
(should we add this to
rust-toolchain.toml
?)cargo run-wasm -p example-runner-wgpu
(defaults to serving the result of the build on
http://localhost:8000
)google-chrome-stable --enable-features=Vulkan --enable-unsafe-webgpu http://localhost:8000