run-wasm helper (cargo-run-wasm) for testing the wgpu runner on the web.#387
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.
This feels like it should be somewhere reusable?
There was a problem hiding this comment.
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 otherwgpuusers reuse this emulation- or at least implemented here on Naga IR, then passing WGSL/
naga::Moduletowgpu
- 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
LegNeato
left a comment
There was a problem hiding this comment.
Loved this demo when I saw it.
Oops, forgot about this. EDIT: oh and |
Originally submitted as:
run-wasmhelper (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