From 4b05d2f4d8a627b9cc74ac77954e3e4cc9e672ed Mon Sep 17 00:00:00 2001 From: charlotte Date: Tue, 5 Nov 2024 13:18:48 -0800 Subject: [PATCH] Upgrade to wgpu 23 (#15988) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes https://github.com/bevyengine/bevy/issues/15893 --------- Co-authored-by: François Mockers --- crates/bevy_color/Cargo.toml | 2 +- crates/bevy_core_pipeline/src/bloom/mod.rs | 2 +- crates/bevy_image/Cargo.toml | 2 +- crates/bevy_image/src/dds.rs | 2 +- crates/bevy_image/src/ktx2.rs | 4 ++-- crates/bevy_mesh/Cargo.toml | 2 +- crates/bevy_reflect/Cargo.toml | 2 +- crates/bevy_render/Cargo.toml | 8 ++++---- crates/bevy_render/src/render_resource/bind_group.rs | 12 ++++++++++++ .../src/render_resource/pipeline_cache.rs | 8 +++----- crates/bevy_winit/Cargo.toml | 2 +- .../bevy_mobile_example.xcodeproj/project.pbxproj | 8 ++++++-- 12 files changed, 34 insertions(+), 20 deletions(-) diff --git a/crates/bevy_color/Cargo.toml b/crates/bevy_color/Cargo.toml index 6a32f29d90..7c8bde7aea 100644 --- a/crates/bevy_color/Cargo.toml +++ b/crates/bevy_color/Cargo.toml @@ -23,7 +23,7 @@ derive_more = { version = "1", default-features = false, features = [ "from", "display", ] } -wgpu-types = { version = "22", default-features = false, optional = true } +wgpu-types = { version = "23", default-features = false, optional = true } encase = { version = "0.10", default-features = false } [features] diff --git a/crates/bevy_core_pipeline/src/bloom/mod.rs b/crates/bevy_core_pipeline/src/bloom/mod.rs index ff642c1f2f..bfd7ee22db 100644 --- a/crates/bevy_core_pipeline/src/bloom/mod.rs +++ b/crates/bevy_core_pipeline/src/bloom/mod.rs @@ -39,7 +39,7 @@ use upsampling_pipeline::{ const BLOOM_SHADER_HANDLE: Handle = Handle::weak_from_u128(929599476923908); -const BLOOM_TEXTURE_FORMAT: TextureFormat = TextureFormat::Rg11b10Float; +const BLOOM_TEXTURE_FORMAT: TextureFormat = TextureFormat::Rg11b10Ufloat; pub struct BloomPlugin; diff --git a/crates/bevy_image/Cargo.toml b/crates/bevy_image/Cargo.toml index b848e478dd..3583b21a79 100644 --- a/crates/bevy_image/Cargo.toml +++ b/crates/bevy_image/Cargo.toml @@ -49,7 +49,7 @@ image = { version = "0.25.2", default-features = false } # misc bitflags = { version = "2.3", features = ["serde"] } bytemuck = { version = "1.5" } -wgpu = { version = "22", default-features = false } +wgpu = { version = "23", default-features = false } serde = { version = "1", features = ["derive"] } derive_more = { version = "1", default-features = false, features = [ "error", diff --git a/crates/bevy_image/src/dds.rs b/crates/bevy_image/src/dds.rs index aa7ba06efe..4ba311377d 100644 --- a/crates/bevy_image/src/dds.rs +++ b/crates/bevy_image/src/dds.rs @@ -182,7 +182,7 @@ pub fn dds_format_to_texture_format( DxgiFormat::R10G10B10A2_Typeless | DxgiFormat::R10G10B10A2_UNorm => { TextureFormat::Rgb10a2Unorm } - DxgiFormat::R11G11B10_Float => TextureFormat::Rg11b10Float, + DxgiFormat::R11G11B10_Float => TextureFormat::Rg11b10Ufloat, DxgiFormat::R8G8B8A8_Typeless | DxgiFormat::R8G8B8A8_UNorm | DxgiFormat::R8G8B8A8_UNorm_sRGB => { diff --git a/crates/bevy_image/src/ktx2.rs b/crates/bevy_image/src/ktx2.rs index cb202bc863..7ba3bb6106 100644 --- a/crates/bevy_image/src/ktx2.rs +++ b/crates/bevy_image/src/ktx2.rs @@ -641,7 +641,7 @@ pub fn ktx2_dfd_to_texture_format( && sample_information[2].channel_type == 2 && sample_information[2].bit_length == 10 { - TextureFormat::Rg11b10Float + TextureFormat::Rg11b10Ufloat } else if sample_information[0].channel_type == 0 && sample_information[0].bit_length == 9 && sample_information[1].channel_type == 1 @@ -1276,7 +1276,7 @@ pub fn ktx2_format_to_texture_format( ktx2::Format::R32G32B32A32_SINT => TextureFormat::Rgba32Sint, ktx2::Format::R32G32B32A32_SFLOAT => TextureFormat::Rgba32Float, - ktx2::Format::B10G11R11_UFLOAT_PACK32 => TextureFormat::Rg11b10Float, + ktx2::Format::B10G11R11_UFLOAT_PACK32 => TextureFormat::Rg11b10Ufloat, ktx2::Format::E5B9G9R9_UFLOAT_PACK32 => TextureFormat::Rgb9e5Ufloat, ktx2::Format::X8_D24_UNORM_PACK32 => TextureFormat::Depth24Plus, diff --git a/crates/bevy_mesh/Cargo.toml b/crates/bevy_mesh/Cargo.toml index 21d4fb31fe..fd00c8d041 100644 --- a/crates/bevy_mesh/Cargo.toml +++ b/crates/bevy_mesh/Cargo.toml @@ -24,7 +24,7 @@ bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev" } # misc bitflags = { version = "2.3", features = ["serde"] } bytemuck = { version = "1.5" } -wgpu = { version = "22", default-features = false } +wgpu = { version = "23", default-features = false } serde = { version = "1", features = ["derive"] } hexasphere = "15.0" derive_more = { version = "1", default-features = false, features = [ diff --git a/crates/bevy_reflect/Cargo.toml b/crates/bevy_reflect/Cargo.toml index 2d7fff5e7c..844c40c685 100644 --- a/crates/bevy_reflect/Cargo.toml +++ b/crates/bevy_reflect/Cargo.toml @@ -51,7 +51,7 @@ glam = { version = "0.29", features = ["serde"], optional = true } petgraph = { version = "0.6", features = ["serde-1"], optional = true } smol_str = { version = "0.2.0", features = ["serde"], optional = true } uuid = { version = "1.0", optional = true, features = ["v4", "serde"] } -wgpu-types = { version = "22", features = ["serde"], optional = true } +wgpu-types = { version = "23", features = ["serde"], optional = true } [dev-dependencies] ron = "0.8.0" diff --git a/crates/bevy_render/Cargo.toml b/crates/bevy_render/Cargo.toml index 0d49bf46a4..0ab710527b 100644 --- a/crates/bevy_render/Cargo.toml +++ b/crates/bevy_render/Cargo.toml @@ -67,14 +67,14 @@ codespan-reporting = "0.11.0" # It is enabled for now to avoid having to do a significant overhaul of the renderer just for wasm. # When the 'atomics' feature is enabled `fragile-send-sync-non-atomic` does nothing # and Bevy instead wraps `wgpu` types to verify they are not used off their origin thread. -wgpu = { version = "22", default-features = false, features = [ +wgpu = { version = "23", default-features = false, features = [ "wgsl", "dx12", "metal", "naga-ir", "fragile-send-sync-non-atomic-wasm", ] } -naga = { version = "22", features = ["wgsl-in"] } +naga = { version = "23", features = ["wgsl-in"] } serde = { version = "1", features = ["derive"] } bytemuck = { version = "1.5", features = ["derive", "must_cast"] } downcast-rs = "1.2.0" @@ -97,12 +97,12 @@ offset-allocator = "0.2" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] # Omit the `glsl` feature in non-WebAssembly by default. -naga_oil = { version = "0.15", default-features = false, features = [ +naga_oil = { version = "0.16", default-features = false, features = [ "test_shader", ] } [target.'cfg(target_arch = "wasm32")'.dependencies] -naga_oil = "0.15" +naga_oil = "0.16" js-sys = "0.3" web-sys = { version = "0.3.67", features = [ 'Blob', diff --git a/crates/bevy_render/src/render_resource/bind_group.rs b/crates/bevy_render/src/render_resource/bind_group.rs index 4ac07a16d5..73e2579406 100644 --- a/crates/bevy_render/src/render_resource/bind_group.rs +++ b/crates/bevy_render/src/render_resource/bind_group.rs @@ -45,6 +45,18 @@ impl From for BindGroup { } } +impl<'a> From<&'a BindGroup> for Option<&'a wgpu::BindGroup> { + fn from(value: &'a BindGroup) -> Self { + Some(value.deref()) + } +} + +impl<'a> From<&'a mut BindGroup> for Option<&'a wgpu::BindGroup> { + fn from(value: &'a mut BindGroup) -> Self { + Some(&*value) + } +} + impl Deref for BindGroup { type Target = wgpu::BindGroup; diff --git a/crates/bevy_render/src/render_resource/pipeline_cache.rs b/crates/bevy_render/src/render_resource/pipeline_cache.rs index 1cb64d06bf..c3ed894fc4 100644 --- a/crates/bevy_render/src/render_resource/pipeline_cache.rs +++ b/crates/bevy_render/src/render_resource/pipeline_cache.rs @@ -735,7 +735,6 @@ impl PipelineCache { let compilation_options = PipelineCompilationOptions { constants: &std::collections::HashMap::new(), zero_initialize_workgroup_memory: false, - vertex_pulling_transform: Default::default(), }; let descriptor = RawRenderPipelineDescriptor { @@ -747,7 +746,7 @@ impl PipelineCache { primitive: descriptor.primitive, vertex: RawVertexState { buffers: &vertex_buffer_layouts, - entry_point: descriptor.vertex.entry_point.deref(), + entry_point: Some(descriptor.vertex.entry_point.deref()), module: &vertex_module, // TODO: Should this be the same as the fragment compilation options? compilation_options: compilation_options.clone(), @@ -755,7 +754,7 @@ impl PipelineCache { fragment: fragment_data .as_ref() .map(|(module, entry_point, targets)| RawFragmentState { - entry_point, + entry_point: Some(entry_point), module, targets, // TODO: Should this be the same as the vertex compilation options? @@ -812,12 +811,11 @@ impl PipelineCache { label: descriptor.label.as_deref(), layout: layout.as_ref().map(|layout| -> &PipelineLayout { layout }), module: &compute_module, - entry_point: &descriptor.entry_point, + entry_point: Some(&descriptor.entry_point), // TODO: Expose this somehow compilation_options: PipelineCompilationOptions { constants: &std::collections::HashMap::new(), zero_initialize_workgroup_memory: false, - vertex_pulling_transform: Default::default(), }, cache: None, }; diff --git a/crates/bevy_winit/Cargo.toml b/crates/bevy_winit/Cargo.toml index 3e9e2ea5f0..f7f30470ea 100644 --- a/crates/bevy_winit/Cargo.toml +++ b/crates/bevy_winit/Cargo.toml @@ -51,7 +51,7 @@ cfg-if = "1.0" raw-window-handle = "0.6" serde = { version = "1.0", features = ["derive"], optional = true } bytemuck = { version = "1.5", optional = true } -wgpu-types = { version = "22", optional = true } +wgpu-types = { version = "23", optional = true } [target.'cfg(target_arch = "wasm32")'.dependencies] wasm-bindgen = { version = "0.2" } diff --git a/examples/mobile/bevy_mobile_example.xcodeproj/project.pbxproj b/examples/mobile/bevy_mobile_example.xcodeproj/project.pbxproj index ff5cc43333..858081f701 100644 --- a/examples/mobile/bevy_mobile_example.xcodeproj/project.pbxproj +++ b/examples/mobile/bevy_mobile_example.xcodeproj/project.pbxproj @@ -14,6 +14,7 @@ 55B7188F81C3C4183F81D3AE /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = A39528EB2CCB182F5328223A /* libc++.tbd */; }; 57CD6306253C7A940098CD4A /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 57CD6305253C7A940098CD4A /* AudioToolbox.framework */; }; 57CD630E253C80EC0098CD4A /* assets in Resources */ = {isa = PBXBuildFile; fileRef = 57CD630A253C7F5F0098CD4A /* assets */; }; + 6ADF1AB92CCDA73A00AF5F8E /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6ADF1AB82CCDA73A00AF5F8E /* QuartzCore.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -31,6 +32,7 @@ 55EAC02897847195D2F44C15 /* bevy_mobile_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = bevy_mobile_example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 57CD6305253C7A940098CD4A /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 57CD630A253C7F5F0098CD4A /* assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = assets; path = ../../../assets; sourceTree = ""; }; + 6ADF1AB82CCDA73A00AF5F8E /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 8EE7F1E3B0303533925D7E33 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; 96A1E5B62F48B379829E8A0D /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; }; 9F1B41978FA53999AA836D0F /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; @@ -44,6 +46,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 6ADF1AB92CCDA73A00AF5F8E /* QuartzCore.framework in Frameworks */, 442540D056ADB9AE61A0A590 /* Security.framework in Frameworks */, 134866208A035F8615C99114 /* Metal.framework in Frameworks */, 2604C99FAB5A8322EDCABB9F /* UIKit.framework in Frameworks */, @@ -86,6 +89,7 @@ EB028409C2D0655412DA6E44 /* Frameworks */ = { isa = PBXGroup; children = ( + 6ADF1AB82CCDA73A00AF5F8E /* QuartzCore.framework */, 57CD6305253C7A940098CD4A /* AudioToolbox.framework */, A39528EB2CCB182F5328223A /* libc++.tbd */, 96A1E5B62F48B379829E8A0D /* Metal.framework */, @@ -294,7 +298,7 @@ "-lbevy_mobile_example", "-lc++abi", ); - PRODUCT_BUNDLE_IDENTIFIER = "org.bevyengine.example"; + PRODUCT_BUNDLE_IDENTIFIER = org.bevyengine.example; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -402,7 +406,7 @@ "-lbevy_mobile_example", "-lc++abi", ); - PRODUCT_BUNDLE_IDENTIFIER = "org.bevyengine.example"; + PRODUCT_BUNDLE_IDENTIFIER = org.bevyengine.example; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; };