diff --git a/Cargo.lock b/Cargo.lock index 4fb10dc4..937b65e8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -795,6 +795,12 @@ dependencies = [ "libc", ] +[[package]] +name = "hexf-parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" + [[package]] name = "humantime" version = "2.1.0" @@ -830,6 +836,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" dependencies = [ "cfg-if 1.0.0", + "js-sys", + "wasm-bindgen", + "web-sys", ] [[package]] @@ -840,9 +849,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "js-sys" -version = "0.3.51" +version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83bdfbace3a0e81a4253f73b49e960b053e396a11012cbd49b9b74d6a2b67062" +checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84" dependencies = [ "wasm-bindgen", ] @@ -1016,18 +1025,18 @@ dependencies = [ [[package]] name = "naga" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "568344dfe26b6caee4003da5be57bf8c2ef16d9525a2a5561164bcc462687f92" +version = "0.7.1" +source = "git+https://github.com/gfx-rs/naga?rev=eda078d#eda078d736a906b4267e4803db6b32e3162aac30" dependencies = [ "bit-set", "bitflags", "codespan-reporting", "fxhash", + "hexf-parse", + "indexmap", "log", "num-traits", "petgraph", - "rose_tree", "spirv", "thiserror", ] @@ -1479,15 +1488,6 @@ dependencies = [ "serde", ] -[[package]] -name = "rose_tree" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcd16c61e9205949fa4f8a22096705b4c2f8b8025b2ff67ff6c86afd854039ae" -dependencies = [ - "petgraph", -] - [[package]] name = "rust-ini" version = "0.17.0" @@ -1800,9 +1800,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wasm-bindgen" -version = "0.2.74" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd" +checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -1810,9 +1810,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.74" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900" +checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" dependencies = [ "bumpalo", "lazy_static", @@ -1837,9 +1837,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.74" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4" +checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1847,9 +1847,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.74" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97" +checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" dependencies = [ "proc-macro2", "quote", @@ -1860,9 +1860,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.74" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f" +checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" [[package]] name = "wayland-client" @@ -1939,9 +1939,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.51" +version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e828417b379f3df7111d3a2a9e5753706cae29c41f7c4029ee9fd77f3e09e582" +checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb" dependencies = [ "js-sys", "wasm-bindgen", @@ -1949,8 +1949,8 @@ dependencies = [ [[package]] name = "wgpu" -version = "0.10.1" -source = "git+https://github.com/gfx-rs/wgpu?rev=8f02b73#8f02b73655aff641361822a8ac0347fc47622b49" +version = "0.11.0" +source = "git+https://github.com/gfx-rs/wgpu?rev=47fd776#47fd77619f11a9c008401341f2df95909bce4153" dependencies = [ "arrayvec", "js-sys", @@ -1969,12 +1969,13 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "0.10.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=8f02b73#8f02b73655aff641361822a8ac0347fc47622b49" +version = "0.11.0" +source = "git+https://github.com/gfx-rs/wgpu?rev=47fd776#47fd77619f11a9c008401341f2df95909bce4153" dependencies = [ "arrayvec", "bitflags", "cfg_aliases", + "codespan-reporting", "copyless", "fxhash", "log", @@ -1990,8 +1991,8 @@ dependencies = [ [[package]] name = "wgpu-hal" -version = "0.10.1" -source = "git+https://github.com/gfx-rs/wgpu?rev=8f02b73#8f02b73655aff641361822a8ac0347fc47622b49" +version = "0.11.2" +source = "git+https://github.com/gfx-rs/wgpu?rev=47fd776#47fd77619f11a9c008401341f2df95909bce4153" dependencies = [ "arrayvec", "ash", @@ -2006,6 +2007,7 @@ dependencies = [ "gpu-alloc", "gpu-descriptor", "inplace_it", + "js-sys", "khronos-egl", "libloading 0.7.0", "log", @@ -2013,18 +2015,21 @@ dependencies = [ "naga", "objc", "parking_lot", + "profiling", "range-alloc", "raw-window-handle", "renderdoc-sys", "thiserror", + "wasm-bindgen", + "web-sys", "wgpu-types", "winapi", ] [[package]] name = "wgpu-types" -version = "0.10.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=8f02b73#8f02b73655aff641361822a8ac0347fc47622b49" +version = "0.11.0" +source = "git+https://github.com/gfx-rs/wgpu?rev=47fd776#47fd77619f11a9c008401341f2df95909bce4153" dependencies = [ "bitflags", ] diff --git a/Cargo.toml b/Cargo.toml index ebef2d49..cc246bda 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,7 +60,7 @@ rust-ini = "0.17" serde = "1.0" serde_derive = "1.0" serde_scan = "0.4" -wgpu = { git = "https://github.com/gfx-rs/wgpu", rev = "8f02b73", features = [] } +wgpu = { git = "https://github.com/gfx-rs/wgpu", rev = "47fd776", features = [] } # binaries env_logger = "0.8" getopts = "0.2" @@ -69,8 +69,8 @@ png = "0.16" winit = "0.25" [dev-dependencies] -#naga = { git = "https://github.com/gfx-rs/naga", rev = "7613798", features = ["wgsl-in"] } -naga = { version = "0.6", features = ["wgsl-in"] } +naga = { git = "https://github.com/gfx-rs/naga", rev = "eda078d", features = ["wgsl-in"] } +#naga = { version = "0.6", features = ["wgsl-in"] } [dependencies.profiling] version = "1.0.1" @@ -80,6 +80,7 @@ default-features = false #naga = { path = "../naga" } [patch."https://github.com/gfx-rs/wgpu"] +#wgpu = { path = "../wgpu/wgpu" } #wgpu-hal = { path = "../wgpu/wgpu-hal" } #wgpu-core = { path = "../wgpu/wgpu-core" } #wgpu-types = { path = "../wgpu/wgpu-types" } diff --git a/bin/boilerplate.rs b/bin/boilerplate.rs index 2f5570a8..1425137f 100644 --- a/bin/boilerplate.rs +++ b/bin/boilerplate.rs @@ -79,6 +79,7 @@ impl Harness { .run_until(instance.request_adapter(&wgpu::RequestAdapterOptions { power_preference: wgpu::PowerPreference::HighPerformance, compatible_surface: Some(&surface), + force_fallback_adapter: false, })) .expect("Unable to initialize GPU via the selected backend."); @@ -227,10 +228,9 @@ impl Harness { queue.submit(update_command_buffers); } - match surface.get_current_frame() { + match surface.get_current_texture() { Ok(frame) => { let view = frame - .output .texture .create_view(&wgpu::TextureViewDescriptor::default()); let targets = ScreenTargets { @@ -240,6 +240,7 @@ impl Harness { }; let render_command_buffer = app.draw(&device, targets, &spawner); queue.submit(Some(render_command_buffer)); + frame.present(); } Err(_) => {} }; diff --git a/res/shader/body.inc.wgsl b/res/shader/body.inc.wgsl index 1c79f212..abe652fd 100644 --- a/res/shader/body.inc.wgsl +++ b/res/shader/body.inc.wgsl @@ -36,7 +36,7 @@ struct DragConstants { abs_stop: vec2; coll: vec2; other: vec2; // X = wheel speed, Y = drag Z - _pad: vec2; + padding: vec2; }; struct GlobalConstants { diff --git a/src/render/collision.rs b/src/render/collision.rs index 7007f516..c442fbf5 100644 --- a/src/render/collision.rs +++ b/src/render/collision.rs @@ -247,7 +247,8 @@ impl GpuCollider { contents: bytemuck::bytes_of(&globals), usage: wgpu::BufferUsages::UNIFORM, }); - let locals_size = mem::size_of::().max(wgpu::BIND_BUFFER_ALIGNMENT as usize); + //TODO: device.limits().min_uniform_buffer_offset_alignment + let locals_size = mem::size_of::().max(256); let locals_total_size = (settings.max_objects * locals_size) as wgpu::BufferAddress; let local_uniforms = device.create_buffer(&wgpu::BufferDescriptor { label: Some("Collision Locals"), diff --git a/src/render/global.rs b/src/render/global.rs index 8f6d86c9..6f8708c5 100644 --- a/src/render/global.rs +++ b/src/render/global.rs @@ -65,10 +65,7 @@ impl Context { wgpu::BindGroupLayoutEntry { binding: 1, visibility: wgpu::ShaderStages::all(), - ty: wgpu::BindingType::Sampler { - filtering: true, - comparison: false, - }, + ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering), count: None, }, // GPU store @@ -98,10 +95,7 @@ impl Context { wgpu::BindGroupLayoutEntry { binding: 4, visibility: wgpu::ShaderStages::FRAGMENT, - ty: wgpu::BindingType::Sampler { - filtering: true, - comparison: true, - }, + ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Comparison), count: None, }, ], diff --git a/src/render/object.rs b/src/render/object.rs index 00b2bc43..eecb2c1e 100644 --- a/src/render/object.rs +++ b/src/render/object.rs @@ -161,7 +161,7 @@ impl Context { primitive: wgpu::PrimitiveState { topology: wgpu::PrimitiveTopology::TriangleList, front_face: wgpu::FrontFace::Ccw, - clamp_depth: false, + unclipped_depth: false, ..Default::default() }, depth_stencil: Some(wgpu::DepthStencilState { @@ -261,10 +261,7 @@ impl Context { wgpu::BindGroupLayoutEntry { binding: 2, visibility: wgpu::ShaderStages::VERTEX, - ty: wgpu::BindingType::Sampler { - filtering: false, - comparison: false, - }, + ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::NonFiltering), count: None, }, ], diff --git a/src/render/terrain.rs b/src/render/terrain.rs index 5287a656..02249add 100644 --- a/src/render/terrain.rs +++ b/src/render/terrain.rs @@ -645,30 +645,21 @@ impl Context { wgpu::BindGroupLayoutEntry { binding: 7, visibility: wgpu::ShaderStages::all(), - ty: wgpu::BindingType::Sampler { - filtering: true, - comparison: false, - }, + ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering), count: None, }, // flood sampler wgpu::BindGroupLayoutEntry { binding: 8, visibility: wgpu::ShaderStages::FRAGMENT | wgpu::ShaderStages::COMPUTE, - ty: wgpu::BindingType::Sampler { - filtering: true, - comparison: false, - }, + ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering), count: None, }, // table sampler wgpu::BindGroupLayoutEntry { binding: 9, visibility: wgpu::ShaderStages::FRAGMENT, - ty: wgpu::BindingType::Sampler { - filtering: true, - comparison: false, - }, + ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering), count: None, }, ],