From 515236ddafa7a1550bc9db57e5baa887ceee7f85 Mon Sep 17 00:00:00 2001 From: charlotte Date: Sun, 29 Jun 2025 13:39:51 -0700 Subject: [PATCH 01/13] wgpu 45d78e2fb4c64d16018eb82c876751d11ad23031. --- crates/bevy_render/src/batching/gpu_preprocessing.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/bevy_render/src/batching/gpu_preprocessing.rs b/crates/bevy_render/src/batching/gpu_preprocessing.rs index ea5970431a..287c22068e 100644 --- a/crates/bevy_render/src/batching/gpu_preprocessing.rs +++ b/crates/bevy_render/src/batching/gpu_preprocessing.rs @@ -1120,8 +1120,7 @@ impl FromWorld for GpuPreprocessingSupport { device.limits().max_compute_workgroup_storage_size != 0; let downlevel_support = adapter.get_downlevel_capabilities().flags.contains( - DownlevelFlags::COMPUTE_SHADERS | - DownlevelFlags::VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW + DownlevelFlags::COMPUTE_SHADERS ); let max_supported_mode = if device.limits().max_compute_workgroup_size_x == 0 From 97e1737362062a38bcedb2fd2968af3f7815b502 Mon Sep 17 00:00:00 2001 From: charlotte Date: Sun, 29 Jun 2025 13:59:14 -0700 Subject: [PATCH 02/13] Upgrade to wgpu 26 --- .../src/contrast_adaptive_sharpening/node.rs | 1 + crates/bevy_anti_aliasing/src/fxaa/node.rs | 1 + crates/bevy_anti_aliasing/src/smaa/mod.rs | 3 +++ crates/bevy_anti_aliasing/src/taa/mod.rs | 2 ++ crates/bevy_color/Cargo.toml | 2 +- crates/bevy_core_pipeline/src/bloom/mod.rs | 3 +++ crates/bevy_core_pipeline/src/dof/mod.rs | 2 ++ crates/bevy_core_pipeline/src/motion_blur/node.rs | 1 + crates/bevy_core_pipeline/src/msaa_writeback.rs | 1 + crates/bevy_core_pipeline/src/post_process/mod.rs | 1 + crates/bevy_core_pipeline/src/tonemapping/node.rs | 1 + crates/bevy_image/Cargo.toml | 2 +- crates/bevy_mesh/Cargo.toml | 2 +- crates/bevy_pbr/src/ssr/mod.rs | 1 + crates/bevy_pbr/src/volumetric_fog/render.rs | 1 + crates/bevy_reflect/Cargo.toml | 2 +- crates/bevy_render/Cargo.toml | 8 ++++---- crates/bevy_render/src/camera/camera_driver_node.rs | 1 + crates/bevy_render/src/lib.rs | 1 + crates/bevy_render/src/render_resource/pipeline_cache.rs | 2 +- crates/bevy_render/src/settings.rs | 8 ++++---- crates/bevy_render/src/texture/texture_attachment.rs | 3 +++ crates/bevy_render/src/view/window/screenshot.rs | 1 + crates/bevy_winit/Cargo.toml | 2 +- 24 files changed, 38 insertions(+), 14 deletions(-) diff --git a/crates/bevy_anti_aliasing/src/contrast_adaptive_sharpening/node.rs b/crates/bevy_anti_aliasing/src/contrast_adaptive_sharpening/node.rs index 663d481e88..070b570997 100644 --- a/crates/bevy_anti_aliasing/src/contrast_adaptive_sharpening/node.rs +++ b/crates/bevy_anti_aliasing/src/contrast_adaptive_sharpening/node.rs @@ -98,6 +98,7 @@ impl Node for CasNode { label: Some("contrast_adaptive_sharpening"), color_attachments: &[Some(RenderPassColorAttachment { view: destination, + depth_slice: None, resolve_target: None, ops: Operations::default(), })], diff --git a/crates/bevy_anti_aliasing/src/fxaa/node.rs b/crates/bevy_anti_aliasing/src/fxaa/node.rs index a58f21d9a7..8881607cba 100644 --- a/crates/bevy_anti_aliasing/src/fxaa/node.rs +++ b/crates/bevy_anti_aliasing/src/fxaa/node.rs @@ -64,6 +64,7 @@ impl ViewNode for FxaaNode { label: Some("fxaa_pass"), color_attachments: &[Some(RenderPassColorAttachment { view: destination, + depth_slice: None, resolve_target: None, ops: Operations::default(), })], diff --git a/crates/bevy_anti_aliasing/src/smaa/mod.rs b/crates/bevy_anti_aliasing/src/smaa/mod.rs index 3996f389d0..a724d9922d 100644 --- a/crates/bevy_anti_aliasing/src/smaa/mod.rs +++ b/crates/bevy_anti_aliasing/src/smaa/mod.rs @@ -934,6 +934,7 @@ fn perform_edge_detection( label: Some("SMAA edge detection pass"), color_attachments: &[Some(RenderPassColorAttachment { view: &smaa_textures.edge_detection_color_texture.default_view, + depth_slice: None, resolve_target: None, ops: default(), })], @@ -989,6 +990,7 @@ fn perform_blending_weight_calculation( label: Some("SMAA blending weight calculation pass"), color_attachments: &[Some(RenderPassColorAttachment { view: &smaa_textures.blend_texture.default_view, + depth_slice: None, resolve_target: None, ops: default(), })], @@ -1045,6 +1047,7 @@ fn perform_neighborhood_blending( label: Some("SMAA neighborhood blending pass"), color_attachments: &[Some(RenderPassColorAttachment { view: destination, + depth_slice: None, resolve_target: None, ops: default(), })], diff --git a/crates/bevy_anti_aliasing/src/taa/mod.rs b/crates/bevy_anti_aliasing/src/taa/mod.rs index 442a268e2a..d5f1756a5c 100644 --- a/crates/bevy_anti_aliasing/src/taa/mod.rs +++ b/crates/bevy_anti_aliasing/src/taa/mod.rs @@ -208,11 +208,13 @@ impl ViewNode for TemporalAntiAliasNode { color_attachments: &[ Some(RenderPassColorAttachment { view: view_target.destination, + depth_slice: None, resolve_target: None, ops: Operations::default(), }), Some(RenderPassColorAttachment { view: &taa_history_textures.write.default_view, + depth_slice: None, resolve_target: None, ops: Operations::default(), }), diff --git a/crates/bevy_color/Cargo.toml b/crates/bevy_color/Cargo.toml index 22ade12709..45e69f31a5 100644 --- a/crates/bevy_color/Cargo.toml +++ b/crates/bevy_color/Cargo.toml @@ -20,7 +20,7 @@ serde = { version = "1.0", features = [ ], default-features = false, optional = true } thiserror = { version = "2", default-features = false } derive_more = { version = "2", default-features = false, features = ["from"] } -wgpu-types = { version = "25", default-features = false, optional = true } +wgpu-types = { path = "../../../../gfx-rs/wgpu/wgpu-types", default-features = false, optional = true } encase = { version = "0.10", default-features = false, optional = true } [features] diff --git a/crates/bevy_core_pipeline/src/bloom/mod.rs b/crates/bevy_core_pipeline/src/bloom/mod.rs index 901275e01c..6c65909de3 100644 --- a/crates/bevy_core_pipeline/src/bloom/mod.rs +++ b/crates/bevy_core_pipeline/src/bloom/mod.rs @@ -184,6 +184,7 @@ impl ViewNode for BloomNode { label: Some("bloom_downsampling_first_pass"), color_attachments: &[Some(RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: Operations::default(), })], @@ -208,6 +209,7 @@ impl ViewNode for BloomNode { label: Some("bloom_downsampling_pass"), color_attachments: &[Some(RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: Operations::default(), })], @@ -232,6 +234,7 @@ impl ViewNode for BloomNode { label: Some("bloom_upsampling_pass"), color_attachments: &[Some(RenderPassColorAttachment { view, + depth_slice: None, resolve_target: None, ops: Operations { load: LoadOp::Load, diff --git a/crates/bevy_core_pipeline/src/dof/mod.rs b/crates/bevy_core_pipeline/src/dof/mod.rs index 7e2f52e3fc..8fed4fead8 100644 --- a/crates/bevy_core_pipeline/src/dof/mod.rs +++ b/crates/bevy_core_pipeline/src/dof/mod.rs @@ -416,6 +416,7 @@ impl ViewNode for DepthOfFieldNode { let mut color_attachments: SmallVec<[_; 2]> = SmallVec::new(); color_attachments.push(Some(RenderPassColorAttachment { view: postprocess.destination, + depth_slice: None, resolve_target: None, ops: Operations { load: LoadOp::Clear(default()), @@ -436,6 +437,7 @@ impl ViewNode for DepthOfFieldNode { }; color_attachments.push(Some(RenderPassColorAttachment { view: &auxiliary_dof_texture.default_view, + depth_slice: None, resolve_target: None, ops: Operations { load: LoadOp::Clear(default()), diff --git a/crates/bevy_core_pipeline/src/motion_blur/node.rs b/crates/bevy_core_pipeline/src/motion_blur/node.rs index ade5f50d77..5fb8eeebcd 100644 --- a/crates/bevy_core_pipeline/src/motion_blur/node.rs +++ b/crates/bevy_core_pipeline/src/motion_blur/node.rs @@ -84,6 +84,7 @@ impl ViewNode for MotionBlurNode { label: Some("motion_blur_pass"), color_attachments: &[Some(RenderPassColorAttachment { view: post_process.destination, + depth_slice: None, resolve_target: None, ops: Operations::default(), })], diff --git a/crates/bevy_core_pipeline/src/msaa_writeback.rs b/crates/bevy_core_pipeline/src/msaa_writeback.rs index 5f82e10599..f71a9493af 100644 --- a/crates/bevy_core_pipeline/src/msaa_writeback.rs +++ b/crates/bevy_core_pipeline/src/msaa_writeback.rs @@ -87,6 +87,7 @@ impl ViewNode for MsaaWritebackNode { color_attachments: &[Some(RenderPassColorAttachment { // If MSAA is enabled, then the sampled texture will always exist view: target.sampled_main_texture_view().unwrap(), + depth_slice: None, resolve_target: Some(post_process.destination), ops: Operations { load: LoadOp::Clear(LinearRgba::BLACK.into()), diff --git a/crates/bevy_core_pipeline/src/post_process/mod.rs b/crates/bevy_core_pipeline/src/post_process/mod.rs index f7d2501b41..6a2b2f138b 100644 --- a/crates/bevy_core_pipeline/src/post_process/mod.rs +++ b/crates/bevy_core_pipeline/src/post_process/mod.rs @@ -390,6 +390,7 @@ impl ViewNode for PostProcessingNode { label: Some("postprocessing pass"), color_attachments: &[Some(RenderPassColorAttachment { view: post_process.destination, + depth_slice: None, resolve_target: None, ops: Operations::default(), })], diff --git a/crates/bevy_core_pipeline/src/tonemapping/node.rs b/crates/bevy_core_pipeline/src/tonemapping/node.rs index 0f8f6edc49..58dd673264 100644 --- a/crates/bevy_core_pipeline/src/tonemapping/node.rs +++ b/crates/bevy_core_pipeline/src/tonemapping/node.rs @@ -117,6 +117,7 @@ impl ViewNode for TonemappingNode { label: Some("tonemapping_pass"), color_attachments: &[Some(RenderPassColorAttachment { view: destination, + depth_slice: None, resolve_target: None, ops: Operations { load: LoadOp::Clear(Default::default()), // TODO shouldn't need to be cleared diff --git a/crates/bevy_image/Cargo.toml b/crates/bevy_image/Cargo.toml index 7b49b5210a..52da9d1b9d 100644 --- a/crates/bevy_image/Cargo.toml +++ b/crates/bevy_image/Cargo.toml @@ -70,7 +70,7 @@ image = { version = "0.25.2", default-features = false } # misc bitflags = { version = "2.3", features = ["serde"] } bytemuck = { version = "1.5" } -wgpu-types = { version = "25", default-features = false } +wgpu-types = { path = "../../../../gfx-rs/wgpu/wgpu-types", default-features = false } serde = { version = "1", features = ["derive"] } thiserror = { version = "2", default-features = false } futures-lite = "2.0.1" diff --git a/crates/bevy_mesh/Cargo.toml b/crates/bevy_mesh/Cargo.toml index 7807acbb9d..8f144188d0 100644 --- a/crates/bevy_mesh/Cargo.toml +++ b/crates/bevy_mesh/Cargo.toml @@ -27,7 +27,7 @@ bevy_platform = { path = "../bevy_platform", version = "0.17.0-dev", default-fea # other bitflags = { version = "2.3", features = ["serde"] } bytemuck = { version = "1.5" } -wgpu-types = { version = "25", default-features = false } +wgpu-types = { path = "../../../../gfx-rs/wgpu/wgpu-types", default-features = false } serde = { version = "1", default-features = false, features = [ "derive", ], optional = true } diff --git a/crates/bevy_pbr/src/ssr/mod.rs b/crates/bevy_pbr/src/ssr/mod.rs index f3d876ffde..74a0771468 100644 --- a/crates/bevy_pbr/src/ssr/mod.rs +++ b/crates/bevy_pbr/src/ssr/mod.rs @@ -311,6 +311,7 @@ impl ViewNode for ScreenSpaceReflectionsNode { label: Some("SSR pass"), color_attachments: &[Some(RenderPassColorAttachment { view: postprocess.destination, + depth_slice: None, resolve_target: None, ops: Operations::default(), })], diff --git a/crates/bevy_pbr/src/volumetric_fog/render.rs b/crates/bevy_pbr/src/volumetric_fog/render.rs index a5cd8e56f3..d65790eece 100644 --- a/crates/bevy_pbr/src/volumetric_fog/render.rs +++ b/crates/bevy_pbr/src/volumetric_fog/render.rs @@ -442,6 +442,7 @@ impl ViewNode for VolumetricFogNode { label: Some("volumetric lighting pass"), color_attachments: &[Some(RenderPassColorAttachment { view: view_target.main_texture_view(), + depth_slice: None, resolve_target: None, ops: Operations { load: LoadOp::Load, diff --git a/crates/bevy_reflect/Cargo.toml b/crates/bevy_reflect/Cargo.toml index ae3a3a856e..06e6833828 100644 --- a/crates/bevy_reflect/Cargo.toml +++ b/crates/bevy_reflect/Cargo.toml @@ -109,7 +109,7 @@ uuid = { version = "1.13.1", default-features = false, optional = true, features "serde", ] } variadics_please = "1.1" -wgpu-types = { version = "25", features = [ +wgpu-types = { path = "../../../../gfx-rs/wgpu/wgpu-types", features = [ "serde", ], optional = true, default-features = false } diff --git a/crates/bevy_render/Cargo.toml b/crates/bevy_render/Cargo.toml index a657da4f0e..65bb457b19 100644 --- a/crates/bevy_render/Cargo.toml +++ b/crates/bevy_render/Cargo.toml @@ -90,7 +90,7 @@ codespan-reporting = "0.12.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 = "25", default-features = false, features = [ +wgpu = { path = "../../../../gfx-rs/wgpu/wgpu", default-features = false, features = [ "wgsl", "dx12", "metal", @@ -99,7 +99,7 @@ wgpu = { version = "25", default-features = false, features = [ "naga-ir", "fragile-send-sync-non-atomic-wasm", ] } -naga = { version = "25", features = ["wgsl-in"] } +naga = { path = "../../../../gfx-rs/wgpu/naga", features = ["wgsl-in"] } serde = { version = "1", features = ["derive"] } bytemuck = { version = "1.5", features = ["derive", "must_cast"] } downcast-rs = { version = "2", default-features = false, features = ["std"] } @@ -125,7 +125,7 @@ wesl = { version = "0.1.2", optional = true } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] # Omit the `glsl` feature in non-WebAssembly by default. -naga_oil = { version = "0.18", default-features = false, features = [ +naga_oil = { path = "../../../naga_oil", default-features = false, features = [ "test_shader", ] } @@ -133,7 +133,7 @@ naga_oil = { version = "0.18", default-features = false, features = [ proptest = "1" [target.'cfg(target_arch = "wasm32")'.dependencies] -naga_oil = { version = "0.18" } +naga_oil = { path = "../../../naga_oil" } js-sys = "0.3" web-sys = { version = "0.3.67", features = [ 'Blob', diff --git a/crates/bevy_render/src/camera/camera_driver_node.rs b/crates/bevy_render/src/camera/camera_driver_node.rs index 8be5a345b4..065cca1a6f 100644 --- a/crates/bevy_render/src/camera/camera_driver_node.rs +++ b/crates/bevy_render/src/camera/camera_driver_node.rs @@ -76,6 +76,7 @@ impl Node for CameraDriverNode { label: Some("no_camera_clear_pass"), color_attachments: &[Some(RenderPassColorAttachment { view: swap_chain_texture, + depth_slice: None, resolve_target: None, ops: Operations { load: LoadOp::Clear(clear_color_global.to_linear().into()), diff --git a/crates/bevy_render/src/lib.rs b/crates/bevy_render/src/lib.rs index 526d75dccd..7c5428bc8e 100644 --- a/crates/bevy_render/src/lib.rs +++ b/crates/bevy_render/src/lib.rs @@ -370,6 +370,7 @@ impl Plugin for RenderPlugin { let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { backends, flags: settings.instance_flags, + memory_budget_thresholds: settings.instance_memory_budget_thresholds, backend_options: wgpu::BackendOptions { gl: wgpu::GlBackendOptions { gles_minor_version: settings.gles3_minor_version, diff --git a/crates/bevy_render/src/render_resource/pipeline_cache.rs b/crates/bevy_render/src/render_resource/pipeline_cache.rs index ebd3229636..88d334529e 100644 --- a/crates/bevy_render/src/render_resource/pipeline_cache.rs +++ b/crates/bevy_render/src/render_resource/pipeline_cache.rs @@ -401,7 +401,7 @@ impl ShaderCache { render_device.create_and_validate_shader_module(module_descriptor) } // SAFETY: we are interfacing with shader code, which may contain undefined behavior, - // such as indexing out of bounds. + // such as indexing out of bounds. // The checks required are prohibitively expensive and a poor default for game engines. ValidateShader::Disabled => unsafe { render_device.create_shader_module(module_descriptor) diff --git a/crates/bevy_render/src/settings.rs b/crates/bevy_render/src/settings.rs index 715bbb35f8..93d4a4827a 100644 --- a/crates/bevy_render/src/settings.rs +++ b/crates/bevy_render/src/settings.rs @@ -3,7 +3,7 @@ use crate::renderer::{ }; use alloc::borrow::Cow; -use wgpu::DxcShaderModel; +use wgpu::{DxcShaderModel, MemoryBudgetThresholds}; pub use wgpu::{ Backends, Dx12Compiler, Features as WgpuFeatures, Gles3MinorVersion, InstanceFlags, Limits as WgpuLimits, MemoryHints, PowerPreference, @@ -53,6 +53,8 @@ pub struct WgpuSettings { pub instance_flags: InstanceFlags, /// This hints to the WGPU device about the preferred memory allocation strategy. pub memory_hints: MemoryHints, + /// The thresholds for device memory budget. + pub instance_memory_budget_thresholds: MemoryBudgetThresholds, } impl Default for WgpuSettings { @@ -103,15 +105,12 @@ impl Default for WgpuSettings { Dx12Compiler::StaticDxc } else { let dxc = "dxcompiler.dll"; - let dxil = "dxil.dll"; if cfg!(target_os = "windows") && std::fs::metadata(dxc).is_ok() - && std::fs::metadata(dxil).is_ok() { Dx12Compiler::DynamicDxc { dxc_path: String::from(dxc), - dxil_path: String::from(dxil), max_shader_model: DxcShaderModel::V6_7, } } else { @@ -136,6 +135,7 @@ impl Default for WgpuSettings { gles3_minor_version, instance_flags, memory_hints: MemoryHints::default(), + instance_memory_budget_thresholds:MemoryBudgetThresholds::default(), } } } diff --git a/crates/bevy_render/src/texture/texture_attachment.rs b/crates/bevy_render/src/texture/texture_attachment.rs index ac3854227f..17ae6ea6c9 100644 --- a/crates/bevy_render/src/texture/texture_attachment.rs +++ b/crates/bevy_render/src/texture/texture_attachment.rs @@ -40,6 +40,7 @@ impl ColorAttachment { RenderPassColorAttachment { view: &resolve_target.default_view, + depth_slice: None, resolve_target: Some(&self.texture.default_view), ops: Operations { load: match (self.clear_color, first_call) { @@ -63,6 +64,7 @@ impl ColorAttachment { RenderPassColorAttachment { view: &self.texture.default_view, + depth_slice: None, resolve_target: None, ops: Operations { load: match (self.clear_color, first_call) { @@ -146,6 +148,7 @@ impl OutputColorAttachment { RenderPassColorAttachment { view: &self.view, + depth_slice: None, resolve_target: None, ops: Operations { load: match (clear_color, first_call) { diff --git a/crates/bevy_render/src/view/window/screenshot.rs b/crates/bevy_render/src/view/window/screenshot.rs index 9a64709f4e..8c778eb4fb 100644 --- a/crates/bevy_render/src/view/window/screenshot.rs +++ b/crates/bevy_render/src/view/window/screenshot.rs @@ -600,6 +600,7 @@ fn render_screenshot( label: Some("screenshot_to_screen_pass"), color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: texture_view, + depth_slice: None, resolve_target: None, ops: wgpu::Operations { load: wgpu::LoadOp::Load, diff --git a/crates/bevy_winit/Cargo.toml b/crates/bevy_winit/Cargo.toml index 43dcc0506b..8158a21702 100644 --- a/crates/bevy_winit/Cargo.toml +++ b/crates/bevy_winit/Cargo.toml @@ -59,7 +59,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 = "25", optional = true } +wgpu-types = { path = "../../../../gfx-rs/wgpu/wgpu-types", optional = true } accesskit = "0.19" tracing = { version = "0.1", default-features = false, features = ["std"] } From 3591ba31133208244ac315c0891d9ad38bc54812 Mon Sep 17 00:00:00 2001 From: charlotte Date: Sun, 29 Jun 2025 14:02:16 -0700 Subject: [PATCH 03/13] Meshlets. --- crates/bevy_pbr/src/meshlet/visibility_buffer_raster_node.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/bevy_pbr/src/meshlet/visibility_buffer_raster_node.rs b/crates/bevy_pbr/src/meshlet/visibility_buffer_raster_node.rs index 160097fc50..10104e10ee 100644 --- a/crates/bevy_pbr/src/meshlet/visibility_buffer_raster_node.rs +++ b/crates/bevy_pbr/src/meshlet/visibility_buffer_raster_node.rs @@ -595,6 +595,7 @@ fn raster_pass( }), color_attachments: &[Some(RenderPassColorAttachment { view: dummy_render_target, + depth_slice: None, resolve_target: None, ops: Operations { load: LoadOp::Clear(LinearRgba::BLACK.into()), From cb45943753bc158a9ff9e7319e37d70c94ebaf33 Mon Sep 17 00:00:00 2001 From: charlotte Date: Thu, 10 Jul 2025 13:38:20 -0700 Subject: [PATCH 04/13] Wgpu 26 released. --- crates/bevy_color/Cargo.toml | 2 +- crates/bevy_image/Cargo.toml | 2 +- crates/bevy_mesh/Cargo.toml | 2 +- crates/bevy_reflect/Cargo.toml | 2 +- crates/bevy_render/Cargo.toml | 8 ++++---- crates/bevy_render/src/render_resource/mod.rs | 2 +- crates/bevy_render/src/renderer/mod.rs | 9 +++++++++ crates/bevy_winit/Cargo.toml | 2 +- 8 files changed, 19 insertions(+), 10 deletions(-) diff --git a/crates/bevy_color/Cargo.toml b/crates/bevy_color/Cargo.toml index 45e69f31a5..071ffcd88b 100644 --- a/crates/bevy_color/Cargo.toml +++ b/crates/bevy_color/Cargo.toml @@ -20,7 +20,7 @@ serde = { version = "1.0", features = [ ], default-features = false, optional = true } thiserror = { version = "2", default-features = false } derive_more = { version = "2", default-features = false, features = ["from"] } -wgpu-types = { path = "../../../../gfx-rs/wgpu/wgpu-types", default-features = false, optional = true } +wgpu-types = { version= "26", default-features = false, optional = true } encase = { version = "0.10", default-features = false, optional = true } [features] diff --git a/crates/bevy_image/Cargo.toml b/crates/bevy_image/Cargo.toml index 52da9d1b9d..43c6db0987 100644 --- a/crates/bevy_image/Cargo.toml +++ b/crates/bevy_image/Cargo.toml @@ -70,7 +70,7 @@ image = { version = "0.25.2", default-features = false } # misc bitflags = { version = "2.3", features = ["serde"] } bytemuck = { version = "1.5" } -wgpu-types = { path = "../../../../gfx-rs/wgpu/wgpu-types", default-features = false } +wgpu-types = { version= "26", default-features = false } serde = { version = "1", features = ["derive"] } thiserror = { version = "2", default-features = false } futures-lite = "2.0.1" diff --git a/crates/bevy_mesh/Cargo.toml b/crates/bevy_mesh/Cargo.toml index 8f144188d0..8ec810a037 100644 --- a/crates/bevy_mesh/Cargo.toml +++ b/crates/bevy_mesh/Cargo.toml @@ -27,7 +27,7 @@ bevy_platform = { path = "../bevy_platform", version = "0.17.0-dev", default-fea # other bitflags = { version = "2.3", features = ["serde"] } bytemuck = { version = "1.5" } -wgpu-types = { path = "../../../../gfx-rs/wgpu/wgpu-types", default-features = false } +wgpu-types = { version= "26", default-features = false } serde = { version = "1", default-features = false, features = [ "derive", ], optional = true } diff --git a/crates/bevy_reflect/Cargo.toml b/crates/bevy_reflect/Cargo.toml index 06e6833828..e00ac01885 100644 --- a/crates/bevy_reflect/Cargo.toml +++ b/crates/bevy_reflect/Cargo.toml @@ -109,7 +109,7 @@ uuid = { version = "1.13.1", default-features = false, optional = true, features "serde", ] } variadics_please = "1.1" -wgpu-types = { path = "../../../../gfx-rs/wgpu/wgpu-types", features = [ +wgpu-types = { version= "26", features = [ "serde", ], optional = true, default-features = false } diff --git a/crates/bevy_render/Cargo.toml b/crates/bevy_render/Cargo.toml index 65bb457b19..d35f702eb9 100644 --- a/crates/bevy_render/Cargo.toml +++ b/crates/bevy_render/Cargo.toml @@ -90,7 +90,7 @@ codespan-reporting = "0.12.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 = { path = "../../../../gfx-rs/wgpu/wgpu", default-features = false, features = [ +wgpu = { version = "26", default-features = false, features = [ "wgsl", "dx12", "metal", @@ -99,7 +99,7 @@ wgpu = { path = "../../../../gfx-rs/wgpu/wgpu", default-features = false, featur "naga-ir", "fragile-send-sync-non-atomic-wasm", ] } -naga = { path = "../../../../gfx-rs/wgpu/naga", features = ["wgsl-in"] } +naga = { version = "26", features = ["wgsl-in"] } serde = { version = "1", features = ["derive"] } bytemuck = { version = "1.5", features = ["derive", "must_cast"] } downcast-rs = { version = "2", default-features = false, features = ["std"] } @@ -125,7 +125,7 @@ wesl = { version = "0.1.2", optional = true } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] # Omit the `glsl` feature in non-WebAssembly by default. -naga_oil = { path = "../../../naga_oil", default-features = false, features = [ +naga_oil = { git = "https://github.com/tychedelia/naga_oil", branch = "wgpu-26", default-features = false, features = [ "test_shader", ] } @@ -133,7 +133,7 @@ naga_oil = { path = "../../../naga_oil", default-features = false, features = [ proptest = "1" [target.'cfg(target_arch = "wasm32")'.dependencies] -naga_oil = { path = "../../../naga_oil" } +naga_oil = { git = "https://github.com/tychedelia/naga_oil", branch = "wgpu-26" } js-sys = "0.3" web-sys = { version = "0.3.67", features = [ 'Blob', diff --git a/crates/bevy_render/src/render_resource/mod.rs b/crates/bevy_render/src/render_resource/mod.rs index 09be66e840..8c0f87d716 100644 --- a/crates/bevy_render/src/render_resource/mod.rs +++ b/crates/bevy_render/src/render_resource/mod.rs @@ -60,7 +60,7 @@ pub use wgpu::{ TexelCopyBufferInfo, TexelCopyBufferLayout, TexelCopyTextureInfo, TextureAspect, TextureDescriptor, TextureDimension, TextureFormat, TextureFormatFeatureFlags, TextureFormatFeatures, TextureSampleType, TextureUsages, TextureView as WgpuTextureView, - TextureViewDescriptor, TextureViewDimension, Tlas, TlasInstance, TlasPackage, VertexAttribute, + TextureViewDescriptor, TextureViewDimension, Tlas, TlasInstance, VertexAttribute, VertexBufferLayout as RawVertexBufferLayout, VertexFormat, VertexState as RawVertexState, VertexStepMode, COPY_BUFFER_ALIGNMENT, }; diff --git a/crates/bevy_render/src/renderer/mod.rs b/crates/bevy_render/src/renderer/mod.rs index 5df4967757..9eddba9122 100644 --- a/crates/bevy_render/src/renderer/mod.rs +++ b/crates/bevy_render/src/renderer/mod.rs @@ -294,6 +294,14 @@ pub async fn initialize_renderer( max_non_sampler_bindings: limits .max_non_sampler_bindings .min(constrained_limits.max_non_sampler_bindings), + max_blas_primitive_count: limits.max_blas_primitive_count + .min(constrained_limits.max_blas_primitive_count), + max_blas_geometry_count: limits + .max_blas_geometry_count + .min(constrained_limits.max_blas_geometry_count), + max_tlas_instance_count: limits + .max_tlas_instance_count + .min(constrained_limits.max_tlas_instance_count), max_color_attachments: limits .max_color_attachments .min(constrained_limits.max_color_attachments), @@ -306,6 +314,7 @@ pub async fn initialize_renderer( max_subgroup_size: limits .max_subgroup_size .min(constrained_limits.max_subgroup_size), + max_acceleration_structures_per_shader_stage: 0, }; } diff --git a/crates/bevy_winit/Cargo.toml b/crates/bevy_winit/Cargo.toml index 8158a21702..63336913e1 100644 --- a/crates/bevy_winit/Cargo.toml +++ b/crates/bevy_winit/Cargo.toml @@ -59,7 +59,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 = { path = "../../../../gfx-rs/wgpu/wgpu-types", optional = true } +wgpu-types = { version= "26", optional = true } accesskit = "0.19" tracing = { version = "0.1", default-features = false, features = ["std"] } From 9f966186ed7e6d898ebd83d13949b6ce40c16e9a Mon Sep 17 00:00:00 2001 From: charlotte Date: Thu, 10 Jul 2025 13:42:06 -0700 Subject: [PATCH 05/13] Ci. --- crates/bevy_color/Cargo.toml | 2 +- crates/bevy_image/Cargo.toml | 2 +- crates/bevy_mesh/Cargo.toml | 2 +- crates/bevy_reflect/Cargo.toml | 2 +- crates/bevy_winit/Cargo.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/bevy_color/Cargo.toml b/crates/bevy_color/Cargo.toml index 071ffcd88b..81a9795d58 100644 --- a/crates/bevy_color/Cargo.toml +++ b/crates/bevy_color/Cargo.toml @@ -20,7 +20,7 @@ serde = { version = "1.0", features = [ ], default-features = false, optional = true } thiserror = { version = "2", default-features = false } derive_more = { version = "2", default-features = false, features = ["from"] } -wgpu-types = { version= "26", default-features = false, optional = true } +wgpu-types = { version = "26", default-features = false, optional = true } encase = { version = "0.10", default-features = false, optional = true } [features] diff --git a/crates/bevy_image/Cargo.toml b/crates/bevy_image/Cargo.toml index 43c6db0987..10440c5ab0 100644 --- a/crates/bevy_image/Cargo.toml +++ b/crates/bevy_image/Cargo.toml @@ -70,7 +70,7 @@ image = { version = "0.25.2", default-features = false } # misc bitflags = { version = "2.3", features = ["serde"] } bytemuck = { version = "1.5" } -wgpu-types = { version= "26", default-features = false } +wgpu-types = { version = "26", default-features = false } serde = { version = "1", features = ["derive"] } thiserror = { version = "2", default-features = false } futures-lite = "2.0.1" diff --git a/crates/bevy_mesh/Cargo.toml b/crates/bevy_mesh/Cargo.toml index c6cc4465ad..026e96f5ce 100644 --- a/crates/bevy_mesh/Cargo.toml +++ b/crates/bevy_mesh/Cargo.toml @@ -26,7 +26,7 @@ bevy_platform = { path = "../bevy_platform", version = "0.17.0-dev", default-fea # other bitflags = { version = "2.3", features = ["serde"] } bytemuck = { version = "1.5" } -wgpu-types = { version= "26", default-features = false } +wgpu-types = { version = "26", default-features = false } serde = { version = "1", default-features = false, features = [ "derive", ], optional = true } diff --git a/crates/bevy_reflect/Cargo.toml b/crates/bevy_reflect/Cargo.toml index 7de8931b7a..e2fa168b07 100644 --- a/crates/bevy_reflect/Cargo.toml +++ b/crates/bevy_reflect/Cargo.toml @@ -109,7 +109,7 @@ uuid = { version = "1.13.1", default-features = false, optional = true, features "serde", ] } variadics_please = "1.1" -wgpu-types = { version= "26", features = [ +wgpu-types = { version = "26", features = [ "serde", ], optional = true, default-features = false } diff --git a/crates/bevy_winit/Cargo.toml b/crates/bevy_winit/Cargo.toml index a466de0aef..2b820bf37e 100644 --- a/crates/bevy_winit/Cargo.toml +++ b/crates/bevy_winit/Cargo.toml @@ -56,7 +56,7 @@ approx = { version = "0.5", default-features = false } cfg-if = "1.0" raw-window-handle = "0.6" bytemuck = { version = "1.5", optional = true } -wgpu-types = { version= "26", optional = true } +wgpu-types = { version = "26", optional = true } accesskit = "0.19" tracing = { version = "0.1", default-features = false, features = ["std"] } From 87b00aa74ec28f99ece1b6e29d7438c7ce8ba74f Mon Sep 17 00:00:00 2001 From: charlotte Date: Thu, 10 Jul 2025 13:47:40 -0700 Subject: [PATCH 06/13] Fix bevy_camera. --- crates/bevy_camera/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_camera/Cargo.toml b/crates/bevy_camera/Cargo.toml index 6ed3998a82..d6cbd46667 100644 --- a/crates/bevy_camera/Cargo.toml +++ b/crates/bevy_camera/Cargo.toml @@ -26,7 +26,7 @@ bevy_color = { path = "../bevy_color", version = "0.17.0-dev", features = [ bevy_window = { path = "../bevy_window", version = "0.17.0-dev" } # other -wgpu-types = { version = "25", default-features = false } +wgpu-types = { version = "26", default-features = false } serde = { version = "1", default-features = false, features = ["derive"] } thiserror = { version = "2", default-features = false } downcast-rs = { version = "2", default-features = false, features = ["std"] } From 08ce3a524d161902dd3566ad70fa26ad6644aa44 Mon Sep 17 00:00:00 2001 From: charlotte Date: Thu, 10 Jul 2025 13:52:18 -0700 Subject: [PATCH 07/13] Ci. --- crates/bevy_render/src/settings.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/bevy_render/src/settings.rs b/crates/bevy_render/src/settings.rs index d9415dec4d..411a21ceeb 100644 --- a/crates/bevy_render/src/settings.rs +++ b/crates/bevy_render/src/settings.rs @@ -3,11 +3,11 @@ use crate::renderer::{ }; use alloc::borrow::Cow; -use wgpu::{DxcShaderModel, MemoryBudgetThresholds}; pub use wgpu::{ Backends, Dx12Compiler, Features as WgpuFeatures, Gles3MinorVersion, InstanceFlags, Limits as WgpuLimits, MemoryHints, PowerPreference, }; +use wgpu::{DxcShaderModel, MemoryBudgetThresholds}; /// Configures the priority used when automatically configuring the features/limits of `wgpu`. #[derive(Clone)] @@ -110,9 +110,7 @@ impl Default for WgpuSettings { } else { let dxc = "dxcompiler.dll"; - if cfg!(target_os = "windows") - && std::fs::metadata(dxc).is_ok() - { + if cfg!(target_os = "windows") && std::fs::metadata(dxc).is_ok() { Dx12Compiler::DynamicDxc { dxc_path: String::from(dxc), max_shader_model: DxcShaderModel::V6_7, @@ -139,7 +137,7 @@ impl Default for WgpuSettings { gles3_minor_version, instance_flags, memory_hints: MemoryHints::default(), - instance_memory_budget_thresholds:MemoryBudgetThresholds::default(), + instance_memory_budget_thresholds: MemoryBudgetThresholds::default(), force_fallback_adapter: false, adapter_name: None, } From be3010cafea2f7686db9d2ac1bba341fe896b6b7 Mon Sep 17 00:00:00 2001 From: Charlotte McElwain Date: Thu, 10 Jul 2025 13:57:20 -0700 Subject: [PATCH 08/13] Ci. --- crates/bevy_render/src/batching/gpu_preprocessing.rs | 7 ++++--- crates/bevy_render/src/render_resource/pipeline_cache.rs | 2 +- crates/bevy_render/src/renderer/mod.rs | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/bevy_render/src/batching/gpu_preprocessing.rs b/crates/bevy_render/src/batching/gpu_preprocessing.rs index cde099702b..c8a0f1817e 100644 --- a/crates/bevy_render/src/batching/gpu_preprocessing.rs +++ b/crates/bevy_render/src/batching/gpu_preprocessing.rs @@ -1122,9 +1122,10 @@ impl FromWorld for GpuPreprocessingSupport { // `max_compute_*` limits to zero, so we arbitrarily pick one as a canary. device.limits().max_compute_workgroup_storage_size != 0; - let downlevel_support = adapter.get_downlevel_capabilities().flags.contains( - DownlevelFlags::COMPUTE_SHADERS - ); + let downlevel_support = adapter + .get_downlevel_capabilities() + .flags + .contains(DownlevelFlags::COMPUTE_SHADERS); let max_supported_mode = if device.limits().max_compute_workgroup_size_x == 0 || is_non_supported_android_device(adapter) diff --git a/crates/bevy_render/src/render_resource/pipeline_cache.rs b/crates/bevy_render/src/render_resource/pipeline_cache.rs index a261af29c3..328c5e5600 100644 --- a/crates/bevy_render/src/render_resource/pipeline_cache.rs +++ b/crates/bevy_render/src/render_resource/pipeline_cache.rs @@ -404,7 +404,7 @@ impl ShaderCache { render_device.create_and_validate_shader_module(module_descriptor) } // SAFETY: we are interfacing with shader code, which may contain undefined behavior, - // such as indexing out of bounds. + // such as indexing out of bounds. // The checks required are prohibitively expensive and a poor default for game engines. ValidateShader::Disabled => unsafe { render_device.create_shader_module(module_descriptor) diff --git a/crates/bevy_render/src/renderer/mod.rs b/crates/bevy_render/src/renderer/mod.rs index 0eed8342a7..fad8030a3b 100644 --- a/crates/bevy_render/src/renderer/mod.rs +++ b/crates/bevy_render/src/renderer/mod.rs @@ -322,7 +322,8 @@ pub async fn initialize_renderer( max_non_sampler_bindings: limits .max_non_sampler_bindings .min(constrained_limits.max_non_sampler_bindings), - max_blas_primitive_count: limits.max_blas_primitive_count + max_blas_primitive_count: limits + .max_blas_primitive_count .min(constrained_limits.max_blas_primitive_count), max_blas_geometry_count: limits .max_blas_geometry_count From f1be78ca85c91075f5acbdd146d6360ab68cf37e Mon Sep 17 00:00:00 2001 From: Charlotte McElwain Date: Thu, 10 Jul 2025 14:11:44 -0700 Subject: [PATCH 09/13] Fix solari. --- crates/bevy_solari/src/scene/binder.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/bevy_solari/src/scene/binder.rs b/crates/bevy_solari/src/scene/binder.rs index f14b5dbe23..ce8e75188c 100644 --- a/crates/bevy_solari/src/scene/binder.rs +++ b/crates/bevy_solari/src/scene/binder.rs @@ -71,14 +71,14 @@ pub fn prepare_raytracing_scene_bindings( let mut textures = CachedBindingArray::new(); let mut samplers = Vec::new(); let mut materials = StorageBufferList::::default(); - let mut tlas = TlasPackage::new(render_device.wgpu_device().create_tlas( - &CreateTlasDescriptor { + let mut tlas = render_device + .wgpu_device() + .create_tlas(&CreateTlasDescriptor { label: Some("tlas"), flags: AccelerationStructureFlags::PREFER_FAST_TRACE, update_mode: AccelerationStructureUpdateMode::Build, max_instances: instances_query.iter().len() as u32, - }, - )); + }); let mut transforms = StorageBufferList::::default(); let mut geometry_ids = StorageBufferList::::default(); let mut material_ids = StorageBufferList::::default(); From 4b0ed4fca92982fbd5aba6f91ba746d20709244d Mon Sep 17 00:00:00 2001 From: Charlotte McElwain Date: Thu, 10 Jul 2025 14:15:48 -0700 Subject: [PATCH 10/13] Fix tracy. --- crates/bevy_render/src/diagnostic/tracy_gpu.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_render/src/diagnostic/tracy_gpu.rs b/crates/bevy_render/src/diagnostic/tracy_gpu.rs index 7a66db4ea6..c429c0ee24 100644 --- a/crates/bevy_render/src/diagnostic/tracy_gpu.rs +++ b/crates/bevy_render/src/diagnostic/tracy_gpu.rs @@ -56,7 +56,7 @@ fn initial_timestamp(device: &RenderDevice, queue: &RenderQueue) -> i64 { // Workaround for https://github.com/gfx-rs/wgpu/issues/6406 // TODO when that bug is fixed, merge these encoders together again let mut copy_encoder = device.create_command_encoder(&CommandEncoderDescriptor::default()); - copy_encoder.copy_buffer_to_buffer(&resolve_buffer, 0, &map_buffer, 0, QUERY_SIZE as _); + copy_encoder.copy_buffer_to_buffer(&resolve_buffer, 0, &map_buffer, 0, Some(QUERY_SIZE as _)); queue.submit([timestamp_encoder.finish(), copy_encoder.finish()]); map_buffer.slice(..).map_async(MapMode::Read, |_| ()); From e8779c2f7ad0b95f9ac859b154b0a1d81f7d2970 Mon Sep 17 00:00:00 2001 From: Charlotte McElwain Date: Thu, 10 Jul 2025 14:31:23 -0700 Subject: [PATCH 11/13] Ci. --- examples/shader/custom_post_processing.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/shader/custom_post_processing.rs b/examples/shader/custom_post_processing.rs index 81e2b7e17b..a5b1687b6c 100644 --- a/examples/shader/custom_post_processing.rs +++ b/examples/shader/custom_post_processing.rs @@ -197,6 +197,7 @@ impl ViewNode for PostProcessNode { // We need to specify the post process destination view here // to make sure we write to the appropriate texture. view: post_process.destination, + depth_slice: None, resolve_target: None, ops: Operations::default(), })], From 2f1353973eec3cb3debf213867bfb69ac9b9e8d5 Mon Sep 17 00:00:00 2001 From: Charlotte McElwain Date: Thu, 10 Jul 2025 14:56:03 -0700 Subject: [PATCH 12/13] Wasm. --- crates/bevy_core_pipeline/src/deferred/node.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/bevy_core_pipeline/src/deferred/node.rs b/crates/bevy_core_pipeline/src/deferred/node.rs index ab87fccee6..a8e1b7ab8e 100644 --- a/crates/bevy_core_pipeline/src/deferred/node.rs +++ b/crates/bevy_core_pipeline/src/deferred/node.rs @@ -176,6 +176,7 @@ fn run_deferred_prepass<'w>( load: bevy_render::render_resource::LoadOp::Load, store: StoreOp::Store, }, + depth_slice: None, } } #[cfg(any( From 02fd3b34ef15ecd8259f0c495c9e5e60c73d3267 Mon Sep 17 00:00:00 2001 From: Charlotte McElwain Date: Wed, 16 Jul 2025 12:36:04 -0700 Subject: [PATCH 13/13] Switch to upstream naga-oil. --- crates/bevy_render/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_render/Cargo.toml b/crates/bevy_render/Cargo.toml index 2df66e2294..cc4ca4d758 100644 --- a/crates/bevy_render/Cargo.toml +++ b/crates/bevy_render/Cargo.toml @@ -127,7 +127,7 @@ wesl = { version = "0.1.2", optional = true } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] # Omit the `glsl` feature in non-WebAssembly by default. -naga_oil = { git = "https://github.com/tychedelia/naga_oil", branch = "wgpu-26", default-features = false, features = [ +naga_oil = { git = "https://github.com/bevyengine/naga_oil", default-features = false, features = [ "test_shader", ] } @@ -135,7 +135,7 @@ naga_oil = { git = "https://github.com/tychedelia/naga_oil", branch = "wgpu-26", proptest = "1" [target.'cfg(target_arch = "wasm32")'.dependencies] -naga_oil = { git = "https://github.com/tychedelia/naga_oil", branch = "wgpu-26" } +naga_oil = { git = "https://github.com/bevyengine/naga_oil" } js-sys = "0.3" web-sys = { version = "0.3.67", features = [ 'Blob',