diff --git a/Cargo.toml b/Cargo.toml index 54f99d37b5a77..1969e520829db 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["game", "engine", "gamedev", "graphics", "bevy"] license = "MIT OR Apache-2.0" repository = "https://github.com/bevyengine/bevy" documentation = "https://docs.rs/bevy" -rust-version = "1.89.0" +rust-version = "1.92.0" [workspace] resolver = "2" diff --git a/crates/bevy_anti_alias/Cargo.toml b/crates/bevy_anti_alias/Cargo.toml index 54d69899e4847..7ed03ccba4364 100644 --- a/crates/bevy_anti_alias/Cargo.toml +++ b/crates/bevy_anti_alias/Cargo.toml @@ -34,7 +34,8 @@ bevy_diagnostic = { path = "../bevy_diagnostic", version = "0.18.0-dev" } # other tracing = { version = "0.1", default-features = false, features = ["std"] } -dlss_wgpu = { version = "2", optional = true } +# dlss_wgpu = { version = "2", optional = true } +dlss_wgpu = { git = "https://github.com/ChristopherBiscardi/dlss_wgpu.git", branch = "wgpu-28", optional = true } uuid = { version = "1", optional = true } [lints] diff --git a/crates/bevy_anti_alias/src/contrast_adaptive_sharpening/node.rs b/crates/bevy_anti_alias/src/contrast_adaptive_sharpening/node.rs index e253f28946ecc..5da195d0afcb7 100644 --- a/crates/bevy_anti_alias/src/contrast_adaptive_sharpening/node.rs +++ b/crates/bevy_anti_alias/src/contrast_adaptive_sharpening/node.rs @@ -108,6 +108,7 @@ impl Node for CasNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }; let mut render_pass = render_context diff --git a/crates/bevy_anti_alias/src/dlss/node.rs b/crates/bevy_anti_alias/src/dlss/node.rs index aae59fa95b821..b73ac14b2b3fe 100644 --- a/crates/bevy_anti_alias/src/dlss/node.rs +++ b/crates/bevy_anti_alias/src/dlss/node.rs @@ -77,12 +77,13 @@ impl ViewNode for DlssNode { command_encoder.push_debug_group("dlss_super_resolution"); let time_span = diagnostics.time_span(command_encoder, "dlss_super_resolution"); - dlss_context + let dlss_command_buffer = dlss_context .render(render_parameters, command_encoder, &adapter) .expect("Failed to render DLSS Super Resolution"); time_span.end(command_encoder); command_encoder.pop_debug_group(); + render_context.add_command_buffer(dlss_command_buffer); Ok(()) } @@ -153,13 +154,15 @@ impl ViewNode for DlssNode { command_encoder.push_debug_group("dlss_ray_reconstruction"); let time_span = diagnostics.time_span(command_encoder, "dlss_ray_reconstruction"); - dlss_context + let dlss_command_buffer = dlss_context .render(render_parameters, command_encoder, &adapter) .expect("Failed to render DLSS Ray Reconstruction"); time_span.end(command_encoder); command_encoder.pop_debug_group(); + render_context.add_command_buffer(dlss_command_buffer); + Ok(()) } } diff --git a/crates/bevy_anti_alias/src/fxaa/mod.rs b/crates/bevy_anti_alias/src/fxaa/mod.rs index 302fa572cf0a6..b45c7cad5fe95 100644 --- a/crates/bevy_anti_alias/src/fxaa/mod.rs +++ b/crates/bevy_anti_alias/src/fxaa/mod.rs @@ -147,7 +147,7 @@ pub fn init_fxaa_pipeline( ); let sampler = render_device.create_sampler(&SamplerDescriptor { - mipmap_filter: FilterMode::Linear, + mipmap_filter: MipmapFilterMode::Linear, mag_filter: FilterMode::Linear, min_filter: FilterMode::Linear, ..default() diff --git a/crates/bevy_anti_alias/src/fxaa/node.rs b/crates/bevy_anti_alias/src/fxaa/node.rs index bf520b776c4c5..dc758e66ffb24 100644 --- a/crates/bevy_anti_alias/src/fxaa/node.rs +++ b/crates/bevy_anti_alias/src/fxaa/node.rs @@ -74,6 +74,7 @@ impl ViewNode for FxaaNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }; let mut render_pass = render_context diff --git a/crates/bevy_anti_alias/src/smaa/mod.rs b/crates/bevy_anti_alias/src/smaa/mod.rs index ee28af6b69bb7..3e5e7103a2042 100644 --- a/crates/bevy_anti_alias/src/smaa/mod.rs +++ b/crates/bevy_anti_alias/src/smaa/mod.rs @@ -944,6 +944,7 @@ fn perform_edge_detection( }), timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }; // Run the actual render pass. @@ -1003,6 +1004,7 @@ fn perform_blending_weight_calculation( }), timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }; // Run the actual render pass. @@ -1056,6 +1058,7 @@ fn perform_neighborhood_blending( depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }; let mut neighborhood_blending_render_pass = render_context diff --git a/crates/bevy_anti_alias/src/taa/mod.rs b/crates/bevy_anti_alias/src/taa/mod.rs index 377de519c1560..78c566637118a 100644 --- a/crates/bevy_anti_alias/src/taa/mod.rs +++ b/crates/bevy_anti_alias/src/taa/mod.rs @@ -216,6 +216,7 @@ impl ViewNode for TemporalAntiAliasNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); let pass_span = diagnostics.pass_span(&mut taa_pass, "taa"); diff --git a/crates/bevy_camera/Cargo.toml b/crates/bevy_camera/Cargo.toml index 6b310b65d69a0..c436cec8bd80e 100644 --- a/crates/bevy_camera/Cargo.toml +++ b/crates/bevy_camera/Cargo.toml @@ -28,7 +28,7 @@ bevy_color = { path = "../bevy_color", version = "0.18.0-dev", features = [ bevy_window = { path = "../bevy_window", version = "0.18.0-dev" } # other -wgpu-types = { version = "27", default-features = false } +wgpu-types = { version = "28", 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"] } diff --git a/crates/bevy_color/Cargo.toml b/crates/bevy_color/Cargo.toml index 07b4d17292b17..87f18887e15ee 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 = "27", default-features = false, optional = true } +wgpu-types = { version = "28", default-features = false, optional = true } encase = { version = "0.12", default-features = false, optional = true } [features] diff --git a/crates/bevy_core_pipeline/src/core_2d/main_opaque_pass_2d_node.rs b/crates/bevy_core_pipeline/src/core_2d/main_opaque_pass_2d_node.rs index e8cd0c65c6888..d7a70acce73d0 100644 --- a/crates/bevy_core_pipeline/src/core_2d/main_opaque_pass_2d_node.rs +++ b/crates/bevy_core_pipeline/src/core_2d/main_opaque_pass_2d_node.rs @@ -70,6 +70,7 @@ impl ViewNode for MainOpaquePass2dNode { depth_stencil_attachment, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); let mut render_pass = TrackedRenderPass::new(&render_device, render_pass); let pass_span = diagnostics.pass_span(&mut render_pass, "main_opaque_pass_2d"); diff --git a/crates/bevy_core_pipeline/src/core_2d/main_transparent_pass_2d_node.rs b/crates/bevy_core_pipeline/src/core_2d/main_transparent_pass_2d_node.rs index 4054283a5738a..4afe34c038c44 100644 --- a/crates/bevy_core_pipeline/src/core_2d/main_transparent_pass_2d_node.rs +++ b/crates/bevy_core_pipeline/src/core_2d/main_transparent_pass_2d_node.rs @@ -71,6 +71,7 @@ impl ViewNode for MainTransparentPass2dNode { depth_stencil_attachment, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); let mut render_pass = TrackedRenderPass::new(&render_device, render_pass); @@ -107,6 +108,7 @@ impl ViewNode for MainTransparentPass2dNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }; command_encoder.begin_render_pass(&pass_descriptor); diff --git a/crates/bevy_core_pipeline/src/core_3d/main_opaque_pass_3d_node.rs b/crates/bevy_core_pipeline/src/core_3d/main_opaque_pass_3d_node.rs index 25cf2ac75c58e..c0acf148c3e3c 100644 --- a/crates/bevy_core_pipeline/src/core_3d/main_opaque_pass_3d_node.rs +++ b/crates/bevy_core_pipeline/src/core_3d/main_opaque_pass_3d_node.rs @@ -88,6 +88,7 @@ impl ViewNode for MainOpaquePass3dNode { depth_stencil_attachment, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); let mut render_pass = TrackedRenderPass::new(&render_device, render_pass); let pass_span = diagnostics.pass_span(&mut render_pass, "main_opaque_pass_3d"); diff --git a/crates/bevy_core_pipeline/src/core_3d/main_transmissive_pass_3d_node.rs b/crates/bevy_core_pipeline/src/core_3d/main_transmissive_pass_3d_node.rs index 1319534bf3971..27dd5f7730bcd 100644 --- a/crates/bevy_core_pipeline/src/core_3d/main_transmissive_pass_3d_node.rs +++ b/crates/bevy_core_pipeline/src/core_3d/main_transmissive_pass_3d_node.rs @@ -64,6 +64,7 @@ impl ViewNode for MainTransmissivePass3dNode { depth_stencil_attachment: Some(depth.get_attachment(StoreOp::Store)), timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }; // Run the transmissive pass, sorted back-to-front diff --git a/crates/bevy_core_pipeline/src/core_3d/main_transparent_pass_3d_node.rs b/crates/bevy_core_pipeline/src/core_3d/main_transparent_pass_3d_node.rs index bd54b7849e9c5..b18f0ab191fa6 100644 --- a/crates/bevy_core_pipeline/src/core_3d/main_transparent_pass_3d_node.rs +++ b/crates/bevy_core_pipeline/src/core_3d/main_transparent_pass_3d_node.rs @@ -66,6 +66,7 @@ impl ViewNode for MainTransparentPass3dNode { depth_stencil_attachment: Some(depth.get_attachment(StoreOp::Store)), timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); let pass_span = diagnostics.pass_span(&mut render_pass, "main_transparent_pass_3d"); @@ -95,6 +96,7 @@ impl ViewNode for MainTransparentPass3dNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }; render_context diff --git a/crates/bevy_core_pipeline/src/deferred/copy_lighting_id.rs b/crates/bevy_core_pipeline/src/deferred/copy_lighting_id.rs index 1889fc33ce6d9..f917fafa99bb7 100644 --- a/crates/bevy_core_pipeline/src/deferred/copy_lighting_id.rs +++ b/crates/bevy_core_pipeline/src/deferred/copy_lighting_id.rs @@ -99,6 +99,7 @@ impl ViewNode for CopyDeferredLightingIdNode { }), timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); let pass_span = diagnostics.pass_span(&mut render_pass, "copy_deferred_lighting_id"); diff --git a/crates/bevy_core_pipeline/src/deferred/node.rs b/crates/bevy_core_pipeline/src/deferred/node.rs index 49bf3dc5adf19..9c0aa577b6aa7 100644 --- a/crates/bevy_core_pipeline/src/deferred/node.rs +++ b/crates/bevy_core_pipeline/src/deferred/node.rs @@ -223,6 +223,7 @@ fn run_deferred_prepass<'w>( depth_stencil_attachment, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); let mut render_pass = TrackedRenderPass::new(&render_device, render_pass); let pass_span = diagnostic.pass_span(&mut render_pass, label); diff --git a/crates/bevy_core_pipeline/src/fullscreen_material.rs b/crates/bevy_core_pipeline/src/fullscreen_material.rs index 4de57f54cbfc9..48b16b3055d3a 100644 --- a/crates/bevy_core_pipeline/src/fullscreen_material.rs +++ b/crates/bevy_core_pipeline/src/fullscreen_material.rs @@ -318,6 +318,7 @@ impl ViewNode for FullscreenMaterialNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); render_pass.set_render_pipeline(pipeline); diff --git a/crates/bevy_core_pipeline/src/mip_generation/experimental/depth.rs b/crates/bevy_core_pipeline/src/mip_generation/experimental/depth.rs index 2d76071cbdba5..ad869ddd895b4 100644 --- a/crates/bevy_core_pipeline/src/mip_generation/experimental/depth.rs +++ b/crates/bevy_core_pipeline/src/mip_generation/experimental/depth.rs @@ -33,8 +33,8 @@ use bevy_render::{ binding_types::{sampler, texture_2d, texture_2d_multisampled, texture_storage_2d}, BindGroup, BindGroupEntries, BindGroupLayout, BindGroupLayoutEntries, CachedComputePipelineId, ComputePassDescriptor, ComputePipeline, ComputePipelineDescriptor, - Extent3d, IntoBinding, PipelineCache, PushConstantRange, Sampler, SamplerBindingType, - SamplerDescriptor, ShaderStages, SpecializedComputePipeline, SpecializedComputePipelines, + Extent3d, IntoBinding, PipelineCache, Sampler, SamplerBindingType, SamplerDescriptor, + ShaderStages, SpecializedComputePipeline, SpecializedComputePipelines, StorageTextureAccess, TextureAspect, TextureDescriptor, TextureDimension, TextureFormat, TextureSampleType, TextureUsages, TextureView, TextureViewDescriptor, TextureViewDimension, }, @@ -428,10 +428,7 @@ impl SpecializedComputePipeline for DownsampleDepthPipeline { ComputePipelineDescriptor { label: Some(label), layout: vec![self.bind_group_layout.clone()], - push_constant_ranges: vec![PushConstantRange { - stages: ShaderStages::COMPUTE, - range: 0..4, - }], + immediate_size: 4, shader: self.shader.clone(), shader_defs, entry_point: Some(if key.contains(DownsampleDepthPipelineKey::SECOND_PHASE) { @@ -624,8 +621,8 @@ impl ViewDepthPyramid { timestamp_writes: None, }); downsample_pass.set_pipeline(downsample_depth_first_pipeline); - // Pass the mip count as a push constant, for simplicity. - downsample_pass.set_push_constants(0, &self.mip_count.to_le_bytes()); + // Pass the mip count as an immediate, for simplicity. + downsample_pass.set_immediates(0, &self.mip_count.to_le_bytes()); downsample_pass.set_bind_group(0, downsample_depth_bind_group, &[]); downsample_pass.dispatch_workgroups(view_size.x.div_ceil(64), view_size.y.div_ceil(64), 1); diff --git a/crates/bevy_core_pipeline/src/mip_generation/experimental/downsample_depth.wgsl b/crates/bevy_core_pipeline/src/mip_generation/experimental/downsample_depth.wgsl index 12a4d2b178bff..532ddc3fd4958 100644 --- a/crates/bevy_core_pipeline/src/mip_generation/experimental/downsample_depth.wgsl +++ b/crates/bevy_core_pipeline/src/mip_generation/experimental/downsample_depth.wgsl @@ -25,7 +25,7 @@ @group(0) @binding(12) var mip_12: texture_storage_2d; @group(0) @binding(13) var samplr: sampler; struct Constants { max_mip_level: u32 } -var constants: Constants; +var constants: Constants; /// Generates a hierarchical depth buffer. /// Based on FidelityFX SPD v2.1 https://github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK/blob/d7531ae47d8b36a5d4025663e731a47a38be882f/sdk/include/FidelityFX/gpu/spd/ffx_spd.h#L528 diff --git a/crates/bevy_core_pipeline/src/mip_generation/mod.rs b/crates/bevy_core_pipeline/src/mip_generation/mod.rs index aa19f8994a750..fd402cd0947c0 100644 --- a/crates/bevy_core_pipeline/src/mip_generation/mod.rs +++ b/crates/bevy_core_pipeline/src/mip_generation/mod.rs @@ -36,8 +36,8 @@ use bevy_render::{ diagnostic::RecordDiagnostics as _, render_asset::RenderAssets, render_resource::{ - binding_types::uniform_buffer, BindGroupLayoutDescriptor, FilterMode, ShaderType, - TextureFormatFeatureFlags, UniformBuffer, + binding_types::uniform_buffer, BindGroupLayoutDescriptor, FilterMode, MipmapFilterMode, + ShaderType, TextureFormatFeatureFlags, UniformBuffer, }, renderer::{RenderAdapter, RenderQueue}, settings::WgpuFeatures, @@ -372,7 +372,7 @@ impl FromWorld for MipGenerationResources { label: Some("mip generation sampler"), mag_filter: FilterMode::Linear, min_filter: FilterMode::Linear, - mipmap_filter: FilterMode::Nearest, + mipmap_filter: MipmapFilterMode::Nearest, ..default() }), } @@ -865,7 +865,7 @@ fn create_downsampling_pipelines( pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor { label: Some(format!("mip generation pipeline, pass 1 ({:?})", texture_format).into()), layout: vec![downsampling_bind_group_layout_pass_1.clone()], - push_constant_ranges: vec![], + immediate_size: 0, shader: downsample_shader.clone(), shader_defs: downsampling_first_shader_defs, entry_point: Some("downsample_first".into()), @@ -878,7 +878,7 @@ fn create_downsampling_pipelines( pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor { label: Some(format!("mip generation pipeline, pass 2 ({:?})", texture_format).into()), layout: vec![downsampling_bind_group_layout_pass_2.clone()], - push_constant_ranges: vec![], + immediate_size: 0, shader: downsample_shader.clone(), shader_defs: downsampling_second_shader_defs, entry_point: Some("downsample_second".into()), diff --git a/crates/bevy_core_pipeline/src/oit/resolve/node.rs b/crates/bevy_core_pipeline/src/oit/resolve/node.rs index 4aa1ee201c8f6..9ff1fb25c7592 100644 --- a/crates/bevy_core_pipeline/src/oit/resolve/node.rs +++ b/crates/bevy_core_pipeline/src/oit/resolve/node.rs @@ -66,6 +66,7 @@ impl ViewNode for OitResolveNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); let pass_span = diagnostics.pass_span(&mut render_pass, "oit_resolve"); diff --git a/crates/bevy_core_pipeline/src/prepass/node.rs b/crates/bevy_core_pipeline/src/prepass/node.rs index d429fc9289d76..1633c2279a8ad 100644 --- a/crates/bevy_core_pipeline/src/prepass/node.rs +++ b/crates/bevy_core_pipeline/src/prepass/node.rs @@ -182,6 +182,7 @@ fn run_prepass<'w>( depth_stencil_attachment, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); let mut render_pass = TrackedRenderPass::new(&render_device, render_pass); diff --git a/crates/bevy_core_pipeline/src/tonemapping/node.rs b/crates/bevy_core_pipeline/src/tonemapping/node.rs index 19fb63b6347e8..146ea46d421c8 100644 --- a/crates/bevy_core_pipeline/src/tonemapping/node.rs +++ b/crates/bevy_core_pipeline/src/tonemapping/node.rs @@ -130,6 +130,7 @@ impl ViewNode for TonemappingNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }; let mut render_pass = render_context diff --git a/crates/bevy_core_pipeline/src/upscaling/node.rs b/crates/bevy_core_pipeline/src/upscaling/node.rs index 3d7b2c9905068..7005d3870f3a5 100644 --- a/crates/bevy_core_pipeline/src/upscaling/node.rs +++ b/crates/bevy_core_pipeline/src/upscaling/node.rs @@ -81,6 +81,7 @@ impl ViewNode for UpscalingNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }; let mut render_pass = render_context diff --git a/crates/bevy_image/Cargo.toml b/crates/bevy_image/Cargo.toml index 008772a5179d6..335e726775845 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 = "27", default-features = false } +wgpu-types = { version = "28", default-features = false } serde = { version = "1", features = ["derive"] } thiserror = { version = "2", default-features = false } futures-lite = "2.0.1" diff --git a/crates/bevy_image/src/image.rs b/crates/bevy_image/src/image.rs index ad2db13e2b182..64c55ec4ab680 100644 --- a/crates/bevy_image/src/image.rs +++ b/crates/bevy_image/src/image.rs @@ -20,9 +20,9 @@ use core::hash::Hash; use serde::{Deserialize, Serialize}; use thiserror::Error; use wgpu_types::{ - AddressMode, CompareFunction, Extent3d, Features, FilterMode, SamplerBorderColor, - SamplerDescriptor, TextureDataOrder, TextureDescriptor, TextureDimension, TextureFormat, - TextureUsages, TextureViewDescriptor, + AddressMode, CompareFunction, Extent3d, Features, FilterMode, MipmapFilterMode, + SamplerBorderColor, SamplerDescriptor, TextureDataOrder, TextureDescriptor, TextureDimension, + TextureFormat, TextureUsages, TextureViewDescriptor, }; /// Trait used to provide default values for Bevy-external types that @@ -891,6 +891,15 @@ impl From for FilterMode { } } +impl From for MipmapFilterMode { + fn from(value: ImageFilterMode) -> Self { + match value { + ImageFilterMode::Nearest => MipmapFilterMode::Nearest, + ImageFilterMode::Linear => MipmapFilterMode::Linear, + } + } +} + impl From for CompareFunction { fn from(value: ImageCompareFunction) -> Self { match value { @@ -928,6 +937,15 @@ impl From for ImageAddressMode { } } +impl From for ImageFilterMode { + fn from(value: MipmapFilterMode) -> Self { + match value { + MipmapFilterMode::Nearest => ImageFilterMode::Nearest, + MipmapFilterMode::Linear => ImageFilterMode::Linear, + } + } +} + impl From for ImageFilterMode { fn from(value: FilterMode) -> Self { match value { diff --git a/crates/bevy_mesh/Cargo.toml b/crates/bevy_mesh/Cargo.toml index c8e48307dc204..b20d0aa153e65 100644 --- a/crates/bevy_mesh/Cargo.toml +++ b/crates/bevy_mesh/Cargo.toml @@ -27,7 +27,7 @@ bevy_platform = { path = "../bevy_platform", version = "0.18.0-dev", default-fea # other bitflags = { version = "2.3", features = ["serde"] } bytemuck = { version = "1.5" } -wgpu-types = { version = "27", default-features = false } +wgpu-types = { version = "28", default-features = false } serde = { version = "1", default-features = false, features = [ "derive", ], optional = true } diff --git a/crates/bevy_pbr/src/atmosphere/node.rs b/crates/bevy_pbr/src/atmosphere/node.rs index 9f640b524b886..32696f61651a3 100644 --- a/crates/bevy_pbr/src/atmosphere/node.rs +++ b/crates/bevy_pbr/src/atmosphere/node.rs @@ -212,6 +212,7 @@ impl ViewNode for RenderSkyNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); let pass_span = diagnostics.pass_span(&mut render_sky_pass, "render_sky"); diff --git a/crates/bevy_pbr/src/atmosphere/resources.rs b/crates/bevy_pbr/src/atmosphere/resources.rs index 1d2657d09837b..f71c5e152651a 100644 --- a/crates/bevy_pbr/src/atmosphere/resources.rs +++ b/crates/bevy_pbr/src/atmosphere/resources.rs @@ -238,7 +238,7 @@ impl FromWorld for AtmosphereSampler { let sampler = render_device.create_sampler(&SamplerDescriptor { mag_filter: FilterMode::Linear, min_filter: FilterMode::Linear, - mipmap_filter: FilterMode::Nearest, + mipmap_filter: MipmapFilterMode::Nearest, ..Default::default() }); diff --git a/crates/bevy_pbr/src/deferred/mod.rs b/crates/bevy_pbr/src/deferred/mod.rs index 41766372d9f36..d760e30a95c99 100644 --- a/crates/bevy_pbr/src/deferred/mod.rs +++ b/crates/bevy_pbr/src/deferred/mod.rs @@ -202,6 +202,7 @@ impl ViewNode for DeferredOpaquePass3dPbrLightingNode { }), timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); let pass_span = diagnostics.pass_span(&mut render_pass, "deferred_lighting"); diff --git a/crates/bevy_pbr/src/light_probe/generate.rs b/crates/bevy_pbr/src/light_probe/generate.rs index 8eaae00c5da34..d75774fa406ec 100644 --- a/crates/bevy_pbr/src/light_probe/generate.rs +++ b/crates/bevy_pbr/src/light_probe/generate.rs @@ -35,11 +35,11 @@ use bevy_render::{ render_resource::{ binding_types::*, AddressMode, BindGroup, BindGroupEntries, BindGroupLayoutDescriptor, BindGroupLayoutEntries, CachedComputePipelineId, ComputePassDescriptor, - ComputePipelineDescriptor, DownlevelFlags, Extent3d, FilterMode, PipelineCache, Sampler, - SamplerBindingType, SamplerDescriptor, ShaderStages, ShaderType, StorageTextureAccess, - Texture, TextureAspect, TextureDescriptor, TextureDimension, TextureFormat, - TextureSampleType, TextureUsages, TextureView, TextureViewDescriptor, TextureViewDimension, - UniformBuffer, + ComputePipelineDescriptor, DownlevelFlags, Extent3d, FilterMode, MipmapFilterMode, + PipelineCache, Sampler, SamplerBindingType, SamplerDescriptor, ShaderStages, ShaderType, + StorageTextureAccess, Texture, TextureAspect, TextureDescriptor, TextureDimension, + TextureFormat, TextureSampleType, TextureUsages, TextureView, TextureViewDescriptor, + TextureViewDimension, UniformBuffer, }, renderer::{RenderAdapter, RenderContext, RenderDevice, RenderQueue}, settings::WgpuFeatures, @@ -342,7 +342,7 @@ pub fn initialize_generated_environment_map_resources( address_mode_w: AddressMode::ClampToEdge, mag_filter: FilterMode::Linear, min_filter: FilterMode::Linear, - mipmap_filter: FilterMode::Linear, + mipmap_filter: MipmapFilterMode::Linear, ..Default::default() }); @@ -375,7 +375,7 @@ pub fn initialize_generated_environment_map_resources( let downsample_first = pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor { label: Some("downsampling_first_pipeline".into()), layout: vec![layouts.downsampling_first.clone()], - push_constant_ranges: vec![], + immediate_size: 0, shader: downsampling_shader.clone(), shader_defs: { let mut defs = shader_defs.clone(); @@ -391,7 +391,7 @@ pub fn initialize_generated_environment_map_resources( let downsample_second = pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor { label: Some("downsampling_second_pipeline".into()), layout: vec![layouts.downsampling_second.clone()], - push_constant_ranges: vec![], + immediate_size: 0, shader: downsampling_shader.clone(), shader_defs: { let mut defs = shader_defs.clone(); @@ -408,7 +408,7 @@ pub fn initialize_generated_environment_map_resources( let radiance = pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor { label: Some("radiance_pipeline".into()), layout: vec![layouts.radiance.clone()], - push_constant_ranges: vec![], + immediate_size: 0, shader: env_filter_shader.clone(), shader_defs: shader_defs.clone(), entry_point: Some("generate_radiance_map".into()), @@ -419,7 +419,7 @@ pub fn initialize_generated_environment_map_resources( let irradiance = pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor { label: Some("irradiance_pipeline".into()), layout: vec![layouts.irradiance.clone()], - push_constant_ranges: vec![], + immediate_size: 0, shader: env_filter_shader, shader_defs: shader_defs.clone(), entry_point: Some("generate_irradiance_map".into()), @@ -430,7 +430,7 @@ pub fn initialize_generated_environment_map_resources( let copy_pipeline = pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor { label: Some("copy_pipeline".into()), layout: vec![layouts.copy.clone()], - push_constant_ranges: vec![], + immediate_size: 0, shader: copy_shader, shader_defs: vec![], entry_point: Some("copy".into()), diff --git a/crates/bevy_pbr/src/material_bind_groups.rs b/crates/bevy_pbr/src/material_bind_groups.rs index d987725bfda72..14b537d4d5e03 100644 --- a/crates/bevy_pbr/src/material_bind_groups.rs +++ b/crates/bevy_pbr/src/material_bind_groups.rs @@ -18,9 +18,10 @@ use bevy_render::{ BindGroup, BindGroupEntry, BindGroupLayoutDescriptor, BindingNumber, BindingResource, BindingResources, BindlessDescriptor, BindlessIndex, BindlessIndexTableDescriptor, BindlessResourceType, Buffer, BufferBinding, BufferDescriptor, BufferId, - BufferInitDescriptor, BufferUsages, CompareFunction, FilterMode, OwnedBindingResource, - PreparedBindGroup, RawBufferVec, Sampler, SamplerDescriptor, SamplerId, TextureView, - TextureViewDimension, TextureViewId, UnpreparedBindGroup, WgpuSampler, WgpuTextureView, + BufferInitDescriptor, BufferUsages, CompareFunction, FilterMode, MipmapFilterMode, + OwnedBindingResource, PreparedBindGroup, RawBufferVec, Sampler, SamplerDescriptor, + SamplerId, TextureView, TextureViewDimension, TextureViewId, UnpreparedBindGroup, + WgpuSampler, WgpuTextureView, }, renderer::{RenderDevice, RenderQueue}, settings::WgpuFeatures, @@ -1802,7 +1803,7 @@ pub fn init_fallback_bindless_resources(mut commands: Commands, render_device: R label: Some("fallback non-filtering sampler"), mag_filter: FilterMode::Nearest, min_filter: FilterMode::Nearest, - mipmap_filter: FilterMode::Nearest, + mipmap_filter: MipmapFilterMode::Nearest, ..default() }), comparison_sampler: render_device.create_sampler(&SamplerDescriptor { diff --git a/crates/bevy_pbr/src/meshlet/clear_visibility_buffer.wgsl b/crates/bevy_pbr/src/meshlet/clear_visibility_buffer.wgsl index 5956921ca1609..908bd2e7d4b01 100644 --- a/crates/bevy_pbr/src/meshlet/clear_visibility_buffer.wgsl +++ b/crates/bevy_pbr/src/meshlet/clear_visibility_buffer.wgsl @@ -3,7 +3,7 @@ #else @group(0) @binding(0) var meshlet_visibility_buffer: texture_storage_2d; #endif -var view_size: vec2; +var view_size: vec2; @compute @workgroup_size(16, 16, 1) diff --git a/crates/bevy_pbr/src/meshlet/material_pipeline_prepare.rs b/crates/bevy_pbr/src/meshlet/material_pipeline_prepare.rs index e00c41900146d..06858e5dcda1c 100644 --- a/crates/bevy_pbr/src/meshlet/material_pipeline_prepare.rs +++ b/crates/bevy_pbr/src/meshlet/material_pipeline_prepare.rs @@ -193,7 +193,7 @@ pub fn prepare_material_meshlet_meshes_main_opaque_pass( let pipeline_descriptor = RenderPipelineDescriptor { label: material_pipeline_descriptor.label, layout, - push_constant_ranges: vec![], + immediate_size: 0, vertex: VertexState { shader: meshlet_pipelines.meshlet_mesh_material.clone(), shader_defs: shader_defs.clone(), diff --git a/crates/bevy_pbr/src/meshlet/material_shade_nodes.rs b/crates/bevy_pbr/src/meshlet/material_shade_nodes.rs index 890df912f4e93..9efacd6188442 100644 --- a/crates/bevy_pbr/src/meshlet/material_shade_nodes.rs +++ b/crates/bevy_pbr/src/meshlet/material_shade_nodes.rs @@ -106,6 +106,7 @@ impl ViewNode for MeshletMainOpaquePass3dNode { }), timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); let pass_span = diagnostics.pass_span(&mut render_pass, "meshlet_material_opaque_3d_pass"); if let Some(viewport) = @@ -233,6 +234,7 @@ impl ViewNode for MeshletPrepassNode { }), timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); let pass_span = diagnostics.pass_span(&mut render_pass, "meshlet_material_prepass"); if let Some(viewport) = @@ -370,6 +372,7 @@ impl ViewNode for MeshletDeferredGBufferPrepassNode { }), timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); let pass_span = diagnostics.pass_span(&mut render_pass, "meshlet_material_deferred_prepass"); diff --git a/crates/bevy_pbr/src/meshlet/meshlet_bindings.wgsl b/crates/bevy_pbr/src/meshlet/meshlet_bindings.wgsl index 9d624f3757f23..c301cf01bf6bf 100644 --- a/crates/bevy_pbr/src/meshlet/meshlet_bindings.wgsl +++ b/crates/bevy_pbr/src/meshlet/meshlet_bindings.wgsl @@ -88,7 +88,7 @@ const CENTIMETERS_PER_METER = 100.0; #ifdef MESHLET_INSTANCE_CULLING_PASS struct Constants { scene_instance_count: u32 } -var constants: Constants; +var constants: Constants; // Cull data @group(0) @binding(0) var depth_pyramid: texture_2d; @@ -119,7 +119,7 @@ var constants: Constants; #ifdef MESHLET_BVH_CULLING_PASS struct Constants { read_from_front: u32, rightmost_slot: u32 } -var constants: Constants; +var constants: Constants; // Cull data @group(0) @binding(0) var depth_pyramid: texture_2d; // From the end of the last frame for the first culling pass, and from the first raster pass for the second culling pass @@ -155,7 +155,7 @@ var constants: Constants; #ifdef MESHLET_CLUSTER_CULLING_PASS struct Constants { rightmost_slot: u32 } -var constants: Constants; +var constants: Constants; // Cull data @group(0) @binding(0) var depth_pyramid: texture_2d; // From the end of the last frame for the first culling pass, and from the first raster pass for the second culling pass diff --git a/crates/bevy_pbr/src/meshlet/mod.rs b/crates/bevy_pbr/src/meshlet/mod.rs index 13ec1444c8f0a..bbb546bf7e891 100644 --- a/crates/bevy_pbr/src/meshlet/mod.rs +++ b/crates/bevy_pbr/src/meshlet/mod.rs @@ -137,7 +137,7 @@ impl MeshletPlugin { | WgpuFeatures::SHADER_INT64 | WgpuFeatures::SUBGROUP | WgpuFeatures::DEPTH_CLIP_CONTROL - | WgpuFeatures::PUSH_CONSTANTS + | WgpuFeatures::IMMEDIATES } } diff --git a/crates/bevy_pbr/src/meshlet/pipelines.rs b/crates/bevy_pbr/src/meshlet/pipelines.rs index 6c9f964cd7d16..9226dc21900cf 100644 --- a/crates/bevy_pbr/src/meshlet/pipelines.rs +++ b/crates/bevy_pbr/src/meshlet/pipelines.rs @@ -119,10 +119,7 @@ pub fn init_meshlet_pipelines( clear_visibility_buffer: pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor { label: Some("meshlet_clear_visibility_buffer_pipeline".into()), layout: vec![clear_visibility_buffer_bind_group_layout], - push_constant_ranges: vec![PushConstantRange { - stages: ShaderStages::COMPUTE, - range: 0..8, - }], + immediate_size: 8, shader: clear_visibility_buffer.clone(), shader_defs: vec!["MESHLET_VISIBILITY_BUFFER_RASTER_PASS_OUTPUT".into()], ..default() @@ -132,10 +129,7 @@ pub fn init_meshlet_pipelines( ComputePipelineDescriptor { label: Some("meshlet_clear_visibility_buffer_shadow_view_pipeline".into()), layout: vec![clear_visibility_buffer_shadow_view_bind_group_layout], - push_constant_ranges: vec![PushConstantRange { - stages: ShaderStages::COMPUTE, - range: 0..8, - }], + immediate_size: 8, shader: clear_visibility_buffer, ..default() }, @@ -144,10 +138,7 @@ pub fn init_meshlet_pipelines( first_instance_cull: pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor { label: Some("meshlet_first_instance_cull_pipeline".into()), layout: vec![first_instance_cull_bind_group_layout.clone()], - push_constant_ranges: vec![PushConstantRange { - stages: ShaderStages::COMPUTE, - range: 0..4, - }], + immediate_size: 4, shader: cull_instances.clone(), shader_defs: vec![ "MESHLET_INSTANCE_CULLING_PASS".into(), @@ -159,10 +150,7 @@ pub fn init_meshlet_pipelines( second_instance_cull: pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor { label: Some("meshlet_second_instance_cull_pipeline".into()), layout: vec![second_instance_cull_bind_group_layout.clone()], - push_constant_ranges: vec![PushConstantRange { - stages: ShaderStages::COMPUTE, - range: 0..4, - }], + immediate_size: 4, shader: cull_instances, shader_defs: vec![ "MESHLET_INSTANCE_CULLING_PASS".into(), @@ -174,10 +162,7 @@ pub fn init_meshlet_pipelines( first_bvh_cull: pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor { label: Some("meshlet_first_bvh_cull_pipeline".into()), layout: vec![first_bvh_cull_bind_group_layout.clone()], - push_constant_ranges: vec![PushConstantRange { - stages: ShaderStages::COMPUTE, - range: 0..8, - }], + immediate_size: 8, shader: cull_bvh.clone(), shader_defs: vec![ "MESHLET_BVH_CULLING_PASS".into(), @@ -189,10 +174,7 @@ pub fn init_meshlet_pipelines( second_bvh_cull: pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor { label: Some("meshlet_second_bvh_cull_pipeline".into()), layout: vec![second_bvh_cull_bind_group_layout.clone()], - push_constant_ranges: vec![PushConstantRange { - stages: ShaderStages::COMPUTE, - range: 0..8, - }], + immediate_size: 8, shader: cull_bvh, shader_defs: vec![ "MESHLET_BVH_CULLING_PASS".into(), @@ -204,10 +186,7 @@ pub fn init_meshlet_pipelines( first_meshlet_cull: pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor { label: Some("meshlet_first_meshlet_cull_pipeline".into()), layout: vec![first_meshlet_cull_bind_group_layout.clone()], - push_constant_ranges: vec![PushConstantRange { - stages: ShaderStages::COMPUTE, - range: 0..4, - }], + immediate_size: 4, shader: cull_clusters.clone(), shader_defs: vec![ "MESHLET_CLUSTER_CULLING_PASS".into(), @@ -219,10 +198,7 @@ pub fn init_meshlet_pipelines( second_meshlet_cull: pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor { label: Some("meshlet_second_meshlet_cull_pipeline".into()), layout: vec![second_meshlet_cull_bind_group_layout.clone()], - push_constant_ranges: vec![PushConstantRange { - stages: ShaderStages::COMPUTE, - range: 0..4, - }], + immediate_size: 4, shader: cull_clusters, shader_defs: vec![ "MESHLET_CLUSTER_CULLING_PASS".into(), @@ -234,10 +210,7 @@ pub fn init_meshlet_pipelines( downsample_depth_first: pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor { label: Some("meshlet_downsample_depth_first_pipeline".into()), layout: vec![downsample_depth_layout.clone()], - push_constant_ranges: vec![PushConstantRange { - stages: ShaderStages::COMPUTE, - range: 0..4, - }], + immediate_size: 4, shader: downsample_depth_shader.clone(), shader_defs: vec![ "MESHLET_VISIBILITY_BUFFER_RASTER_PASS_OUTPUT".into(), @@ -250,10 +223,7 @@ pub fn init_meshlet_pipelines( downsample_depth_second: pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor { label: Some("meshlet_downsample_depth_second_pipeline".into()), layout: vec![downsample_depth_layout.clone()], - push_constant_ranges: vec![PushConstantRange { - stages: ShaderStages::COMPUTE, - range: 0..4, - }], + immediate_size: 4, shader: downsample_depth_shader.clone(), shader_defs: vec![ "MESHLET_VISIBILITY_BUFFER_RASTER_PASS_OUTPUT".into(), @@ -267,10 +237,7 @@ pub fn init_meshlet_pipelines( ComputePipelineDescriptor { label: Some("meshlet_downsample_depth_first_pipeline".into()), layout: vec![downsample_depth_shadow_view_layout.clone()], - push_constant_ranges: vec![PushConstantRange { - stages: ShaderStages::COMPUTE, - range: 0..4, - }], + immediate_size: 4, shader: downsample_depth_shader.clone(), shader_defs: vec!["MESHLET".into()], entry_point: Some("downsample_depth_first".into()), @@ -282,10 +249,7 @@ pub fn init_meshlet_pipelines( ComputePipelineDescriptor { label: Some("meshlet_downsample_depth_second_pipeline".into()), layout: vec![downsample_depth_shadow_view_layout], - push_constant_ranges: vec![PushConstantRange { - stages: ShaderStages::COMPUTE, - range: 0..4, - }], + immediate_size: 4, shader: downsample_depth_shader, shader_defs: vec!["MESHLET".into()], entry_point: Some("downsample_depth_second".into()), @@ -297,7 +261,7 @@ pub fn init_meshlet_pipelines( ComputePipelineDescriptor { label: Some("meshlet_visibility_buffer_software_raster_pipeline".into()), layout: vec![visibility_buffer_raster_layout.clone()], - push_constant_ranges: vec![], + immediate_size: 0, shader: visibility_buffer_software_raster.clone(), shader_defs: vec![ "MESHLET_VISIBILITY_BUFFER_RASTER_PASS".into(), @@ -319,7 +283,7 @@ pub fn init_meshlet_pipelines( "meshlet_visibility_buffer_software_raster_shadow_view_pipeline".into(), ), layout: vec![visibility_buffer_raster_shadow_view_layout.clone()], - push_constant_ranges: vec![], + immediate_size: 0, shader: visibility_buffer_software_raster, shader_defs: vec![ "MESHLET_VISIBILITY_BUFFER_RASTER_PASS".into(), @@ -338,10 +302,7 @@ pub fn init_meshlet_pipelines( RenderPipelineDescriptor { label: Some("meshlet_visibility_buffer_hardware_raster_pipeline".into()), layout: vec![visibility_buffer_raster_layout.clone()], - push_constant_ranges: vec![PushConstantRange { - stages: ShaderStages::VERTEX, - range: 0..4, - }], + immediate_size: 4, vertex: VertexState { shader: visibility_buffer_hardware_raster.clone(), shader_defs: vec![ @@ -373,10 +334,7 @@ pub fn init_meshlet_pipelines( "meshlet_visibility_buffer_hardware_raster_shadow_view_pipeline".into(), ), layout: vec![visibility_buffer_raster_shadow_view_layout.clone()], - push_constant_ranges: vec![PushConstantRange { - stages: ShaderStages::VERTEX, - range: 0..4, - }], + immediate_size: 4, vertex: VertexState { shader: visibility_buffer_hardware_raster.clone(), shader_defs: vec!["MESHLET_VISIBILITY_BUFFER_RASTER_PASS".into()], @@ -403,10 +361,7 @@ pub fn init_meshlet_pipelines( .into(), ), layout: vec![visibility_buffer_raster_shadow_view_layout], - push_constant_ranges: vec![PushConstantRange { - stages: ShaderStages::VERTEX, - range: 0..4, - }], + immediate_size: 4, vertex: VertexState { shader: visibility_buffer_hardware_raster.clone(), shader_defs: vec!["MESHLET_VISIBILITY_BUFFER_RASTER_PASS".into()], @@ -502,10 +457,7 @@ pub fn init_meshlet_pipelines( pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor { label: Some("meshlet_remap_1d_to_2d_dispatch_pipeline".into()), layout: vec![layout], - push_constant_ranges: vec![PushConstantRange { - stages: ShaderStages::COMPUTE, - range: 0..4, - }], + immediate_size: 4, shader: remap_1d_to_2d_dispatch, ..default() }) diff --git a/crates/bevy_pbr/src/meshlet/remap_1d_to_2d_dispatch.wgsl b/crates/bevy_pbr/src/meshlet/remap_1d_to_2d_dispatch.wgsl index b9970c42b42eb..aa5f35e07a87b 100644 --- a/crates/bevy_pbr/src/meshlet/remap_1d_to_2d_dispatch.wgsl +++ b/crates/bevy_pbr/src/meshlet/remap_1d_to_2d_dispatch.wgsl @@ -8,7 +8,7 @@ struct DispatchIndirectArgs { @group(0) @binding(0) var meshlet_software_raster_indirect_args: DispatchIndirectArgs; @group(0) @binding(1) var meshlet_software_raster_cluster_count: u32; -var max_compute_workgroups_per_dimension: u32; +var max_compute_workgroups_per_dimension: u32; @compute @workgroup_size(1, 1, 1) diff --git a/crates/bevy_pbr/src/meshlet/visibility_buffer_hardware_raster.wgsl b/crates/bevy_pbr/src/meshlet/visibility_buffer_hardware_raster.wgsl index 2a251443fbf50..ae03ca9f1fb08 100644 --- a/crates/bevy_pbr/src/meshlet/visibility_buffer_hardware_raster.wgsl +++ b/crates/bevy_pbr/src/meshlet/visibility_buffer_hardware_raster.wgsl @@ -15,7 +15,7 @@ mesh_functions::mesh_position_local_to_world, } #import bevy_render::maths::affine3_to_square -var meshlet_raster_cluster_rightmost_slot: u32; +var meshlet_raster_cluster_rightmost_slot: u32; /// Vertex/fragment shader for rasterizing large clusters into a visibility buffer. 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 fee4741308b85..cf9fa73e527fa 100644 --- a/crates/bevy_pbr/src/meshlet/visibility_buffer_raster_node.rs +++ b/crates/bevy_pbr/src/meshlet/visibility_buffer_raster_node.rs @@ -365,7 +365,7 @@ fn clear_visibility_buffer_pass( timestamp_writes: None, }); clear_visibility_buffer_pass.set_pipeline(clear_visibility_buffer_pipeline); - clear_visibility_buffer_pass.set_push_constants(0, bytemuck::bytes_of(&view_size)); + clear_visibility_buffer_pass.set_immediates(0, bytemuck::bytes_of(&view_size)); clear_visibility_buffer_pass.set_bind_group(0, clear_visibility_buffer_bind_group, &[]); clear_visibility_buffer_pass.dispatch_workgroups( view_size.x.div_ceil(16), @@ -538,7 +538,7 @@ fn cull_pass<'a>( view_offset: &'a ViewUniformOffset, previous_view_offset: &'a PreviousViewUniformOffset, pipeline: &'a ComputePipeline, - push_constants: &[u32], + immediates: &[u32], ) -> ComputePass<'a> { let command_encoder = render_context.command_encoder(); let mut pass = command_encoder.begin_compute_pass(&ComputePassDescriptor { @@ -551,7 +551,7 @@ fn cull_pass<'a>( bind_group, &[view_offset.offset, previous_view_offset.offset], ); - pass.set_push_constants(0, bytemuck::cast_slice(push_constants)); + pass.set_immediates(0, bytemuck::cast_slice(immediates)); pass } @@ -619,16 +619,13 @@ fn raster_pass( depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); if let Some(viewport) = camera.and_then(|camera| camera.viewport.as_ref()) { hardware_pass.set_camera_viewport(viewport); } hardware_pass.set_render_pipeline(visibility_buffer_hardware_raster_pipeline); - hardware_pass.set_push_constants( - ShaderStages::VERTEX, - 0, - &raster_cluster_rightmost_slot.to_le_bytes(), - ); + hardware_pass.set_immediates(0, &raster_cluster_rightmost_slot.to_le_bytes()); hardware_pass.set_bind_group( 0, &meshlet_view_bind_groups.visibility_buffer_raster, @@ -662,6 +659,7 @@ fn resolve_depth( depth_stencil_attachment: Some(depth_stencil_attachment), timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); if let Some(viewport) = &camera.viewport { resolve_pass.set_camera_viewport(viewport); @@ -695,6 +693,7 @@ fn resolve_material_depth( }), timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); if let Some(viewport) = &camera.viewport { resolve_pass.set_camera_viewport(viewport); diff --git a/crates/bevy_pbr/src/render/gpu_preprocess.rs b/crates/bevy_pbr/src/render/gpu_preprocess.rs index 88b3bb3a08788..01ebe2d0821bf 100644 --- a/crates/bevy_pbr/src/render/gpu_preprocess.rs +++ b/crates/bevy_pbr/src/render/gpu_preprocess.rs @@ -43,9 +43,9 @@ use bevy_render::{ binding_types::{storage_buffer, storage_buffer_read_only, texture_2d, uniform_buffer}, BindGroup, BindGroupEntries, BindGroupLayoutDescriptor, BindingResource, Buffer, BufferBinding, CachedComputePipelineId, ComputePassDescriptor, ComputePipelineDescriptor, - DynamicBindGroupLayoutEntries, PipelineCache, PushConstantRange, RawBufferVec, - ShaderStages, ShaderType, SpecializedComputePipeline, SpecializedComputePipelines, - TextureSampleType, UninitBufferVec, + DynamicBindGroupLayoutEntries, PipelineCache, RawBufferVec, ShaderStages, ShaderType, + SpecializedComputePipeline, SpecializedComputePipelines, TextureSampleType, + UninitBufferVec, }, renderer::{RenderContext, RenderDevice, RenderQueue}, settings::WgpuFeatures, @@ -728,7 +728,7 @@ impl Node for EarlyGpuPreprocessNode { .. } = *work_item_buffers { - compute_pass.set_push_constants( + compute_pass.set_immediates( 0, bytemuck::bytes_of(&late_indirect_parameters_indexed_offset), ); @@ -752,7 +752,7 @@ impl Node for EarlyGpuPreprocessNode { .. } = *work_item_buffers { - compute_pass.set_push_constants( + compute_pass.set_immediates( 0, bytemuck::bytes_of( &late_indirect_parameters_non_indexed_offset, @@ -919,7 +919,7 @@ impl Node for LateGpuPreprocessNode { // Transform and cull indexed meshes if there are any. if let Some(late_indexed_bind_group) = maybe_late_indexed_bind_group { - compute_pass.set_push_constants( + compute_pass.set_immediates( 0, bytemuck::bytes_of(late_indirect_parameters_indexed_offset), ); @@ -934,7 +934,7 @@ impl Node for LateGpuPreprocessNode { // Transform and cull non-indexed meshes if there are any. if let Some(late_non_indexed_bind_group) = maybe_late_non_indexed_bind_group { - compute_pass.set_push_constants( + compute_pass.set_immediates( 0, bytemuck::bytes_of(late_indirect_parameters_non_indexed_offset), ); @@ -1283,13 +1283,10 @@ impl SpecializedComputePipeline for PreprocessPipeline { .into(), ), layout: vec![self.bind_group_layout.clone()], - push_constant_ranges: if key.contains(PreprocessPipelineKey::OCCLUSION_CULLING) { - vec![PushConstantRange { - stages: ShaderStages::COMPUTE, - range: 0..4, - }] + immediate_size: if key.contains(PreprocessPipelineKey::OCCLUSION_CULLING) { + 4 } else { - vec![] + 0 }, shader: self.shader.clone(), shader_defs, diff --git a/crates/bevy_pbr/src/render/light.rs b/crates/bevy_pbr/src/render/light.rs index 9c95f0711493d..2819d03d41713 100644 --- a/crates/bevy_pbr/src/render/light.rs +++ b/crates/bevy_pbr/src/render/light.rs @@ -209,7 +209,7 @@ pub fn init_shadow_samplers(mut commands: Commands, render_device: Res late_preprocess_work_item_indirect_parameters: array; -var push_constants: PushConstants; +var immediates: Immediates; #endif // OCCLUSION_CULLING #ifdef FRUSTUM_CULLING @@ -164,7 +164,7 @@ fn main(@builtin(global_invocation_id) global_invocation_id: vec3) { #ifdef LATE_PHASE if (instance_index >= atomicLoad(&late_preprocess_work_item_indirect_parameters[ - push_constants.late_preprocess_work_item_indirect_offset].work_item_count)) { + immediates.late_preprocess_work_item_indirect_offset].work_item_count)) { return; } #else // LATE_PHASE @@ -305,14 +305,14 @@ fn main(@builtin(global_invocation_id) global_invocation_id: vec3) { // case in which a mesh that was invisible last frame became visible in // this frame. let output_work_item_index = atomicAdd(&late_preprocess_work_item_indirect_parameters[ - push_constants.late_preprocess_work_item_indirect_offset].work_item_count, 1u); + immediates.late_preprocess_work_item_indirect_offset].work_item_count, 1u); if (output_work_item_index % 64u == 0u) { // Our workgroup size is 64, and the indirect parameters for the // late mesh preprocessing phase are counted in workgroups, so if // we're the first thread in this workgroup, bump the workgroup // count. atomicAdd(&late_preprocess_work_item_indirect_parameters[ - push_constants.late_preprocess_work_item_indirect_offset].dispatch_x, 1u); + immediates.late_preprocess_work_item_indirect_offset].dispatch_x, 1u); } // Enqueue a work item for the late prepass phase. diff --git a/crates/bevy_pbr/src/render/wireframe.wgsl b/crates/bevy_pbr/src/render/wireframe.wgsl index 3873ffa3dd909..5e155391fbbcc 100644 --- a/crates/bevy_pbr/src/render/wireframe.wgsl +++ b/crates/bevy_pbr/src/render/wireframe.wgsl @@ -4,7 +4,7 @@ struct PushConstants { color: vec4 } -var push_constants: PushConstants; +var push_constants: PushConstants; @fragment fn fragment(in: VertexOutput) -> @location(0) vec4 { diff --git a/crates/bevy_pbr/src/ssao/mod.rs b/crates/bevy_pbr/src/ssao/mod.rs index 81aa5aa4aed65..59f4a1255b920 100644 --- a/crates/bevy_pbr/src/ssao/mod.rs +++ b/crates/bevy_pbr/src/ssao/mod.rs @@ -334,7 +334,7 @@ impl FromWorld for SsaoPipelines { let point_clamp_sampler = render_device.create_sampler(&SamplerDescriptor { min_filter: FilterMode::Nearest, mag_filter: FilterMode::Nearest, - mipmap_filter: FilterMode::Nearest, + mipmap_filter: MipmapFilterMode::Nearest, address_mode_u: AddressMode::ClampToEdge, address_mode_v: AddressMode::ClampToEdge, ..Default::default() @@ -342,7 +342,7 @@ impl FromWorld for SsaoPipelines { let linear_clamp_sampler = render_device.create_sampler(&SamplerDescriptor { min_filter: FilterMode::Linear, mag_filter: FilterMode::Linear, - mipmap_filter: FilterMode::Nearest, + mipmap_filter: MipmapFilterMode::Nearest, address_mode_u: AddressMode::ClampToEdge, address_mode_v: AddressMode::ClampToEdge, ..Default::default() diff --git a/crates/bevy_pbr/src/ssr/mod.rs b/crates/bevy_pbr/src/ssr/mod.rs index 7bd9d02c529de..dcc1b6ddd2e8b 100644 --- a/crates/bevy_pbr/src/ssr/mod.rs +++ b/crates/bevy_pbr/src/ssr/mod.rs @@ -316,6 +316,7 @@ impl ViewNode for ScreenSpaceReflectionsNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); let pass_span = diagnostics.pass_span(&mut render_pass, "ssr"); diff --git a/crates/bevy_pbr/src/volumetric_fog/render.rs b/crates/bevy_pbr/src/volumetric_fog/render.rs index e0ddc3ccefe74..7832d06be14e0 100644 --- a/crates/bevy_pbr/src/volumetric_fog/render.rs +++ b/crates/bevy_pbr/src/volumetric_fog/render.rs @@ -449,6 +449,7 @@ impl ViewNode for VolumetricFogNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }; let mut render_pass = render_context diff --git a/crates/bevy_pbr/src/wireframe.rs b/crates/bevy_pbr/src/wireframe.rs index c4b19df63f09f..5bb66de1ec43e 100644 --- a/crates/bevy_pbr/src/wireframe.rs +++ b/crates/bevy_pbr/src/wireframe.rs @@ -115,7 +115,7 @@ impl Plugin for WireframePlugin { return; }; - let required_features = WgpuFeatures::POLYGON_MODE_LINE | WgpuFeatures::PUSH_CONSTANTS; + let required_features = WgpuFeatures::POLYGON_MODE_LINE | WgpuFeatures::IMMEDIATES; let render_device = render_app.world().resource::(); if !render_device.features().contains(required_features) { warn!( @@ -285,9 +285,9 @@ pub struct Wireframe3dBinKey { pub asset_id: UntypedAssetId, } -pub struct SetWireframe3dPushConstants; +pub struct SetWireframe3dImmediates; -impl RenderCommand

