mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-28 17:19:11 +01:00
Convert cube, skybox, msaa-line, and mipmap, to WGSL
Validate example shaders in tests Support WGSL on the Web via Naga Port the shadow WGSL partially Convert hello-compute and boids to WGSL Conver the shadow's fragment shader to WGSL Shader entry point refactor
This commit is contained in:
1 parent
c45fbce8b4
commit
74eed253d8
57 files changed
+712
-476
No files matched your search
+9
-1
@@ -1,4 +1,5 @@
|
||||
use std::{
|
||||
collections::HashSet,
|
||||
fmt,
|
||||
future::Future,
|
||||
marker::PhantomData,
|
||||
@@ -1045,7 +1046,14 @@ impl crate::Context for Context {
|
||||
crate::ShaderSource::SpirV(ref spv) => {
|
||||
web_sys::GpuShaderModuleDescriptor::new(&js_sys::Uint32Array::from(&**spv))
|
||||
}
|
||||
crate::ShaderSource::Wgsl(_) => panic!("WGSL is not yet supported by the Web backend"),
|
||||
crate::ShaderSource::Wgsl(ref code) => {
|
||||
use naga::{back::spv, front::wgsl};
|
||||
let module = wgsl::parse_str(code).unwrap();
|
||||
let mut capabilities = HashSet::default();
|
||||
capabilities.insert(spv::Capability::Shader);
|
||||
let words = spv::write_vec(&module, spv::WriterFlags::NONE, capabilities).unwrap();
|
||||
web_sys::GpuShaderModuleDescriptor::new(&js_sys::Uint32Array::from(&words[..]))
|
||||
}
|
||||
};
|
||||
if let Some(ref label) = desc.label {
|
||||
descriptor.label(label);
|
||||
|
||||
Reference in new issue
Block a user