diff --git a/Cargo.lock b/Cargo.lock index 99fb3bba..e0b7a103 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -298,6 +298,15 @@ dependencies = [ "objc2 0.5.2", ] +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2 0.6.3", +] + [[package]] name = "bumpalo" version = "3.19.1" @@ -532,6 +541,8 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681" dependencies = [ + "serde", + "termcolor", "unicode-width", ] @@ -1144,6 +1155,18 @@ dependencies = [ "web-sys", ] +[[package]] +name = "glow" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "gltf" version = "1.4.1" @@ -1801,21 +1824,6 @@ dependencies = [ "paste", ] -[[package]] -name = "metal" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7047791b5bc903b8cd963014b355f71dc9864a9a0b727057676c1dcae5cbc15" -dependencies = [ - "bitflags 2.10.0", - "block", - "core-graphics-types 0.2.0", - "foreign-types", - "log", - "objc", - "paste", -] - [[package]] name = "minicov" version = "0.3.8" @@ -1879,33 +1887,7 @@ dependencies = [ "num-traits", "once_cell", "rustc-hash 1.1.0", - "spirv", - "thiserror 2.0.18", - "unicode-ident", -] - -[[package]] -name = "naga" -version = "28.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "618f667225063219ddfc61251087db8a9aec3c3f0950c916b614e403486f1135" -dependencies = [ - "arrayvec", - "bit-set 0.8.0", - "bitflags 2.10.0", - "cfg-if", - "cfg_aliases", - "codespan-reporting 0.12.0", - "half", - "hashbrown 0.16.1", - "hexf-parse", - "indexmap", - "libm", - "log", - "num-traits", - "once_cell", - "rustc-hash 1.1.0", - "spirv", + "spirv 0.3.0+sdk-1.3.268.0", "thiserror 2.0.18", "unicode-ident", ] @@ -1931,6 +1913,7 @@ dependencies = [ "num-traits", "once_cell", "rustc-hash 1.1.0", + "spirv 0.4.0+sdk-1.4.341.0", "thiserror 2.0.18", "unicode-ident", ] @@ -2079,13 +2062,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" dependencies = [ "bitflags 2.10.0", - "block2", + "block2 0.5.1", "libc", "objc2 0.5.2", "objc2-core-data", "objc2-core-image", "objc2-foundation 0.2.2", - "objc2-quartz-core", + "objc2-quartz-core 0.2.2", ] [[package]] @@ -2107,7 +2090,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" dependencies = [ "bitflags 2.10.0", - "block2", + "block2 0.5.1", "objc2 0.5.2", "objc2-core-location", "objc2-foundation 0.2.2", @@ -2119,7 +2102,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" dependencies = [ - "block2", + "block2 0.5.1", "objc2 0.5.2", "objc2-foundation 0.2.2", ] @@ -2131,7 +2114,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" dependencies = [ "bitflags 2.10.0", - "block2", + "block2 0.5.1", "objc2 0.5.2", "objc2-foundation 0.2.2", ] @@ -2166,10 +2149,10 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" dependencies = [ - "block2", + "block2 0.5.1", "objc2 0.5.2", "objc2-foundation 0.2.2", - "objc2-metal", + "objc2-metal 0.2.2", ] [[package]] @@ -2178,7 +2161,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" dependencies = [ - "block2", + "block2 0.5.1", "objc2 0.5.2", "objc2-contacts", "objc2-foundation 0.2.2", @@ -2197,7 +2180,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" dependencies = [ "bitflags 2.10.0", - "block2", + "block2 0.5.1", "dispatch", "libc", "objc2 0.5.2", @@ -2231,7 +2214,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" dependencies = [ - "block2", + "block2 0.5.1", "objc2 0.5.2", "objc2-app-kit 0.2.2", "objc2-foundation 0.2.2", @@ -2244,11 +2227,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" dependencies = [ "bitflags 2.10.0", - "block2", + "block2 0.5.1", "objc2 0.5.2", "objc2-foundation 0.2.2", ] +[[package]] +name = "objc2-metal" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794" +dependencies = [ + "bitflags 2.10.0", + "block2 0.6.2", + "objc2 0.6.3", + "objc2-foundation 0.3.2", +] + [[package]] name = "objc2-quartz-core" version = "0.2.2" @@ -2256,10 +2251,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" dependencies = [ "bitflags 2.10.0", - "block2", + "block2 0.5.1", "objc2 0.5.2", "objc2-foundation 0.2.2", - "objc2-metal", + "objc2-metal 0.2.2", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" +dependencies = [ + "bitflags 2.10.0", + "objc2 0.6.3", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-metal 0.3.2", ] [[package]] @@ -2279,7 +2287,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" dependencies = [ "bitflags 2.10.0", - "block2", + "block2 0.5.1", "objc2 0.5.2", "objc2-cloud-kit", "objc2-core-data", @@ -2287,7 +2295,7 @@ dependencies = [ "objc2-core-location", "objc2-foundation 0.2.2", "objc2-link-presentation", - "objc2-quartz-core", + "objc2-quartz-core 0.2.2", "objc2-symbols", "objc2-uniform-type-identifiers", "objc2-user-notifications", @@ -2299,7 +2307,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" dependencies = [ - "block2", + "block2 0.5.1", "objc2 0.5.2", "objc2-foundation 0.2.2", ] @@ -2311,7 +2319,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" dependencies = [ "bitflags 2.10.0", - "block2", + "block2 0.5.1", "objc2 0.5.2", "objc2-core-location", "objc2-foundation 0.2.2", @@ -2648,6 +2656,18 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" +[[package]] +name = "raw-window-metal" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135" +dependencies = [ + "objc2 0.6.3", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-quartz-core 0.3.2", +] + [[package]] name = "rayon" version = "1.11.0" @@ -3037,6 +3057,15 @@ dependencies = [ "bitflags 2.10.0", ] +[[package]] +name = "spirv" +version = "0.4.0+sdk-1.4.341.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f" +dependencies = [ + "bitflags 2.10.0", +] + [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -3714,9 +3743,9 @@ dependencies = [ [[package]] name = "wgpu" -version = "28.0.0" +version = "29.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9cb534d5ffd109c7d1135f34cdae29e60eab94855a625dcfe1705f8bc7ad79f" +checksum = "78f9f386699b1fb8b8a05bfe82169b24d151f05702d2905a0bf93bc454fcc825" dependencies = [ "arrayvec", "bitflags 2.10.0", @@ -3727,7 +3756,7 @@ dependencies = [ "hashbrown 0.16.1", "js-sys", "log", - "naga 28.0.0", + "naga 29.0.0", "parking_lot", "portable-atomic", "profiling", @@ -3737,9 +3766,9 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "wgpu-core 28.0.1", - "wgpu-hal 28.0.0", - "wgpu-types 28.0.0", + "wgpu-core 29.0.0", + "wgpu-hal 29.0.0", + "wgpu-types 29.0.0", ] [[package]] @@ -3774,38 +3803,6 @@ dependencies = [ "wgpu-types 27.0.1", ] -[[package]] -name = "wgpu-core" -version = "28.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d23f4642f53f666adcfd2d3218ab174d1e6681101aef18696b90cbe64d1c10f9" -dependencies = [ - "arrayvec", - "bit-set 0.8.0", - "bit-vec 0.8.0", - "bitflags 2.10.0", - "bytemuck", - "cfg_aliases", - "document-features", - "hashbrown 0.16.1", - "indexmap", - "log", - "naga 28.0.0", - "once_cell", - "parking_lot", - "portable-atomic", - "profiling", - "raw-window-handle", - "rustc-hash 1.1.0", - "smallvec", - "thiserror 2.0.18", - "wgpu-core-deps-apple 28.0.0", - "wgpu-core-deps-emscripten 28.0.0", - "wgpu-core-deps-windows-linux-android 28.0.0", - "wgpu-hal 28.0.0", - "wgpu-types 28.0.0", -] - [[package]] name = "wgpu-core" version = "29.0.0" @@ -3825,11 +3822,15 @@ dependencies = [ "naga 29.0.0", "once_cell", "parking_lot", + "portable-atomic", "profiling", "raw-window-handle", "rustc-hash 1.1.0", "smallvec", "thiserror 2.0.18", + "wgpu-core-deps-apple 29.0.0", + "wgpu-core-deps-emscripten 29.0.0", + "wgpu-core-deps-windows-linux-android 29.0.0", "wgpu-hal 29.0.0", "wgpu-naga-bridge", "wgpu-types 29.0.0", @@ -3846,11 +3847,11 @@ dependencies = [ [[package]] name = "wgpu-core-deps-apple" -version = "28.0.0" +version = "29.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87b7b696b918f337c486bf93142454080a32a37832ba8a31e4f48221890047da" +checksum = "43acd053312501689cd92a01a9638d37f3e41a5fd9534875efa8917ee2d11ac0" dependencies = [ - "wgpu-hal 28.0.0", + "wgpu-hal 29.0.0", ] [[package]] @@ -3864,11 +3865,11 @@ dependencies = [ [[package]] name = "wgpu-core-deps-emscripten" -version = "28.0.0" +version = "29.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34b251c331f84feac147de3c4aa3aa45112622a95dd7ee1b74384fa0458dbd79" +checksum = "ef043bf135cc68b6f667c55ff4e345ce2b5924d75bad36a47921b0287ca4b24a" dependencies = [ - "wgpu-hal 28.0.0", + "wgpu-hal 29.0.0", ] [[package]] @@ -3882,11 +3883,11 @@ dependencies = [ [[package]] name = "wgpu-core-deps-windows-linux-android" -version = "28.0.0" +version = "29.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68ca976e72b2c9964eb243e281f6ce7f14a514e409920920dcda12ae40febaae" +checksum = "725d5c006a8c02967b6d93ef04f6537ec4593313e330cfe86d9d3f946eb90f28" dependencies = [ - "wgpu-hal 28.0.0", + "wgpu-hal 29.0.0", ] [[package]] @@ -3905,7 +3906,7 @@ dependencies = [ "cfg-if", "cfg_aliases", "core-graphics-types 0.2.0", - "glow", + "glow 0.16.0", "glutin_wgl_sys", "gpu-alloc", "gpu-allocator 0.27.0", @@ -3916,7 +3917,7 @@ dependencies = [ "libc", "libloading", "log", - "metal 0.32.0", + "metal", "naga 27.0.3", "ndk-sys", "objc", @@ -3940,21 +3941,20 @@ dependencies = [ [[package]] name = "wgpu-hal" -version = "28.0.0" +version = "29.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "293080d77fdd14d6b08a67c5487dfddbf874534bb7921526db56a7b75d7e3bef" +checksum = "058b6047337cf323a4f092486443a9337f3d81325347e5d77deed7e563aeaedc" dependencies = [ "android_system_properties", "arrayvec", "ash", - "bit-set 0.8.0", + "bit-set 0.9.1", "bitflags 2.10.0", - "block", + "block2 0.6.2", "bytemuck", "cfg-if", "cfg_aliases", - "core-graphics-types 0.2.0", - "glow", + "glow 0.17.0", "glutin_wgl_sys", "gpu-allocator 0.28.0", "gpu-descriptor", @@ -3964,10 +3964,13 @@ dependencies = [ "libc", "libloading", "log", - "metal 0.33.0", - "naga 28.0.0", + "naga 29.0.0", "ndk-sys", - "objc", + "objc2 0.6.3", + "objc2-core-foundation", + "objc2-foundation 0.3.2", + "objc2-metal 0.3.2", + "objc2-quartz-core 0.3.2", "once_cell", "ordered-float", "parking_lot", @@ -3976,31 +3979,17 @@ dependencies = [ "profiling", "range-alloc", "raw-window-handle", + "raw-window-metal", "renderdoc-sys", "smallvec", "thiserror 2.0.18", "wasm-bindgen", + "wayland-sys", "web-sys", - "wgpu-types 28.0.0", - "windows 0.62.2", - "windows-core 0.62.2", -] - -[[package]] -name = "wgpu-hal" -version = "29.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058b6047337cf323a4f092486443a9337f3d81325347e5d77deed7e563aeaedc" -dependencies = [ - "bitflags 2.10.0", - "cfg-if", - "cfg_aliases", - "log", - "naga 29.0.0", - "raw-window-handle", - "thiserror 2.0.18", "wgpu-naga-bridge", "wgpu-types 29.0.0", + "windows 0.62.2", + "windows-core 0.62.2", ] [[package]] @@ -4027,19 +4016,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "wgpu-types" -version = "28.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e18308757e594ed2cd27dddbb16a139c42a683819d32a2e0b1b0167552f5840c" -dependencies = [ - "bitflags 2.10.0", - "bytemuck", - "js-sys", - "log", - "web-sys", -] - [[package]] name = "wgpu-types" version = "29.0.0" @@ -4085,7 +4061,7 @@ dependencies = [ "wasm-bindgen-test", "web-sys", "webbrowser", - "wgpu 28.0.0", + "wgpu 29.0.0", "wgpu-core 29.0.0", "wgpu-types 29.0.0", "winit", @@ -4103,7 +4079,7 @@ dependencies = [ "pollster", "rand", "tokio", - "wgpu 28.0.0", + "wgpu 29.0.0", "wgpu_playground_core", ] @@ -4123,7 +4099,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "wgpu 28.0.0", + "wgpu 29.0.0", "wgpu_playground_core", "winit", ] @@ -4574,7 +4550,7 @@ dependencies = [ "android-activity", "atomic-waker", "bitflags 2.10.0", - "block2", + "block2 0.5.1", "bytemuck", "calloop 0.13.0", "cfg_aliases", diff --git a/crates/wgpu_playground_core/Cargo.toml b/crates/wgpu_playground_core/Cargo.toml index f6ffa35d..7cef6f72 100644 --- a/crates/wgpu_playground_core/Cargo.toml +++ b/crates/wgpu_playground_core/Cargo.toml @@ -13,7 +13,7 @@ description = "Core WebGPU functionality for wgpu_playground" dawn = [] [dependencies] -wgpu = { version = "28.0", features = ["wgsl"] } +wgpu = { version = "29.0", features = ["wgsl"] } wgpu-core = "29.0" wgpu-types = "29.0" naga = { version = "29.0", features = ["wgsl-in"] } diff --git a/crates/wgpu_playground_core/src/adapter.rs b/crates/wgpu_playground_core/src/adapter.rs index d81f6bca..b84fc101 100644 --- a/crates/wgpu_playground_core/src/adapter.rs +++ b/crates/wgpu_playground_core/src/adapter.rs @@ -222,9 +222,9 @@ pub fn backend_input_options() -> Vec<&'static str> { /// Create a wgpu Instance with the specified backends pub fn create_instance(backends: Backends) -> Instance { log::debug!("Creating wgpu Instance with backends: {:?}", backends); - let instance = Instance::new(&wgpu::InstanceDescriptor { + let instance = Instance::new(wgpu::InstanceDescriptor { backends, - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); log::trace!("Instance created successfully"); instance diff --git a/crates/wgpu_playground_core/src/buffer_preview.rs b/crates/wgpu_playground_core/src/buffer_preview.rs index 477e84a3..744eec39 100644 --- a/crates/wgpu_playground_core/src/buffer_preview.rs +++ b/crates/wgpu_playground_core/src/buffer_preview.rs @@ -310,7 +310,7 @@ fn fs_main(input: VertexOutput) -> @location(0) vec4 { tracker.record(ApiCategory::PipelineLayout, "create_pipeline_layout"); let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { label: Some("Uniform Preview Pipeline Layout"), - bind_group_layouts: &[&bind_group_layout], + bind_group_layouts: &[Some(&bind_group_layout)], immediate_size: 0, }); diff --git a/crates/wgpu_playground_core/src/code_generator.rs b/crates/wgpu_playground_core/src/code_generator.rs index c4102235..656bc423 100644 --- a/crates/wgpu_playground_core/src/code_generator.rs +++ b/crates/wgpu_playground_core/src/code_generator.rs @@ -247,9 +247,9 @@ impl CodeGenerator { async fn new(window: Arc) -> Self {{\n \ let size = window.inner_size();\n\ \n \ - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor {{\n \ + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {{\n \ backends: wgpu::Backends::all(),\n \ - ..Default::default()\n \ + ..wgpu::InstanceDescriptor::new_without_display_handle()\n \ }});\n\ \n \ let surface = instance.create_surface(window.clone()).unwrap();\n\ @@ -650,9 +650,9 @@ impl CodeGenerator { code.push_str( " let size = window.inner_size();\n\ \n \ - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor {\n \ + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {\n \ backends: wgpu::Backends::all(),\n \ - ..Default::default()\n \ + ..wgpu::InstanceDescriptor::new_without_display_handle()\n \ });\n\ \n \ let surface = instance.create_surface(window.clone()).unwrap();\n\ diff --git a/crates/wgpu_playground_core/src/compute.rs b/crates/wgpu_playground_core/src/compute.rs index 6db30750..55726f45 100644 --- a/crates/wgpu_playground_core/src/compute.rs +++ b/crates/wgpu_playground_core/src/compute.rs @@ -737,7 +737,7 @@ impl ComputePanel { tracker.record(ApiCategory::PipelineLayout, "create_pipeline_layout"); let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { label: Some("Compute Pipeline Layout"), - bind_group_layouts: &[&bind_group_layout], + bind_group_layouts: &[Some(&bind_group_layout)], immediate_size: 0, }); diff --git a/crates/wgpu_playground_core/src/dawn_wrapper.rs b/crates/wgpu_playground_core/src/dawn_wrapper.rs index a6cf8f08..ae6877ca 100644 --- a/crates/wgpu_playground_core/src/dawn_wrapper.rs +++ b/crates/wgpu_playground_core/src/dawn_wrapper.rs @@ -231,9 +231,9 @@ impl DawnInstance { log::info!("Creating Dawn-compatible WebGPU instance using wgpu-core backend"); - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::all(), - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); log::info!("Dawn-compatible instance created successfully"); diff --git a/crates/wgpu_playground_core/src/device_config.rs b/crates/wgpu_playground_core/src/device_config.rs index dfbbc90b..bce726f9 100644 --- a/crates/wgpu_playground_core/src/device_config.rs +++ b/crates/wgpu_playground_core/src/device_config.rs @@ -159,7 +159,7 @@ impl DeviceConfigPanel { self.render_feature_checkbox( ui, "Shader Primitive Index", - Features::SHADER_PRIMITIVE_INDEX, + Features::PRIMITIVE_INDEX, ); }); } @@ -245,7 +245,7 @@ impl DeviceConfigPanel { ); // Buffer limits - Self::render_limit_u32( + Self::render_limit_u64( ui, "Max Uniform Buffer Binding Size", &mut config_limits.max_uniform_buffer_binding_size, @@ -253,7 +253,7 @@ impl DeviceConfigPanel { 1, ); - Self::render_limit_u32( + Self::render_limit_u64( ui, "Max Storage Buffer Binding Size", &mut config_limits.max_storage_buffer_binding_size, diff --git a/crates/wgpu_playground_core/src/device_info.rs b/crates/wgpu_playground_core/src/device_info.rs index 17ca9b57..ae2a7d67 100644 --- a/crates/wgpu_playground_core/src/device_info.rs +++ b/crates/wgpu_playground_core/src/device_info.rs @@ -71,7 +71,7 @@ impl DeviceInfo { limits.max_vertex_buffer_array_stride, limits.min_uniform_buffer_offset_alignment, limits.min_storage_buffer_offset_alignment, - limits.max_inter_stage_shader_components, + limits.max_inter_stage_shader_variables, limits.max_compute_workgroup_storage_size, limits.max_compute_invocations_per_workgroup, limits.max_compute_workgroup_size_x, diff --git a/crates/wgpu_playground_core/src/pipeline_layout.rs b/crates/wgpu_playground_core/src/pipeline_layout.rs index 0e6b8546..3154112d 100644 --- a/crates/wgpu_playground_core/src/pipeline_layout.rs +++ b/crates/wgpu_playground_core/src/pipeline_layout.rs @@ -114,7 +114,7 @@ pub struct PipelineLayoutDescriptor<'a> { /// Optional label for debugging label: Option, /// Bind group layouts that will be used with this pipeline layout - bind_group_layouts: Vec<&'a BindGroupLayout>, + bind_group_layouts: Vec>, /// Push constant ranges (if supported) push_constant_ranges: Vec, } @@ -156,7 +156,7 @@ impl<'a> PipelineLayoutDescriptor<'a> { /// # } /// ``` pub fn with_bind_group_layout(mut self, layout: &'a BindGroupLayout) -> Self { - self.bind_group_layouts.push(layout); + self.bind_group_layouts.push(Some(layout)); self } @@ -168,7 +168,8 @@ impl<'a> PipelineLayoutDescriptor<'a> { /// # Returns /// Self for method chaining pub fn with_bind_group_layouts(mut self, layouts: &[&'a BindGroupLayout]) -> Self { - self.bind_group_layouts.extend_from_slice(layouts); + self.bind_group_layouts + .extend(layouts.iter().map(|l| Some(*l))); self } @@ -215,7 +216,7 @@ impl<'a> PipelineLayoutDescriptor<'a> { } /// Get the bind group layouts - pub fn bind_group_layouts(&self) -> &[&'a BindGroupLayout] { + pub fn bind_group_layouts(&self) -> &[Option<&'a BindGroupLayout>] { &self.bind_group_layouts } diff --git a/crates/wgpu_playground_core/src/pipeline_preview.rs b/crates/wgpu_playground_core/src/pipeline_preview.rs index e2b94d44..54c17fc1 100644 --- a/crates/wgpu_playground_core/src/pipeline_preview.rs +++ b/crates/wgpu_playground_core/src/pipeline_preview.rs @@ -348,7 +348,7 @@ fn fs_main(input: VertexOutput) -> @location(0) vec4 { tracker.record(ApiCategory::PipelineLayout, "create_pipeline_layout"); let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { label: Some("Pipeline Preview Layout"), - bind_group_layouts: &[&bind_group_layout], + bind_group_layouts: &[Some(&bind_group_layout)], immediate_size: 0, }); @@ -398,8 +398,8 @@ fn fs_main(input: VertexOutput) -> @location(0) vec4 { wgpu::DepthStencilState { format: wgpu::TextureFormat::Depth24Plus, - depth_write_enabled: ds.depth_write_enabled, - depth_compare: compare, + depth_write_enabled: Some(ds.depth_write_enabled), + depth_compare: Some(compare), stencil: wgpu::StencilState { front: wgpu::StencilFaceState::IGNORE, back: wgpu::StencilFaceState::IGNORE, diff --git a/crates/wgpu_playground_core/src/render_pipeline.rs b/crates/wgpu_playground_core/src/render_pipeline.rs index f7105de4..5c812399 100644 --- a/crates/wgpu_playground_core/src/render_pipeline.rs +++ b/crates/wgpu_playground_core/src/render_pipeline.rs @@ -793,8 +793,8 @@ impl DepthStencilState { pub fn to_wgpu(&self) -> wgpu::DepthStencilState { wgpu::DepthStencilState { format: self.format, - depth_write_enabled: self.depth_write_enabled, - depth_compare: self.depth_compare.to_wgpu(), + depth_write_enabled: Some(self.depth_write_enabled), + depth_compare: Some(self.depth_compare.to_wgpu()), stencil: wgpu::StencilState { front: self.stencil_front.to_wgpu(), back: self.stencil_back.to_wgpu(), diff --git a/crates/wgpu_playground_core/src/rendering.rs b/crates/wgpu_playground_core/src/rendering.rs index b29c6b4f..7ce64e4e 100644 --- a/crates/wgpu_playground_core/src/rendering.rs +++ b/crates/wgpu_playground_core/src/rendering.rs @@ -593,7 +593,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4 { tracker.record(ApiCategory::PipelineLayout, "create_pipeline_layout"); let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { label: Some("Cube Pipeline Layout"), - bind_group_layouts: &[&bind_group_layout], + bind_group_layouts: &[Some(&bind_group_layout)], immediate_size: 0, }); @@ -632,8 +632,8 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4 { }, depth_stencil: Some(wgpu::DepthStencilState { format: wgpu::TextureFormat::Depth32Float, - depth_write_enabled: true, - depth_compare: wgpu::CompareFunction::Less, + depth_write_enabled: Some(true), + depth_compare: Some(wgpu::CompareFunction::Less), stencil: wgpu::StencilState::default(), bias: wgpu::DepthBiasState::default(), }), @@ -868,7 +868,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4 { tracker.record(ApiCategory::PipelineLayout, "create_pipeline_layout"); let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { label: Some("Texture Pipeline Layout"), - bind_group_layouts: &[&bind_group_layout], + bind_group_layouts: &[Some(&bind_group_layout)], immediate_size: 0, }); diff --git a/crates/wgpu_playground_core/src/surface.rs b/crates/wgpu_playground_core/src/surface.rs index 520deef3..9b98d4ed 100644 --- a/crates/wgpu_playground_core/src/surface.rs +++ b/crates/wgpu_playground_core/src/surface.rs @@ -1,6 +1,6 @@ use wgpu::{ - CompositeAlphaMode, Device, Instance, PresentMode, Surface, SurfaceConfiguration, - SurfaceTexture, TextureFormat, TextureUsages, + CompositeAlphaMode, CurrentSurfaceTexture, Device, Instance, PresentMode, Surface, + SurfaceConfiguration, TextureFormat, TextureUsages, }; /// Builder for creating and configuring GPU surfaces @@ -169,26 +169,24 @@ pub fn configure_surface(surface: &Surface, device: &Device, config: &SurfaceCon /// * `surface` - The surface to get the texture from /// /// # Returns -/// The current surface texture, or an error if the surface is invalid -/// -/// # Errors -/// Returns a `SurfaceError` if: -/// - The surface was lost and needs to be reconfigured -/// - The presentation system ran out of memory -/// - The surface timed out waiting for the next frame -/// - The surface is outdated and needs to be reconfigured +/// A [`wgpu::CurrentSurfaceTexture`] indicating the result of the operation. +/// On success, contains the surface texture ready for rendering. /// /// # Examples /// ```no_run /// use wgpu_playground_core::surface::get_current_texture; -/// # async fn example(surface: &wgpu::Surface<'_>) -> Result<(), wgpu::SurfaceError> { -/// let texture = get_current_texture(surface)?; -/// // Use the texture for rendering -/// texture.present(); -/// # Ok(()) +/// use wgpu::CurrentSurfaceTexture; +/// # fn example(surface: &wgpu::Surface<'_>) { +/// match get_current_texture(surface) { +/// CurrentSurfaceTexture::Success(texture) | CurrentSurfaceTexture::Suboptimal(texture) => { +/// // Use the texture for rendering +/// texture.present(); +/// } +/// _ => {} // Handle other cases (lost, outdated, timeout, etc.) +/// } /// # } /// ``` -pub fn get_current_texture(surface: &Surface) -> Result { +pub fn get_current_texture(surface: &Surface) -> CurrentSurfaceTexture { surface.get_current_texture() } diff --git a/crates/wgpu_playground_core/src/texture_preview.rs b/crates/wgpu_playground_core/src/texture_preview.rs index b1754966..35c251b3 100644 --- a/crates/wgpu_playground_core/src/texture_preview.rs +++ b/crates/wgpu_playground_core/src/texture_preview.rs @@ -230,7 +230,7 @@ fn fs_main(input: VertexOutput) -> @location(0) vec4 { tracker.record(ApiCategory::PipelineLayout, "create_pipeline_layout"); let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { label: Some("Texture Preview Pipeline Layout"), - bind_group_layouts: &[&bind_group_layout], + bind_group_layouts: &[Some(&bind_group_layout)], immediate_size: 0, }); diff --git a/crates/wgpu_playground_core/tests/adapter_selection_integration_test.rs b/crates/wgpu_playground_core/tests/adapter_selection_integration_test.rs index 90fa87b9..524c2124 100644 --- a/crates/wgpu_playground_core/tests/adapter_selection_integration_test.rs +++ b/crates/wgpu_playground_core/tests/adapter_selection_integration_test.rs @@ -3,9 +3,9 @@ use wgpu_playground_core::adapter_selection::AdapterSelectionPanel; // Helper function to create a test adapter async fn create_test_adapter() -> Option { - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::all(), - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); instance diff --git a/crates/wgpu_playground_core/tests/bindgroup_integration_test.rs b/crates/wgpu_playground_core/tests/bindgroup_integration_test.rs index e7387797..5be163fb 100644 --- a/crates/wgpu_playground_core/tests/bindgroup_integration_test.rs +++ b/crates/wgpu_playground_core/tests/bindgroup_integration_test.rs @@ -468,9 +468,9 @@ mod bind_group_creation_tests { // Helper to create a device for testing async fn create_test_device() -> Option<(wgpu::Device, wgpu::Queue)> { - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::all(), - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance diff --git a/crates/wgpu_playground_core/tests/buffer_integration_test.rs b/crates/wgpu_playground_core/tests/buffer_integration_test.rs index aa5db8c7..c6a6a955 100644 --- a/crates/wgpu_playground_core/tests/buffer_integration_test.rs +++ b/crates/wgpu_playground_core/tests/buffer_integration_test.rs @@ -779,9 +779,8 @@ fn test_buffer_map_write_modify_read() { BufferOps::map_write(&write_buffer).await.unwrap(); { let mut view = BufferOps::get_mapped_range_mut(&write_buffer); - for (i, byte) in view.iter_mut().enumerate() { - *byte = (i % 256) as u8; - } + let data: Vec = (0..256).map(|i| (i % 256) as u8).collect(); + view.copy_from_slice(&data); } BufferOps::unmap(&write_buffer); diff --git a/crates/wgpu_playground_core/tests/common/mod.rs b/crates/wgpu_playground_core/tests/common/mod.rs index f3c5284b..91fe8783 100644 --- a/crates/wgpu_playground_core/tests/common/mod.rs +++ b/crates/wgpu_playground_core/tests/common/mod.rs @@ -49,9 +49,9 @@ pub async fn create_test_device() -> Option<(Device, Queue)> { wgpu::Backends::all() }; - let instance = Instance::new(&wgpu::InstanceDescriptor { + let instance = Instance::new(wgpu::InstanceDescriptor { backends, - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance @@ -96,9 +96,9 @@ pub async fn create_test_device_with_features(features: wgpu::Features) -> Optio wgpu::Backends::all() }; - let instance = Instance::new(&wgpu::InstanceDescriptor { + let instance = Instance::new(wgpu::InstanceDescriptor { backends, - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance @@ -148,9 +148,9 @@ pub async fn create_test_device_with_limits(limits: wgpu::Limits) -> Option<(Dev wgpu::Backends::all() }; - let instance = Instance::new(&wgpu::InstanceDescriptor { + let instance = Instance::new(wgpu::InstanceDescriptor { backends, - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance @@ -191,9 +191,9 @@ pub async fn create_test_instance_and_adapter() -> Option<(Instance, Adapter)> { wgpu::Backends::all() }; - let instance = Instance::new(&wgpu::InstanceDescriptor { + let instance = Instance::new(wgpu::InstanceDescriptor { backends, - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance diff --git a/crates/wgpu_playground_core/tests/shader_editor_integration_test.rs b/crates/wgpu_playground_core/tests/shader_editor_integration_test.rs index 7dd6e200..bd914575 100644 --- a/crates/wgpu_playground_core/tests/shader_editor_integration_test.rs +++ b/crates/wgpu_playground_core/tests/shader_editor_integration_test.rs @@ -59,9 +59,9 @@ fn test_shader_editor_set_valid_shader() { fn test_shader_editor_compile_with_device() { // This test requires a GPU device pollster::block_on(async { - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::all(), - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance diff --git a/crates/wgpu_playground_core/tests/wasm_canvas_test.rs b/crates/wgpu_playground_core/tests/wasm_canvas_test.rs index 3d9255fb..4577eda7 100644 --- a/crates/wgpu_playground_core/tests/wasm_canvas_test.rs +++ b/crates/wgpu_playground_core/tests/wasm_canvas_test.rs @@ -276,9 +276,9 @@ async fn test_wgpu_surface_from_canvas() { canvas.set_height(600); // Create wgpu instance - let instance = Instance::new(&wgpu::InstanceDescriptor { + let instance = Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::BROWSER_WEBGPU, - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); // Create surface from canvas diff --git a/crates/wgpu_playground_core/tests/wasm_integration_test.rs b/crates/wgpu_playground_core/tests/wasm_integration_test.rs index 6a477219..03d7bccf 100644 --- a/crates/wgpu_playground_core/tests/wasm_integration_test.rs +++ b/crates/wgpu_playground_core/tests/wasm_integration_test.rs @@ -83,9 +83,9 @@ async fn test_wgpu_instance_creation() { use wgpu::Instance; // Create a WGPU instance - let instance = Instance::new(&wgpu::InstanceDescriptor { + let instance = Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::BROWSER_WEBGPU, - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); // Instance creation should succeed @@ -98,9 +98,9 @@ async fn test_wgpu_instance_creation() { async fn test_adapter_enumeration_browser_backend() { use wgpu::Instance; - let instance = Instance::new(&wgpu::InstanceDescriptor { + let instance = Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::BROWSER_WEBGPU, - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); // Try to request an adapter @@ -129,9 +129,9 @@ async fn test_adapter_enumeration_browser_backend() { async fn test_device_creation_if_available() { use wgpu::Instance; - let instance = Instance::new(&wgpu::InstanceDescriptor { + let instance = Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::BROWSER_WEBGPU, - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); if let Ok(adapter) = instance diff --git a/crates/wgpu_playground_core/tests/workflow_integration_test.rs b/crates/wgpu_playground_core/tests/workflow_integration_test.rs index 8a52e23b..5fe0a1b8 100644 --- a/crates/wgpu_playground_core/tests/workflow_integration_test.rs +++ b/crates/wgpu_playground_core/tests/workflow_integration_test.rs @@ -491,7 +491,7 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4 { let second_pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { label: Some("Second Pass Layout"), - bind_group_layouts: &[&second_bind_group_layout], + bind_group_layouts: &[Some(&second_bind_group_layout)], immediate_size: 0, }); @@ -963,8 +963,8 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4 { primitive: wgpu::PrimitiveState::default(), depth_stencil: Some(wgpu::DepthStencilState { format: wgpu::TextureFormat::Depth32Float, - depth_write_enabled: true, - depth_compare: wgpu::CompareFunction::Less, + depth_write_enabled: Some(true), + depth_compare: Some(wgpu::CompareFunction::Less), stencil: wgpu::StencilState::default(), bias: wgpu::DepthBiasState::default(), }), diff --git a/crates/wgpu_playground_examples/Cargo.toml b/crates/wgpu_playground_examples/Cargo.toml index aff4d513..41ef603d 100644 --- a/crates/wgpu_playground_examples/Cargo.toml +++ b/crates/wgpu_playground_examples/Cargo.toml @@ -7,7 +7,7 @@ description = "Examples for wgpu_playground" [dependencies] wgpu_playground_core = { path = "../wgpu_playground_core" } -wgpu = { version = "28.0", features = ["wgsl"] } +wgpu = { version = "29.0", features = ["wgsl"] } pollster = "0.4" env_logger = "0.11" log = "0.4" diff --git a/crates/wgpu_playground_examples/examples/advanced_compute_blur.rs b/crates/wgpu_playground_examples/examples/advanced_compute_blur.rs index c6520c49..863a3c59 100644 --- a/crates/wgpu_playground_examples/examples/advanced_compute_blur.rs +++ b/crates/wgpu_playground_examples/examples/advanced_compute_blur.rs @@ -27,9 +27,9 @@ const IMAGE_HEIGHT: u32 = 512; /// Create GPU device and queue with required features async fn create_device() -> Option<(wgpu::Device, wgpu::Queue)> { - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::all(), - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance @@ -215,7 +215,7 @@ fn main() { let horizontal_pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { label: Some("Horizontal Blur Pipeline Layout"), - bind_group_layouts: &[&horizontal_bind_group_layout], + bind_group_layouts: &[Some(&horizontal_bind_group_layout)], immediate_size: 0, }); @@ -275,7 +275,7 @@ fn main() { let vertical_pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { label: Some("Vertical Blur Pipeline Layout"), - bind_group_layouts: &[&vertical_bind_group_layout], + bind_group_layouts: &[Some(&vertical_bind_group_layout)], immediate_size: 0, }); diff --git a/crates/wgpu_playground_examples/examples/compute_pass.rs b/crates/wgpu_playground_examples/examples/compute_pass.rs index 3d6dc0d7..d32c840f 100644 --- a/crates/wgpu_playground_examples/examples/compute_pass.rs +++ b/crates/wgpu_playground_examples/examples/compute_pass.rs @@ -14,9 +14,9 @@ use wgpu_playground_core::compute_pass_encoder::{ComputePassDescriptor, ComputeP use wgpu_playground_core::shader::ShaderModule; async fn create_device() -> Option<(wgpu::Device, wgpu::Queue)> { - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::all(), - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance diff --git a/crates/wgpu_playground_examples/examples/compute_render_sharing.rs b/crates/wgpu_playground_examples/examples/compute_render_sharing.rs index 44eb358c..36be9120 100644 --- a/crates/wgpu_playground_examples/examples/compute_render_sharing.rs +++ b/crates/wgpu_playground_examples/examples/compute_render_sharing.rs @@ -41,9 +41,9 @@ impl Particle { /// Create GPU device and queue async fn create_device() -> Option<(wgpu::Device, wgpu::Queue)> { - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::all(), - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance @@ -211,7 +211,7 @@ fn main(@builtin(global_invocation_id) global_id: vec3) { let compute_pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { label: Some("Compute Pipeline Layout"), - bind_group_layouts: &[&compute_bind_group_layout], + bind_group_layouts: &[Some(&compute_bind_group_layout)], immediate_size: 0, }); diff --git a/crates/wgpu_playground_examples/examples/indirect_drawing.rs b/crates/wgpu_playground_examples/examples/indirect_drawing.rs index 631e2519..4a7c3432 100644 --- a/crates/wgpu_playground_examples/examples/indirect_drawing.rs +++ b/crates/wgpu_playground_examples/examples/indirect_drawing.rs @@ -64,9 +64,9 @@ impl Vertex { /// Create GPU device and queue async fn create_device() -> Option<(wgpu::Device, wgpu::Queue)> { - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::all(), - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance diff --git a/crates/wgpu_playground_examples/examples/instanced_rendering.rs b/crates/wgpu_playground_examples/examples/instanced_rendering.rs index 46dfc965..498b4b7e 100644 --- a/crates/wgpu_playground_examples/examples/instanced_rendering.rs +++ b/crates/wgpu_playground_examples/examples/instanced_rendering.rs @@ -70,9 +70,9 @@ unsafe impl bytemuck::Zeroable for Uniforms {} /// Create GPU device and queue async fn create_device() -> Option<(wgpu::Device, wgpu::Queue)> { - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::all(), - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance @@ -383,7 +383,7 @@ fn main() { // Create pipeline layout let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { label: Some("Pipeline Layout"), - bind_group_layouts: &[&bind_group_layout], + bind_group_layouts: &[Some(&bind_group_layout)], immediate_size: 0, }); @@ -408,8 +408,8 @@ fn main() { }, depth_stencil: Some(wgpu::DepthStencilState { format: wgpu::TextureFormat::Depth24Plus, - depth_write_enabled: true, - depth_compare: wgpu::CompareFunction::Less, + depth_write_enabled: Some(true), + depth_compare: Some(wgpu::CompareFunction::Less), stencil: wgpu::StencilState::default(), bias: wgpu::DepthBiasState::default(), }), diff --git a/crates/wgpu_playground_examples/examples/lighting_shadows.rs b/crates/wgpu_playground_examples/examples/lighting_shadows.rs index e52e4bdf..1afc5bfc 100644 --- a/crates/wgpu_playground_examples/examples/lighting_shadows.rs +++ b/crates/wgpu_playground_examples/examples/lighting_shadows.rs @@ -73,9 +73,9 @@ unsafe impl bytemuck::Zeroable for ShadowUniforms {} /// Create GPU device and queue async fn create_device() -> Option<(wgpu::Device, wgpu::Queue)> { - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::all(), - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance @@ -337,7 +337,7 @@ fn main() { // Shadow pass pipeline let shadow_pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { label: Some("Shadow Pipeline Layout"), - bind_group_layouts: &[&shadow_bind_group_layout], + bind_group_layouts: &[Some(&shadow_bind_group_layout)], immediate_size: 0, }); @@ -369,8 +369,8 @@ fn main() { }, depth_stencil: Some(wgpu::DepthStencilState { format: wgpu::TextureFormat::Depth32Float, - depth_write_enabled: true, - depth_compare: wgpu::CompareFunction::Less, + depth_write_enabled: Some(true), + depth_compare: Some(wgpu::CompareFunction::Less), stencil: wgpu::StencilState::default(), bias: wgpu::DepthBiasState::default(), }), @@ -501,9 +501,9 @@ fn main() { let main_pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { label: Some("Main Pipeline Layout"), bind_group_layouts: &[ - &camera_bind_group_layout, - &light_bind_group_layout, - &shadow_map_bind_group_layout, + Some(&camera_bind_group_layout), + Some(&light_bind_group_layout), + Some(&shadow_map_bind_group_layout), ], immediate_size: 0, }); @@ -559,8 +559,8 @@ fn main() { }, depth_stencil: Some(wgpu::DepthStencilState { format: wgpu::TextureFormat::Depth24Plus, - depth_write_enabled: true, - depth_compare: wgpu::CompareFunction::Less, + depth_write_enabled: Some(true), + depth_compare: Some(wgpu::CompareFunction::Less), stencil: wgpu::StencilState::default(), bias: wgpu::DepthBiasState::default(), }), diff --git a/crates/wgpu_playground_examples/examples/multisampling.rs b/crates/wgpu_playground_examples/examples/multisampling.rs index 61fc6efd..45954982 100644 --- a/crates/wgpu_playground_examples/examples/multisampling.rs +++ b/crates/wgpu_playground_examples/examples/multisampling.rs @@ -33,9 +33,9 @@ impl Vertex { /// Create GPU device and queue async fn create_device() -> Option<(wgpu::Device, wgpu::Queue)> { - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::all(), - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance diff --git a/crates/wgpu_playground_examples/examples/particle_system.rs b/crates/wgpu_playground_examples/examples/particle_system.rs index a839cabe..ddd66bf2 100644 --- a/crates/wgpu_playground_examples/examples/particle_system.rs +++ b/crates/wgpu_playground_examples/examples/particle_system.rs @@ -95,9 +95,9 @@ unsafe impl bytemuck::Zeroable for SimulationParams {} /// Create GPU device and queue async fn create_device() -> Option<(wgpu::Device, wgpu::Queue)> { - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::all(), - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance @@ -302,7 +302,7 @@ fn main() { let compute_pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { label: Some("Compute Pipeline Layout"), - bind_group_layouts: &[&compute_bind_group_layout], + bind_group_layouts: &[Some(&compute_bind_group_layout)], immediate_size: 0, }); diff --git a/crates/wgpu_playground_examples/examples/post_processing.rs b/crates/wgpu_playground_examples/examples/post_processing.rs index ae95b4e9..f35c88f0 100644 --- a/crates/wgpu_playground_examples/examples/post_processing.rs +++ b/crates/wgpu_playground_examples/examples/post_processing.rs @@ -55,9 +55,9 @@ impl QuadVertex { /// Create GPU device and queue async fn create_device() -> Option<(wgpu::Device, wgpu::Queue)> { - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::all(), - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance @@ -307,7 +307,7 @@ fn main() { let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { label: Some("Post-Processing Pipeline Layout"), - bind_group_layouts: &[&bind_group_layout], + bind_group_layouts: &[Some(&bind_group_layout)], immediate_size: 0, }); diff --git a/crates/wgpu_playground_examples/examples/render_bundle.rs b/crates/wgpu_playground_examples/examples/render_bundle.rs index 5496476b..6b8d8cd7 100644 --- a/crates/wgpu_playground_examples/examples/render_bundle.rs +++ b/crates/wgpu_playground_examples/examples/render_bundle.rs @@ -35,9 +35,9 @@ impl Vertex { /// Create GPU device and queue async fn create_device() -> Option<(wgpu::Device, wgpu::Queue)> { - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::all(), - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance diff --git a/crates/wgpu_playground_examples/examples/render_to_texture.rs b/crates/wgpu_playground_examples/examples/render_to_texture.rs index c77803c0..d8ecbee3 100644 --- a/crates/wgpu_playground_examples/examples/render_to_texture.rs +++ b/crates/wgpu_playground_examples/examples/render_to_texture.rs @@ -54,9 +54,9 @@ impl TexturedVertex { /// Create GPU device and queue async fn create_device() -> Option<(wgpu::Device, wgpu::Queue)> { - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::all(), - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance @@ -350,7 +350,7 @@ fn main() { // Create second pass pipeline let display_pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { label: Some("Display Pipeline Layout"), - bind_group_layouts: &[&bind_group_layout], + bind_group_layouts: &[Some(&bind_group_layout)], immediate_size: 0, }); diff --git a/crates/wgpu_playground_examples/examples/rotating_cube.rs b/crates/wgpu_playground_examples/examples/rotating_cube.rs index a6428c17..d9f387bd 100644 --- a/crates/wgpu_playground_examples/examples/rotating_cube.rs +++ b/crates/wgpu_playground_examples/examples/rotating_cube.rs @@ -42,9 +42,9 @@ unsafe impl bytemuck::Zeroable for Uniforms {} /// Create GPU device and queue async fn create_device() -> Option<(wgpu::Device, wgpu::Queue)> { - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::all(), - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance @@ -276,7 +276,7 @@ fn main() { // Create pipeline layout let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { label: Some("Cube Pipeline Layout"), - bind_group_layouts: &[&bind_group_layout], + bind_group_layouts: &[Some(&bind_group_layout)], immediate_size: 0, }); @@ -301,8 +301,8 @@ fn main() { }, depth_stencil: Some(wgpu::DepthStencilState { format: wgpu::TextureFormat::Depth24Plus, - depth_write_enabled: true, - depth_compare: wgpu::CompareFunction::Less, + depth_write_enabled: Some(true), + depth_compare: Some(wgpu::CompareFunction::Less), stencil: wgpu::StencilState::default(), bias: wgpu::DepthBiasState::default(), }), diff --git a/crates/wgpu_playground_examples/examples/threedmf_viewer.rs b/crates/wgpu_playground_examples/examples/threedmf_viewer.rs index 03104b88..39603c52 100644 --- a/crates/wgpu_playground_examples/examples/threedmf_viewer.rs +++ b/crates/wgpu_playground_examples/examples/threedmf_viewer.rs @@ -40,9 +40,9 @@ unsafe impl bytemuck::Zeroable for Uniforms {} /// Create a wgpu device and queue async fn create_device() -> Option<(wgpu::Device, wgpu::Queue)> { - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::all(), - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance @@ -333,7 +333,7 @@ fn main() { let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { label: Some("3MF Pipeline Layout"), - bind_group_layouts: &[&bind_group_layout], + bind_group_layouts: &[Some(&bind_group_layout)], immediate_size: 0, }); @@ -357,8 +357,8 @@ fn main() { }, depth_stencil: Some(wgpu::DepthStencilState { format: wgpu::TextureFormat::Depth24Plus, - depth_write_enabled: true, - depth_compare: wgpu::CompareFunction::Less, + depth_write_enabled: Some(true), + depth_compare: Some(wgpu::CompareFunction::Less), stencil: wgpu::StencilState::default(), bias: wgpu::DepthBiasState::default(), }), diff --git a/crates/wgpu_playground_examples/examples/triangle.rs b/crates/wgpu_playground_examples/examples/triangle.rs index c6386783..35b9ce77 100644 --- a/crates/wgpu_playground_examples/examples/triangle.rs +++ b/crates/wgpu_playground_examples/examples/triangle.rs @@ -30,9 +30,9 @@ impl Vertex { /// Create GPU device and queue async fn create_device() -> Option<(wgpu::Device, wgpu::Queue)> { - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::all(), - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance diff --git a/crates/wgpu_playground_examples/src/adapter_demo.rs b/crates/wgpu_playground_examples/src/adapter_demo.rs index 74a35838..cd1ecb23 100644 --- a/crates/wgpu_playground_examples/src/adapter_demo.rs +++ b/crates/wgpu_playground_examples/src/adapter_demo.rs @@ -27,9 +27,9 @@ async fn main() { // Request adapter with different options println!("\n=== Requesting Adapter ===\n"); - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::all(), - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); // Try with default options diff --git a/crates/wgpu_playground_examples/src/texture_mapping.rs b/crates/wgpu_playground_examples/src/texture_mapping.rs index ec12b059..604fb6fb 100644 --- a/crates/wgpu_playground_examples/src/texture_mapping.rs +++ b/crates/wgpu_playground_examples/src/texture_mapping.rs @@ -57,9 +57,9 @@ async fn run_texture_example() { // Step 1: Initialize wgpu context println!("1. Initializing wgpu context..."); - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::all(), - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance @@ -241,7 +241,7 @@ async fn run_texture_example() { println!("\n9. Creating render pipeline..."); let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { label: Some("Render Pipeline Layout"), - bind_group_layouts: &[&bind_group_layout], + bind_group_layouts: &[Some(&bind_group_layout)], immediate_size: 0, }); diff --git a/crates/wgpu_playground_gui/Cargo.toml b/crates/wgpu_playground_gui/Cargo.toml index 19371914..24bf1536 100644 --- a/crates/wgpu_playground_gui/Cargo.toml +++ b/crates/wgpu_playground_gui/Cargo.toml @@ -16,7 +16,7 @@ dawn = ["wgpu_playground_core/dawn"] [dependencies] wgpu_playground_core = { path = "../wgpu_playground_core" } -wgpu = "28.0" +wgpu = "29.0" winit = "0.30" pollster = "0.4" env_logger = "0.11" diff --git a/crates/wgpu_playground_gui/src/app.rs b/crates/wgpu_playground_gui/src/app.rs index ed88ad16..cf61be34 100644 --- a/crates/wgpu_playground_gui/src/app.rs +++ b/crates/wgpu_playground_gui/src/app.rs @@ -957,9 +957,9 @@ mod tests { // This test verifies that the app can be created with a GPU adapter/device // We use pollster to block on async GPU initialization pollster::block_on(async { - let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: wgpu::Backends::all(), - ..Default::default() + ..wgpu::InstanceDescriptor::new_without_display_handle() }); let adapter = instance diff --git a/crates/wgpu_playground_gui/src/main.rs b/crates/wgpu_playground_gui/src/main.rs index 3cdaf10b..011f4bb6 100644 --- a/crates/wgpu_playground_gui/src/main.rs +++ b/crates/wgpu_playground_gui/src/main.rs @@ -12,6 +12,12 @@ mod app; use app::PlaygroundApp; +#[derive(Debug)] +enum RenderError { + /// Surface is lost or outdated and needs to be reconfigured + SurfaceReconfigure, +} + struct AppState { window: Arc, surface: wgpu::Surface<'static>, @@ -188,8 +194,17 @@ impl AppState { } } - fn render(&mut self) -> Result<(), wgpu::SurfaceError> { - let surface_texture = self.surface.get_current_texture()?; + fn render(&mut self) -> Result<(), RenderError> { + let surface_texture = match self.surface.get_current_texture() { + wgpu::CurrentSurfaceTexture::Success(t) + | wgpu::CurrentSurfaceTexture::Suboptimal(t) => t, + wgpu::CurrentSurfaceTexture::Outdated | wgpu::CurrentSurfaceTexture::Lost => { + return Err(RenderError::SurfaceReconfigure) + } + wgpu::CurrentSurfaceTexture::Timeout + | wgpu::CurrentSurfaceTexture::Occluded + | wgpu::CurrentSurfaceTexture::Validation => return Ok(()), + }; let view = surface_texture .texture .create_view(&wgpu::TextureViewDescriptor::default()); @@ -345,9 +360,7 @@ impl ApplicationHandler for App { } WindowEvent::RedrawRequested => match state.render() { Ok(_) => {} - Err(wgpu::SurfaceError::Lost) => state.resize(state.window.inner_size()), - Err(wgpu::SurfaceError::OutOfMemory) => event_loop.exit(), - Err(e) => eprintln!("Surface error: {:?}", e), + Err(RenderError::SurfaceReconfigure) => state.resize(state.window.inner_size()), }, WindowEvent::DroppedFile(path) => { // Handle file drop