for SetWireframe3dPushConstants { +impl RenderCommand

for SetWireframe3dImmediates { type Param = ( SRes, SRes>, @@ -310,11 +310,7 @@ impl RenderCommand

for SetWireframe3dPushConstants { return RenderCommandResult::Failure("No wireframe material found for entity"); }; - pass.set_push_constants( - ShaderStages::FRAGMENT, - 0, - bytemuck::bytes_of(&wireframe_material.color), - ); + pass.set_immediates(0, bytemuck::bytes_of(&wireframe_material.color)); RenderCommandResult::Success } } @@ -324,7 +320,7 @@ pub type DrawWireframe3d = ( SetMeshViewBindGroup<0>, SetMeshViewBindingArrayBindGroup<1>, SetMeshBindGroup<2>, - SetWireframe3dPushConstants, + SetWireframe3dImmediates, DrawMesh, ); @@ -355,10 +351,7 @@ impl SpecializedMeshPipeline for Wireframe3dPipeline { ) -> Result { let mut descriptor = self.mesh_pipeline.specialize(key, layout)?; descriptor.label = Some("wireframe_3d_pipeline".into()); - descriptor.push_constant_ranges.push(PushConstantRange { - stages: ShaderStages::FRAGMENT, - range: 0..16, - }); + descriptor.immediate_size = 16; let fragment = descriptor.fragment.as_mut().unwrap(); fragment.shader = self.shader.clone(); descriptor.primitive.polygon_mode = PolygonMode::Line; @@ -401,6 +394,7 @@ impl ViewNode for Wireframe3dNode { depth_stencil_attachment: Some(depth.get_attachment(StoreOp::Store)), timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); let pass_span = diagnostics.pass_span(&mut render_pass, "wireframe_3d"); diff --git a/crates/bevy_post_process/src/bloom/mod.rs b/crates/bevy_post_process/src/bloom/mod.rs index 07eb83571e187..cd68f9d5d8b9a 100644 --- a/crates/bevy_post_process/src/bloom/mod.rs +++ b/crates/bevy_post_process/src/bloom/mod.rs @@ -200,6 +200,7 @@ impl ViewNode for BloomNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); downsampling_first_pass.set_pipeline(downsampling_first_pipeline); downsampling_first_pass.set_bind_group( @@ -225,6 +226,7 @@ impl ViewNode for BloomNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); downsampling_pass.set_pipeline(downsampling_pipeline); downsampling_pass.set_bind_group( @@ -253,6 +255,7 @@ impl ViewNode for BloomNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); upsampling_pass.set_pipeline(upsampling_pipeline); upsampling_pass.set_bind_group( @@ -281,6 +284,7 @@ impl ViewNode for BloomNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); upsampling_final_pass.set_pipeline(upsampling_final_pipeline); upsampling_final_pass.set_bind_group( diff --git a/crates/bevy_post_process/src/effect_stack/mod.rs b/crates/bevy_post_process/src/effect_stack/mod.rs index 444377781b83d..11e3797678be0 100644 --- a/crates/bevy_post_process/src/effect_stack/mod.rs +++ b/crates/bevy_post_process/src/effect_stack/mod.rs @@ -31,9 +31,9 @@ use bevy_render::{ binding_types::{sampler, texture_2d, uniform_buffer}, BindGroupEntries, BindGroupLayoutDescriptor, BindGroupLayoutEntries, CachedRenderPipelineId, ColorTargetState, ColorWrites, DynamicUniformBuffer, Extent3d, - FilterMode, FragmentState, Operations, PipelineCache, RenderPassColorAttachment, - RenderPassDescriptor, RenderPipelineDescriptor, Sampler, SamplerBindingType, - SamplerDescriptor, ShaderStages, ShaderType, SpecializedRenderPipeline, + FilterMode, FragmentState, MipmapFilterMode, Operations, PipelineCache, + RenderPassColorAttachment, RenderPassDescriptor, RenderPipelineDescriptor, Sampler, + SamplerBindingType, SamplerDescriptor, ShaderStages, ShaderType, SpecializedRenderPipeline, SpecializedRenderPipelines, TextureDimension, TextureFormat, TextureSampleType, }, renderer::{RenderContext, RenderDevice, RenderQueue}, @@ -286,14 +286,14 @@ pub fn init_post_processing_pipeline( // bilinearly. let source_sampler = render_device.create_sampler(&SamplerDescriptor { - mipmap_filter: FilterMode::Linear, + mipmap_filter: MipmapFilterMode::Linear, min_filter: FilterMode::Linear, mag_filter: FilterMode::Linear, ..default() }); let chromatic_aberration_lut_sampler = render_device.create_sampler(&SamplerDescriptor { - mipmap_filter: FilterMode::Linear, + mipmap_filter: MipmapFilterMode::Linear, min_filter: FilterMode::Linear, mag_filter: FilterMode::Linear, ..default() @@ -391,6 +391,7 @@ impl ViewNode for PostProcessingNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }; let bind_group = render_context.render_device().create_bind_group( diff --git a/crates/bevy_post_process/src/motion_blur/node.rs b/crates/bevy_post_process/src/motion_blur/node.rs index 179cb01e00ff3..7bd16ed6428f4 100644 --- a/crates/bevy_post_process/src/motion_blur/node.rs +++ b/crates/bevy_post_process/src/motion_blur/node.rs @@ -94,6 +94,7 @@ impl ViewNode for MotionBlurNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); let pass_span = diagnostics.pass_span(&mut render_pass, "motion_blur"); diff --git a/crates/bevy_post_process/src/msaa_writeback.rs b/crates/bevy_post_process/src/msaa_writeback.rs index 0a35088f7f0f4..23ba7050116c6 100644 --- a/crates/bevy_post_process/src/msaa_writeback.rs +++ b/crates/bevy_post_process/src/msaa_writeback.rs @@ -102,6 +102,7 @@ impl ViewNode for MsaaWritebackNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }; let bind_group = blit_pipeline.create_bind_group( diff --git a/crates/bevy_reflect/Cargo.toml b/crates/bevy_reflect/Cargo.toml index 2b1fa213f58c5..5dd73ca764a30 100644 --- a/crates/bevy_reflect/Cargo.toml +++ b/crates/bevy_reflect/Cargo.toml @@ -129,7 +129,7 @@ uuid = { version = "1.13.1", default-features = false, optional = true, features "serde", ] } variadics_please = "1.1" -wgpu-types = { version = "27", features = [ +wgpu-types = { version = "28", features = [ "serde", ], optional = true, default-features = false } diff --git a/crates/bevy_render/Cargo.toml b/crates/bevy_render/Cargo.toml index 278ae95b8fef7..fb532d74e75e1 100644 --- a/crates/bevy_render/Cargo.toml +++ b/crates/bevy_render/Cargo.toml @@ -85,7 +85,7 @@ image = { version = "0.25.2", default-features = false } # 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 = "27", default-features = false, features = [ +wgpu = { version = "28", default-features = false, features = [ "wgsl", "dx12", "metal", @@ -93,7 +93,7 @@ wgpu = { version = "27", default-features = false, features = [ "naga-ir", "fragile-send-sync-non-atomic-wasm", ] } -naga = { version = "27", features = ["wgsl-in"] } +naga = { version = "28", features = ["wgsl-in"] } bytemuck = { version = "1.5", features = ["derive", "must_cast"] } downcast-rs = { version = "2", default-features = false, features = ["std"] } thiserror = { version = "2", default-features = false } diff --git a/crates/bevy_render/src/batching/gpu_preprocessing.rs b/crates/bevy_render/src/batching/gpu_preprocessing.rs index 71ba6a82872d8..e9b56fcef3ba7 100644 --- a/crates/bevy_render/src/batching/gpu_preprocessing.rs +++ b/crates/bevy_render/src/batching/gpu_preprocessing.rs @@ -1112,7 +1112,7 @@ impl FromWorld for GpuPreprocessingSupport { let culling_feature_support = device .features() - .contains(Features::INDIRECT_FIRST_INSTANCE | Features::PUSH_CONSTANTS); + .contains(Features::INDIRECT_FIRST_INSTANCE | Features::IMMEDIATES); // Depth downsampling for occlusion culling requires 12 textures let limit_support = device.limits().max_storage_textures_per_shader_stage >= 12 && // Even if the adapter supports compute, we might be simulating a lack of diff --git a/crates/bevy_render/src/render_graph/camera_driver_node.rs b/crates/bevy_render/src/render_graph/camera_driver_node.rs index 4ba4e93d33f0c..530461784f640 100644 --- a/crates/bevy_render/src/render_graph/camera_driver_node.rs +++ b/crates/bevy_render/src/render_graph/camera_driver_node.rs @@ -95,6 +95,7 @@ impl Node for CameraDriverNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }; render_context diff --git a/crates/bevy_render/src/render_phase/draw_state.rs b/crates/bevy_render/src/render_phase/draw_state.rs index 167d493c8956c..74ea65c579f02 100644 --- a/crates/bevy_render/src/render_phase/draw_state.rs +++ b/crates/bevy_render/src/render_phase/draw_state.rs @@ -2,7 +2,6 @@ use crate::{ diagnostic::internal::{Pass, PassKind, WritePipelineStatistics, WriteTimestamp}, render_resource::{ BindGroup, BindGroupId, Buffer, BufferId, BufferSlice, RenderPipeline, RenderPipelineId, - ShaderStages, }, renderer::RenderDevice, }; @@ -533,18 +532,13 @@ impl<'a> TrackedRenderPass<'a> { self.pass.set_scissor_rect(x, y, width, height); } - /// Set push constant data. + /// Set immediates data. /// - /// `Features::PUSH_CONSTANTS` must be enabled on the device in order to call these functions. - pub fn set_push_constants(&mut self, stages: ShaderStages, offset: u32, data: &[u8]) { + /// `Features::IMMEDIATES` must be enabled on the device in order to call these functions. + pub fn set_immediates(&mut self, offset: u32, data: &[u8]) { #[cfg(feature = "detailed_trace")] - trace!( - "set push constants: {:?} offset: {} data.len: {}", - stages, - offset, - data.len() - ); - self.pass.set_push_constants(stages, offset, data); + trace!("set immediates offset: {} data.len: {}", offset, data.len()); + self.pass.set_immediates(offset, data); } /// Set the rendering viewport. diff --git a/crates/bevy_render/src/render_resource/mod.rs b/crates/bevy_render/src/render_resource/mod.rs index 70a2d160a1c56..003d7b5b92ba2 100644 --- a/crates/bevy_render/src/render_resource/mod.rs +++ b/crates/bevy_render/src/render_resource/mod.rs @@ -48,9 +48,9 @@ pub use wgpu::{ ComputePipelineDescriptor as RawComputePipelineDescriptor, CreateBlasDescriptor, CreateTlasDescriptor, DepthBiasState, DepthStencilState, DownlevelFlags, Extent3d, Face, Features as WgpuFeatures, FilterMode, FragmentState as RawFragmentState, FrontFace, - ImageSubresourceRange, IndexFormat, Limits as WgpuLimits, LoadOp, MapMode, MultisampleState, - Operations, Origin3d, PipelineCompilationOptions, PipelineLayout, PipelineLayoutDescriptor, - PollType, PolygonMode, PrimitiveState, PrimitiveTopology, PushConstantRange, + ImageSubresourceRange, IndexFormat, Limits as WgpuLimits, LoadOp, MapMode, MipmapFilterMode, + MultisampleState, Operations, Origin3d, PipelineCompilationOptions, PipelineLayout, + PipelineLayoutDescriptor, PollType, PolygonMode, PrimitiveState, PrimitiveTopology, RenderPassColorAttachment, RenderPassDepthStencilAttachment, RenderPassDescriptor, RenderPipelineDescriptor as RawRenderPipelineDescriptor, Sampler as WgpuSampler, SamplerBindingType, SamplerDescriptor, ShaderModule, ShaderModuleDescriptor, ShaderSource, diff --git a/crates/bevy_render/src/render_resource/pipeline.rs b/crates/bevy_render/src/render_resource/pipeline.rs index 93a7e596d8354..0083bbe911054 100644 --- a/crates/bevy_render/src/render_resource/pipeline.rs +++ b/crates/bevy_render/src/render_resource/pipeline.rs @@ -9,7 +9,6 @@ use core::ops::Deref; use thiserror::Error; use wgpu::{ BindGroupLayoutEntry, ColorTargetState, DepthStencilState, MultisampleState, PrimitiveState, - PushConstantRange, }; define_atomic_id!(RenderPipelineId); @@ -110,9 +109,9 @@ pub struct RenderPipelineDescriptor { pub label: Option>, /// The layout of bind groups for this pipeline. pub layout: Vec, - /// The push constant ranges for this pipeline. - /// Supply an empty vector if the pipeline doesn't use push constants. - pub push_constant_ranges: Vec, + /// The immediate size for this pipeline. + /// Supply 0 if the pipeline doesn't use immediates. + pub immediate_size: u32, /// The compiled vertex stage, its entry point, and the input buffers layout. pub vertex: VertexState, /// The properties of the pipeline at the primitive assembly and rasterization level. @@ -178,7 +177,7 @@ impl FragmentState { pub struct ComputePipelineDescriptor { pub label: Option>, pub layout: Vec, - pub push_constant_ranges: Vec, + pub immediate_size: u32, /// The compiled shader module for this stage. pub shader: Handle, pub shader_defs: Vec, diff --git a/crates/bevy_render/src/render_resource/pipeline_cache.rs b/crates/bevy_render/src/render_resource/pipeline_cache.rs index 76ff5eaafc322..5980ec586f9d7 100644 --- a/crates/bevy_render/src/render_resource/pipeline_cache.rs +++ b/crates/bevy_render/src/render_resource/pipeline_cache.rs @@ -118,7 +118,8 @@ impl CachedPipelineState { } } -type LayoutCacheKey = (Vec, Vec); +type ImmediateSize = u32; +type LayoutCacheKey = (Vec, ImmediateSize); #[derive(Default)] struct LayoutCache { layouts: HashMap>>, @@ -129,12 +130,12 @@ impl LayoutCache { &mut self, render_device: &RenderDevice, bind_group_layouts: &[BindGroupLayout], - push_constant_ranges: Vec, + immediate_size: u32, ) -> Arc> { let bind_group_ids = bind_group_layouts.iter().map(BindGroupLayout::id).collect(); self.layouts - .entry((bind_group_ids, push_constant_ranges)) - .or_insert_with_key(|(_, push_constant_ranges)| { + .entry((bind_group_ids, immediate_size)) + .or_insert_with_key(|(_, immediate_size)| { let bind_group_layouts = bind_group_layouts .iter() .map(BindGroupLayout::value) @@ -142,7 +143,7 @@ impl LayoutCache { Arc::new(WgpuWrapper::new(render_device.create_pipeline_layout( &PipelineLayoutDescriptor { bind_group_layouts: &bind_group_layouts, - push_constant_ranges, + immediate_size: *immediate_size, ..default() }, ))) @@ -176,7 +177,7 @@ fn load_module( source: shader_source, }; - render_device + let scope = render_device .wgpu_device() .push_error_scope(wgpu::ErrorFilter::Validation); @@ -192,7 +193,7 @@ fn load_module( }, }); - let error = render_device.wgpu_device().pop_error_scope(); + let error = scope.pop(); // `now_or_never` will return Some if the future is ready and None otherwise. // On native platforms, wgpu will yield the error immediately while on wasm it may take longer since the browser APIs are asynchronous. @@ -547,16 +548,11 @@ impl PipelineCache { None => None, }; - let layout = - if descriptor.layout.is_empty() && descriptor.push_constant_ranges.is_empty() { - None - } else { - Some(layout_cache.get( - &device, - &bind_group_layout, - descriptor.push_constant_ranges.to_vec(), - )) - }; + let layout = if descriptor.layout.is_empty() && descriptor.immediate_size == 0 { + None + } else { + Some(layout_cache.get(&device, &bind_group_layout, descriptor.immediate_size)) + }; drop((shader_cache, layout_cache)); @@ -586,7 +582,7 @@ impl PipelineCache { }; let descriptor = RawRenderPipelineDescriptor { - multiview: None, + multiview_mask: None, depth_stencil: descriptor.depth_stencil.clone(), label: descriptor.label.as_deref(), layout: layout.as_ref().map(|layout| -> &PipelineLayout { layout }), @@ -651,16 +647,11 @@ impl PipelineCache { Err(err) => return Err(err), }; - let layout = - if descriptor.layout.is_empty() && descriptor.push_constant_ranges.is_empty() { - None - } else { - Some(layout_cache.get( - &device, - &bind_group_layout, - descriptor.push_constant_ranges.to_vec(), - )) - }; + let layout = if descriptor.layout.is_empty() && descriptor.immediate_size == 0 { + None + } else { + Some(layout_cache.get(&device, &bind_group_layout, descriptor.immediate_size)) + }; drop((shader_cache, layout_cache)); diff --git a/crates/bevy_render/src/renderer/mod.rs b/crates/bevy_render/src/renderer/mod.rs index e5ab90f87b190..a752d8aeb0608 100644 --- a/crates/bevy_render/src/renderer/mod.rs +++ b/crates/bevy_render/src/renderer/mod.rs @@ -148,16 +148,17 @@ const GPU_NOT_FOUND_ERROR_MESSAGE: &str = if cfg!(target_os = "linux") { }; #[cfg(not(target_family = "wasm"))] -fn find_adapter_by_name( +async fn find_adapter_by_name( instance: &Instance, options: &WgpuSettings, compatible_surface: Option<&wgpu::Surface<'_>>, adapter_name: &str, ) -> Option { - for adapter in - instance.enumerate_adapters(options.backends.expect( + for adapter in instance + .enumerate_adapters(options.backends.expect( "The `backends` field of `WgpuSettings` must be set to use a specific adapter.", )) + .await { tracing::trace!("Checking adapter: {:?}", adapter.get_info()); let info = adapter.get_info(); @@ -251,14 +252,17 @@ pub async fn initialize_renderer( }; #[cfg(not(target_family = "wasm"))] - let mut selected_adapter = desired_adapter_name.and_then(|adapter_name| { + let mut selected_adapter = if let Some(adapter_name) = desired_adapter_name { find_adapter_by_name( &instance, options, request_adapter_options.compatible_surface, &adapter_name, ) - }); + .await + } else { + None + }; #[cfg(target_family = "wasm")] let mut selected_adapter = None; @@ -377,9 +381,9 @@ pub async fn initialize_renderer( max_vertex_buffer_array_stride: limits .max_vertex_buffer_array_stride .min(constrained_limits.max_vertex_buffer_array_stride), - max_push_constant_size: limits - .max_push_constant_size - .min(constrained_limits.max_push_constant_size), + max_immediate_size: limits + .max_immediate_size + .min(constrained_limits.max_immediate_size), min_uniform_buffer_offset_alignment: limits .min_uniform_buffer_offset_alignment .max(constrained_limits.min_uniform_buffer_offset_alignment), @@ -431,27 +435,45 @@ pub async fn initialize_renderer( max_color_attachment_bytes_per_sample: limits .max_color_attachment_bytes_per_sample .min(constrained_limits.max_color_attachment_bytes_per_sample), - min_subgroup_size: limits - .min_subgroup_size - .max(constrained_limits.min_subgroup_size), - max_subgroup_size: limits - .max_subgroup_size - .min(constrained_limits.max_subgroup_size), - max_acceleration_structures_per_shader_stage: limits - .max_acceleration_structures_per_shader_stage - .min(constrained_limits.max_acceleration_structures_per_shader_stage), - max_task_workgroup_total_count: limits - .max_task_workgroup_total_count - .min(constrained_limits.max_task_workgroup_total_count), - max_task_workgroups_per_dimension: limits - .max_task_workgroups_per_dimension - .min(constrained_limits.max_task_workgroups_per_dimension), + max_task_mesh_workgroup_total_count: limits + .max_task_mesh_workgroup_total_count + .min(constrained_limits.max_task_mesh_workgroup_total_count), + max_task_mesh_workgroups_per_dimension: limits + .max_task_mesh_workgroups_per_dimension + .min(constrained_limits.max_task_mesh_workgroups_per_dimension), + max_task_invocations_per_workgroup: limits + .max_task_invocations_per_workgroup + .min(constrained_limits.max_task_invocations_per_workgroup), + max_task_invocations_per_dimension: limits + .max_task_invocations_per_dimension + .min(constrained_limits.max_task_invocations_per_dimension), + max_mesh_invocations_per_workgroup: limits + .max_mesh_invocations_per_workgroup + .min(constrained_limits.max_mesh_invocations_per_workgroup), + max_mesh_invocations_per_dimension: limits + .max_mesh_invocations_per_dimension + .min(constrained_limits.max_mesh_invocations_per_dimension), + max_task_payload_size: limits + .max_task_payload_size + .min(constrained_limits.max_task_payload_size), + max_mesh_output_vertices: limits + .max_mesh_output_vertices + .min(constrained_limits.max_mesh_output_vertices), + max_mesh_output_primitives: limits + .max_mesh_output_primitives + .min(constrained_limits.max_mesh_output_primitives), max_mesh_output_layers: limits .max_mesh_output_layers .min(constrained_limits.max_mesh_output_layers), - max_mesh_multiview_count: limits - .max_mesh_multiview_count - .min(constrained_limits.max_mesh_multiview_count), + max_mesh_multiview_view_count: limits + .max_mesh_multiview_view_count + .min(constrained_limits.max_mesh_multiview_view_count), + max_acceleration_structures_per_shader_stage: limits + .max_acceleration_structures_per_shader_stage + .min(constrained_limits.max_acceleration_structures_per_shader_stage), + max_multiview_view_count: limits + .max_multiview_view_count + .min(constrained_limits.max_multiview_view_count), }; } diff --git a/crates/bevy_render/src/renderer/raw_vulkan_init.rs b/crates/bevy_render/src/renderer/raw_vulkan_init.rs index 973056956cb09..5c28118519396 100644 --- a/crates/bevy_render/src/renderer/raw_vulkan_init.rs +++ b/crates/bevy_render/src/renderer/raw_vulkan_init.rs @@ -82,6 +82,7 @@ pub(crate) fn create_raw_vulkan_instance( flags: instance_descriptor.flags, memory_budget_thresholds: instance_descriptor.memory_budget_thresholds, backend_options: instance_descriptor.backend_options.clone(), + telemetry: None, }, Some(Box::new(|mut args| { for callback in &settings.create_instance_callbacks { diff --git a/crates/bevy_render/src/view/window/mod.rs b/crates/bevy_render/src/view/window/mod.rs index 01287972c9a31..c22cfd5600db0 100644 --- a/crates/bevy_render/src/view/window/mod.rs +++ b/crates/bevy_render/src/view/window/mod.rs @@ -264,15 +264,20 @@ pub fn prepare_windows( // and https://github.com/gfx-rs/wgpu/issues/1218 #[cfg(target_os = "linux")] let may_erroneously_timeout = || { - render_instance - .enumerate_adapters(wgpu::Backends::VULKAN) - .iter() - .any(|adapter| { - let name = adapter.get_info().name; - name.starts_with("Radeon") - || name.starts_with("AMD") - || name.starts_with("Intel") - }) + bevy_tasks::IoTaskPool::get().scope(|scope| { + scope.spawn(async { + render_instance + .enumerate_adapters(wgpu::Backends::VULKAN) + .await + .iter() + .any(|adapter| { + let name = adapter.get_info().name; + name.starts_with("Radeon") + || name.starts_with("AMD") + || name.starts_with("Intel") + }) + }); + })[0] }; let surface = &surface_data.surface; diff --git a/crates/bevy_render/src/view/window/screenshot.rs b/crates/bevy_render/src/view/window/screenshot.rs index 655b9b30bbe4e..ebaddc60a566b 100644 --- a/crates/bevy_render/src/view/window/screenshot.rs +++ b/crates/bevy_render/src/view/window/screenshot.rs @@ -613,6 +613,7 @@ fn render_screenshot( depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); pass.set_pipeline(pipeline); pass.set_bind_group(0, &prepared_state.bind_group, &[]); diff --git a/crates/bevy_shader/Cargo.toml b/crates/bevy_shader/Cargo.toml index 00efb62e67bd9..080b6105a206b 100644 --- a/crates/bevy_shader/Cargo.toml +++ b/crates/bevy_shader/Cargo.toml @@ -16,8 +16,8 @@ bevy_platform = { path = "../bevy_platform", version = "0.18.0-dev" } bevy_utils = { path = "../bevy_utils", version = "0.18.0-dev" } # other -wgpu-types = { version = "27", default-features = false } -naga = { version = "27", features = ["wgsl-in"] } +wgpu-types = { version = "28", default-features = false } +naga = { version = "28", features = ["wgsl-in"] } serde = { version = "1", features = ["derive"] } thiserror = { version = "2", default-features = false } wesl = { version = "0.3.1", optional = true } @@ -26,12 +26,16 @@ tracing = { version = "0.1", default-features = false, features = ["std"] } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] # Omit the `glsl` feature in non-WebAssembly by default. -naga_oil = { version = "0.20", default-features = false, features = [ +# naga_oil = { version = "0.20", default-features = false, features = [ +# "test_shader", +# ] } +naga_oil = { git = "https://github.com/ChristopherBiscardi/naga_oil.git", branch = "naga-28", default-features = false, features = [ "test_shader", ] } [target.'cfg(target_arch = "wasm32")'.dependencies] -naga_oil = { version = "0.20" } +# naga_oil = { version = "0.20" } +naga_oil = { git = "https://github.com/ChristopherBiscardi/naga_oil.git", branch = "naga-28" } [features] shader_format_glsl = ["naga/glsl-in", "naga/wgsl-out", "naga_oil/glsl"] diff --git a/crates/bevy_shader/src/shader_cache.rs b/crates/bevy_shader/src/shader_cache.rs index 141c64fdfbc4d..c7d1d63d5b6e4 100644 --- a/crates/bevy_shader/src/shader_cache.rs +++ b/crates/bevy_shader/src/shader_cache.rs @@ -446,32 +446,57 @@ pub enum PipelineCacheError { fn get_capabilities(features: Features, downlevel: DownlevelFlags) -> Capabilities { let mut capabilities = Capabilities::empty(); capabilities.set( - Capabilities::PUSH_CONSTANT, - features.contains(Features::PUSH_CONSTANTS), + Capabilities::IMMEDIATES, + features.contains(Features::IMMEDIATES), ); capabilities.set( Capabilities::FLOAT64, features.contains(Features::SHADER_F64), ); + capabilities.set( + Capabilities::SHADER_FLOAT16, + features.contains(Features::SHADER_F16), + ); + capabilities.set( + Capabilities::SHADER_FLOAT16_IN_FLOAT32, + downlevel.contains(DownlevelFlags::SHADER_F16_IN_F32), + ); capabilities.set( Capabilities::PRIMITIVE_INDEX, features.contains(Features::SHADER_PRIMITIVE_INDEX), ); capabilities.set( - Capabilities::SAMPLED_TEXTURE_AND_STORAGE_BUFFER_ARRAY_NON_UNIFORM_INDEXING, - features.contains(Features::SAMPLED_TEXTURE_AND_STORAGE_BUFFER_ARRAY_NON_UNIFORM_INDEXING), + Capabilities::TEXTURE_AND_SAMPLER_BINDING_ARRAY, + features.contains(Features::TEXTURE_BINDING_ARRAY), ); capabilities.set( - Capabilities::STORAGE_TEXTURE_ARRAY_NON_UNIFORM_INDEXING, - features.contains(Features::STORAGE_TEXTURE_ARRAY_NON_UNIFORM_INDEXING), + Capabilities::BUFFER_BINDING_ARRAY, + features.contains(Features::BUFFER_BINDING_ARRAY), + ); + capabilities.set( + Capabilities::STORAGE_TEXTURE_BINDING_ARRAY, + features.contains(Features::TEXTURE_BINDING_ARRAY) + && features.contains(Features::STORAGE_RESOURCE_BINDING_ARRAY), + ); + capabilities.set( + Capabilities::STORAGE_BUFFER_BINDING_ARRAY, + features.contains(Features::BUFFER_BINDING_ARRAY) + && features.contains(Features::STORAGE_RESOURCE_BINDING_ARRAY), ); capabilities.set( - Capabilities::UNIFORM_BUFFER_ARRAY_NON_UNIFORM_INDEXING, + Capabilities::TEXTURE_AND_SAMPLER_BINDING_ARRAY_NON_UNIFORM_INDEXING, + features.contains(Features::SAMPLED_TEXTURE_AND_STORAGE_BUFFER_ARRAY_NON_UNIFORM_INDEXING), + ); + capabilities.set( + Capabilities::BUFFER_BINDING_ARRAY_NON_UNIFORM_INDEXING, features.contains(Features::UNIFORM_BUFFER_BINDING_ARRAYS), ); - // TODO: This needs a proper wgpu feature capabilities.set( - Capabilities::SAMPLER_NON_UNIFORM_INDEXING, + Capabilities::STORAGE_TEXTURE_BINDING_ARRAY_NON_UNIFORM_INDEXING, + features.contains(Features::STORAGE_TEXTURE_ARRAY_NON_UNIFORM_INDEXING), + ); + capabilities.set( + Capabilities::STORAGE_BUFFER_BINDING_ARRAY_NON_UNIFORM_INDEXING, features.contains(Features::SAMPLED_TEXTURE_AND_STORAGE_BUFFER_ARRAY_NON_UNIFORM_INDEXING), ); capabilities.set( @@ -501,12 +526,20 @@ fn get_capabilities(features: Features, downlevel: DownlevelFlags) -> Capabiliti features.contains(Features::SHADER_INT64_ATOMIC_ALL_OPS), ); capabilities.set( - Capabilities::MULTISAMPLED_SHADING, - downlevel.contains(DownlevelFlags::MULTISAMPLED_SHADING), + Capabilities::TEXTURE_ATOMIC, + features.contains(Features::TEXTURE_ATOMIC), ); capabilities.set( - Capabilities::RAY_QUERY, - features.contains(Features::EXPERIMENTAL_RAY_QUERY), + Capabilities::TEXTURE_INT64_ATOMIC, + features.contains(Features::TEXTURE_INT64_ATOMIC), + ); + capabilities.set( + Capabilities::SHADER_FLOAT32_ATOMIC, + features.contains(Features::SHADER_FLOAT32_ATOMIC), + ); + capabilities.set( + Capabilities::MULTISAMPLED_SHADING, + downlevel.contains(DownlevelFlags::MULTISAMPLED_SHADING), ); capabilities.set( Capabilities::DUAL_SOURCE_BLENDING, @@ -528,29 +561,33 @@ fn get_capabilities(features: Features, downlevel: DownlevelFlags) -> Capabiliti Capabilities::SUBGROUP_BARRIER, features.intersects(Features::SUBGROUP_BARRIER), ); + capabilities.set( + Capabilities::RAY_QUERY, + features.intersects(Features::EXPERIMENTAL_RAY_QUERY), + ); capabilities.set( Capabilities::SUBGROUP_VERTEX_STAGE, features.contains(Features::SUBGROUP_VERTEX), ); capabilities.set( - Capabilities::SHADER_FLOAT32_ATOMIC, - features.contains(Features::SHADER_FLOAT32_ATOMIC), + Capabilities::RAY_HIT_VERTEX_POSITION, + features.intersects(Features::EXPERIMENTAL_RAY_HIT_VERTEX_RETURN), ); capabilities.set( - Capabilities::TEXTURE_ATOMIC, - features.contains(Features::TEXTURE_ATOMIC), + Capabilities::TEXTURE_EXTERNAL, + features.intersects(Features::EXTERNAL_TEXTURE), ); capabilities.set( - Capabilities::TEXTURE_INT64_ATOMIC, - features.contains(Features::TEXTURE_INT64_ATOMIC), + Capabilities::SHADER_BARYCENTRICS, + features.intersects(Features::SHADER_BARYCENTRICS), ); capabilities.set( - Capabilities::SHADER_FLOAT16, - features.contains(Features::SHADER_F16), + Capabilities::MESH_SHADER, + features.intersects(Features::EXPERIMENTAL_MESH_SHADER), ); capabilities.set( - Capabilities::RAY_HIT_VERTEX_POSITION, - features.intersects(Features::EXPERIMENTAL_RAY_HIT_VERTEX_RETURN), + Capabilities::MESH_SHADER_POINT_TOPOLOGY, + features.intersects(Features::EXPERIMENTAL_MESH_SHADER_POINTS), ); capabilities diff --git a/crates/bevy_solari/src/realtime/node.rs b/crates/bevy_solari/src/realtime/node.rs index 2900fa2e06c1f..5664612a7a8e0 100644 --- a/crates/bevy_solari/src/realtime/node.rs +++ b/crates/bevy_solari/src/realtime/node.rs @@ -23,8 +23,8 @@ use bevy_render::{ }, BindGroupEntries, BindGroupLayoutDescriptor, BindGroupLayoutEntries, CachedComputePipelineId, ComputePassDescriptor, ComputePipelineDescriptor, LoadOp, - PipelineCache, PushConstantRange, RenderPassDescriptor, ShaderStages, StorageTextureAccess, - TextureFormat, TextureSampleType, + PipelineCache, RenderPassDescriptor, ShaderStages, StorageTextureAccess, TextureFormat, + TextureSampleType, }, renderer::RenderContext, view::{ViewTarget, ViewUniform, ViewUniformOffset, ViewUniforms}, @@ -233,6 +233,7 @@ impl ViewNode for SolariLightingNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); } @@ -263,7 +264,7 @@ impl ViewNode for SolariLightingNode { let d = diagnostics.time_span(&mut pass, "solari_lighting/presample_light_tiles"); pass.set_pipeline(presample_light_tiles_pipeline); - pass.set_push_constants( + pass.set_immediates( 0, bytemuck::cast_slice(&[frame_index, solari_lighting.reset as u32]), ); @@ -289,7 +290,7 @@ impl ViewNode for SolariLightingNode { pass.set_bind_group(2, None, &[]); pass.set_pipeline(sample_for_world_cache_pipeline); - pass.set_push_constants( + pass.set_immediates( 0, bytemuck::cast_slice(&[frame_index, solari_lighting.reset as u32]), ); @@ -309,14 +310,14 @@ impl ViewNode for SolariLightingNode { let d = diagnostics.time_span(&mut pass, "solari_lighting/direct_lighting"); pass.set_pipeline(di_initial_and_temporal_pipeline); - pass.set_push_constants( + pass.set_immediates( 0, bytemuck::cast_slice(&[frame_index, solari_lighting.reset as u32]), ); pass.dispatch_workgroups(dx, dy, 1); pass.set_pipeline(di_spatial_and_shade_pipeline); - pass.set_push_constants( + pass.set_immediates( 0, bytemuck::cast_slice(&[frame_index, solari_lighting.reset as u32]), ); @@ -327,14 +328,14 @@ impl ViewNode for SolariLightingNode { let d = diagnostics.time_span(&mut pass, "solari_lighting/diffuse_indirect_lighting"); pass.set_pipeline(gi_initial_and_temporal_pipeline); - pass.set_push_constants( + pass.set_immediates( 0, bytemuck::cast_slice(&[frame_index, solari_lighting.reset as u32]), ); pass.dispatch_workgroups(dx, dy, 1); pass.set_pipeline(gi_spatial_and_shade_pipeline); - pass.set_push_constants( + pass.set_immediates( 0, bytemuck::cast_slice(&[frame_index, solari_lighting.reset as u32]), ); @@ -344,7 +345,7 @@ impl ViewNode for SolariLightingNode { let d = diagnostics.time_span(&mut pass, "solari_lighting/specular_indirect_lighting"); pass.set_pipeline(specular_gi_pipeline); - pass.set_push_constants( + pass.set_immediates( 0, bytemuck::cast_slice(&[frame_index, solari_lighting.reset as u32]), ); @@ -440,10 +441,7 @@ impl FromWorld for SolariLightingNode { pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor { label: Some(label.into()), layout, - push_constant_ranges: vec![PushConstantRange { - stages: ShaderStages::COMPUTE, - range: 0..8, - }], + immediate_size: 8, shader, shader_defs, entry_point: Some(entry_point.into()), diff --git a/crates/bevy_solari/src/realtime/realtime_bindings.wgsl b/crates/bevy_solari/src/realtime/realtime_bindings.wgsl index 9f407f786e0c8..116c919dfdce2 100644 --- a/crates/bevy_solari/src/realtime/realtime_bindings.wgsl +++ b/crates/bevy_solari/src/realtime/realtime_bindings.wgsl @@ -33,7 +33,7 @@ @group(1) @binding(22) var world_cache_active_cell_indices: array; @group(1) @binding(23) var world_cache_active_cells_count: u32; struct PushConstants { frame_index: u32, reset: u32 } -var constants: PushConstants; +var constants: PushConstants; // Don't adjust the size of this struct without also adjusting `prepare::RESOLVED_LIGHT_SAMPLE_STRUCT_SIZE`. struct ResolvedLightSamplePacked { diff --git a/crates/bevy_sprite/Cargo.toml b/crates/bevy_sprite/Cargo.toml index aba2c6f1c3159..7224b928f5a11 100644 --- a/crates/bevy_sprite/Cargo.toml +++ b/crates/bevy_sprite/Cargo.toml @@ -33,7 +33,7 @@ bevy_log = { path = "../bevy_log", version = "0.18.0-dev" } # other radsort = "0.1" tracing = { version = "0.1", default-features = false, features = ["std"] } -wgpu-types = { version = "27", default-features = false } +wgpu-types = { version = "28", default-features = false } [dev-dependencies] approx = "0.5.1" diff --git a/crates/bevy_sprite_render/src/mesh2d/wireframe2d.rs b/crates/bevy_sprite_render/src/mesh2d/wireframe2d.rs index 5f9a0a0e6e54d..5b3bfe028042c 100644 --- a/crates/bevy_sprite_render/src/mesh2d/wireframe2d.rs +++ b/crates/bevy_sprite_render/src/mesh2d/wireframe2d.rs @@ -274,9 +274,9 @@ pub struct Wireframe2dBinKey { pub asset_id: UntypedAssetId, } -pub struct SetWireframe2dPushConstants; +pub struct SetWireframe2dImmediates; -impl RenderCommand

for SetWireframe2dPushConstants { +impl RenderCommand

for SetWireframe2dImmediates { type Param = ( SRes, SRes>, @@ -299,11 +299,7 @@ impl RenderCommand

for SetWireframe2dPushConstants { return RenderCommandResult::Failure("No wireframe material found for entity"); }; - pass.set_push_constants( - ShaderStages::FRAGMENT, - 0, - bytemuck::bytes_of(&wireframe_material.color), - ); + pass.set_immediates(0, bytemuck::bytes_of(&wireframe_material.color)); RenderCommandResult::Success } } @@ -312,7 +308,7 @@ pub type DrawWireframe2d = ( SetItemPipeline, SetMesh2dViewBindGroup<0>, SetMesh2dBindGroup<1>, - SetWireframe2dPushConstants, + SetWireframe2dImmediates, DrawMesh2d, ); @@ -343,10 +339,7 @@ impl SpecializedMeshPipeline for Wireframe2dPipeline { ) -> Result { let mut descriptor = self.mesh_pipeline.specialize(key, layout)?; descriptor.label = Some("wireframe_2d_pipeline".into()); - descriptor.push_constant_ranges.push(PushConstantRange { - stages: ShaderStages::FRAGMENT, - range: 0..16, - }); + descriptor.immediate_size = 16; let fragment = descriptor.fragment.as_mut().unwrap(); fragment.shader = self.shader.clone(); descriptor.primitive.polygon_mode = PolygonMode::Line; @@ -390,6 +383,7 @@ impl ViewNode for Wireframe2dNode { depth_stencil_attachment: Some(depth.get_attachment(StoreOp::Store)), timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); let pass_span = diagnostics.pass_span(&mut render_pass, "wireframe_2d"); diff --git a/crates/bevy_sprite_render/src/mesh2d/wireframe2d.wgsl b/crates/bevy_sprite_render/src/mesh2d/wireframe2d.wgsl index c7bb3aa791b18..96ee3e7c9e7cd 100644 --- a/crates/bevy_sprite_render/src/mesh2d/wireframe2d.wgsl +++ b/crates/bevy_sprite_render/src/mesh2d/wireframe2d.wgsl @@ -4,7 +4,7 @@ struct PushConstants { color: vec4 } -var push_constants: PushConstants; +var push_constants: PushConstants; @fragment fn fragment(in: VertexOutput) -> @location(0) vec4 { diff --git a/crates/bevy_text/Cargo.toml b/crates/bevy_text/Cargo.toml index 07261b736cbf8..552addca12d41 100644 --- a/crates/bevy_text/Cargo.toml +++ b/crates/bevy_text/Cargo.toml @@ -29,7 +29,7 @@ bevy_platform = { path = "../bevy_platform", version = "0.18.0-dev", default-fea ] } # other -wgpu-types = { version = "27", default-features = false } +wgpu-types = { version = "28", default-features = false } cosmic-text = { version = "0.16", features = ["shape-run-cache"] } thiserror = { version = "2", default-features = false } serde = { version = "1", features = ["derive"] } diff --git a/crates/bevy_ui_render/src/render_pass.rs b/crates/bevy_ui_render/src/render_pass.rs index 642f69d9350e8..76381b7fcfd5c 100644 --- a/crates/bevy_ui_render/src/render_pass.rs +++ b/crates/bevy_ui_render/src/render_pass.rs @@ -97,6 +97,7 @@ impl Node for UiPassNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); let pass_span = diagnostics.pass_span(&mut render_pass, "ui"); diff --git a/crates/bevy_winit/Cargo.toml b/crates/bevy_winit/Cargo.toml index 6855cfce2314f..d153668a76913 100644 --- a/crates/bevy_winit/Cargo.toml +++ b/crates/bevy_winit/Cargo.toml @@ -57,7 +57,7 @@ bevy_asset = { path = "../bevy_asset", version = "0.18.0-dev", optional = true } ## used by custom_cursor bevy_image = { path = "../bevy_image", version = "0.18.0-dev", optional = true } ## used by custom_cursor -wgpu-types = { version = "27", optional = true } +wgpu-types = { version = "28", optional = true } ## used by custom_cursor bytemuck = { version = "1.5", optional = true } diff --git a/examples/shader_advanced/custom_post_processing.rs b/examples/shader_advanced/custom_post_processing.rs index f92b0a347c72a..bfc8e1d7d0f3c 100644 --- a/examples/shader_advanced/custom_post_processing.rs +++ b/examples/shader_advanced/custom_post_processing.rs @@ -204,6 +204,7 @@ impl ViewNode for PostProcessNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); // This is mostly just wgpu boilerplate for drawing a fullscreen triangle, diff --git a/examples/shader_advanced/custom_render_phase.rs b/examples/shader_advanced/custom_render_phase.rs index 8fd1cdc837539..ba0f3bac264ab 100644 --- a/examples/shader_advanced/custom_render_phase.rs +++ b/examples/shader_advanced/custom_render_phase.rs @@ -612,6 +612,7 @@ impl ViewNode for CustomDrawNode { depth_stencil_attachment: None, timestamp_writes: None, occlusion_query_set: None, + multiview_mask: None, }); if let Some(viewport) =