Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to wgpu 23 #15988

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion crates/bevy_color/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ derive_more = { version = "1", default-features = false, features = [
"from",
"display",
] }
wgpu-types = { version = "22", default-features = false, optional = true }
wgpu-types = { git = "https://github.com/gfx-rs/wgpu", branch = "trunk", default-features = false, optional = true }
tychedelia marked this conversation as resolved.
Show resolved Hide resolved
encase = { version = "0.10", default-features = false }

[features]
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_core_pipeline/src/auto_exposure/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl Node for AutoExposureNode {
timestamp_writes: None,
});

compute_pass.set_bind_group(0, &compute_bind_group, &[view_uniform_offset.offset]);
compute_pass.set_bind_group(0, Some(&compute_bind_group), &[view_uniform_offset.offset]);
compute_pass.set_pipeline(histogram_pipeline);
compute_pass.dispatch_workgroups(
view.viewport.z.div_ceil(16),
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_core_pipeline/src/bloom/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use upsampling_pipeline::{

const BLOOM_SHADER_HANDLE: Handle<Shader> = Handle::weak_from_u128(929599476923908);

const BLOOM_TEXTURE_FORMAT: TextureFormat = TextureFormat::Rg11b10Float;
const BLOOM_TEXTURE_FORMAT: TextureFormat = TextureFormat::Rg11b10Ufloat;

pub struct BloomPlugin;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl Node for CasNode {
.begin_render_pass(&pass_descriptor);

render_pass.set_pipeline(pipeline);
render_pass.set_bind_group(0, bind_group, &[uniform_index.index()]);
render_pass.set_bind_group(0, Some(bind_group), &[uniform_index.index()]);
render_pass.draw(0..3, 0..1);

Ok(())
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_core_pipeline/src/dof/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,11 +446,11 @@ impl ViewNode for DepthOfFieldNode {
.begin_render_pass(&render_pass_descriptor);
render_pass.set_pipeline(render_pipeline);
// Set the per-view bind group.
render_pass.set_bind_group(0, &view_bind_group, &[view_uniform_offset.offset]);
render_pass.set_bind_group(0, Some(&view_bind_group), &[view_uniform_offset.offset]);
// Set the global bind group shared among all invocations of the shader.
render_pass.set_bind_group(
1,
global_bind_group,
Some(global_bind_group),
&[depth_of_field_uniform_index.index()],
);
// Render the full-screen pass.
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_core_pipeline/src/fxaa/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl ViewNode for FxaaNode {
.begin_render_pass(&pass_descriptor);

render_pass.set_pipeline(pipeline);
render_pass.set_bind_group(0, bind_group, &[]);
render_pass.set_bind_group(0, Some(bind_group), &[]);
render_pass.draw(0..3, 0..1);

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_core_pipeline/src/msaa_writeback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl ViewNode for MsaaWritebackNode {
.begin_render_pass(&pass_descriptor);

render_pass.set_pipeline(pipeline);
render_pass.set_bind_group(0, &bind_group, &[]);
render_pass.set_bind_group(0, Some(&bind_group), &[]);
render_pass.draw(0..3, 0..1);

Ok(())
Expand Down
6 changes: 5 additions & 1 deletion crates/bevy_core_pipeline/src/post_process/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,11 @@ impl ViewNode for PostProcessingNode {
.begin_render_pass(&pass_descriptor);

render_pass.set_pipeline(pipeline);
render_pass.set_bind_group(0, &bind_group, &[**post_processing_uniform_buffer_offsets]);
render_pass.set_bind_group(
0,
Some(&bind_group),
&[**post_processing_uniform_buffer_offsets],
);
render_pass.draw(0..3, 0..1);

Ok(())
Expand Down
24 changes: 18 additions & 6 deletions crates/bevy_core_pipeline/src/smaa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -960,8 +960,16 @@ fn perform_edge_detection(
.command_encoder()
.begin_render_pass(&pass_descriptor);
render_pass.set_pipeline(edge_detection_pipeline);
render_pass.set_bind_group(0, &postprocess_bind_group, &[**view_smaa_uniform_offset]);
render_pass.set_bind_group(1, &view_smaa_bind_groups.edge_detection_bind_group, &[]);
render_pass.set_bind_group(
0,
Some(&postprocess_bind_group),
&[**view_smaa_uniform_offset],
);
render_pass.set_bind_group(
1,
Some(&view_smaa_bind_groups.edge_detection_bind_group),
&[],
);
render_pass.set_stencil_reference(1);
render_pass.draw(0..3, 0..1);
}
Expand Down Expand Up @@ -1016,10 +1024,14 @@ fn perform_blending_weight_calculation(
.command_encoder()
.begin_render_pass(&pass_descriptor);
render_pass.set_pipeline(blending_weight_calculation_pipeline);
render_pass.set_bind_group(0, &postprocess_bind_group, &[**view_smaa_uniform_offset]);
render_pass.set_bind_group(
0,
Some(&postprocess_bind_group),
&[**view_smaa_uniform_offset],
);
render_pass.set_bind_group(
1,
&view_smaa_bind_groups.blending_weight_calculation_bind_group,
Some(&view_smaa_bind_groups.blending_weight_calculation_bind_group),
&[],
);
render_pass.set_stencil_reference(1);
Expand Down Expand Up @@ -1067,12 +1079,12 @@ fn perform_neighborhood_blending(
neighborhood_blending_render_pass.set_pipeline(neighborhood_blending_pipeline);
neighborhood_blending_render_pass.set_bind_group(
0,
&postprocess_bind_group,
Some(&postprocess_bind_group),
&[**view_smaa_uniform_offset],
);
neighborhood_blending_render_pass.set_bind_group(
1,
&view_smaa_bind_groups.neighborhood_blending_bind_group,
Some(&view_smaa_bind_groups.neighborhood_blending_bind_group),
&[],
);
neighborhood_blending_render_pass.draw(0..3, 0..1);
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_core_pipeline/src/tonemapping/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ impl ViewNode for TonemappingNode {
.begin_render_pass(&pass_descriptor);

render_pass.set_pipeline(pipeline);
render_pass.set_bind_group(0, bind_group, &[view_uniform_offset.offset]);
render_pass.set_bind_group(0, Some(bind_group), &[view_uniform_offset.offset]);
render_pass.draw(0..3, 0..1);

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_core_pipeline/src/upscaling/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl ViewNode for UpscalingNode {
}

render_pass.set_pipeline(pipeline);
render_pass.set_bind_group(0, bind_group, &[]);
render_pass.set_bind_group(0, Some(bind_group), &[]);
render_pass.draw(0..3, 0..1);

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_image/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ image = { version = "0.25.2", default-features = false }
# misc
bitflags = { version = "2.3", features = ["serde"] }
bytemuck = { version = "1.5" }
wgpu = { version = "22", default-features = false }
wgpu = { git = "https://github.com/gfx-rs/wgpu", branch = "trunk", default-features = false }
serde = { version = "1", features = ["derive"] }
derive_more = { version = "1", default-features = false, features = [
"error",
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_image/src/dds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ pub fn dds_format_to_texture_format(
DxgiFormat::R10G10B10A2_Typeless | DxgiFormat::R10G10B10A2_UNorm => {
TextureFormat::Rgb10a2Unorm
}
DxgiFormat::R11G11B10_Float => TextureFormat::Rg11b10Float,
DxgiFormat::R11G11B10_Float => TextureFormat::Rg11b10Ufloat,
DxgiFormat::R8G8B8A8_Typeless
| DxgiFormat::R8G8B8A8_UNorm
| DxgiFormat::R8G8B8A8_UNorm_sRGB => {
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_image/src/ktx2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ pub fn ktx2_dfd_to_texture_format(
&& sample_information[2].channel_type == 2
&& sample_information[2].bit_length == 10
{
TextureFormat::Rg11b10Float
TextureFormat::Rg11b10Ufloat
} else if sample_information[0].channel_type == 0
&& sample_information[0].bit_length == 9
&& sample_information[1].channel_type == 1
Expand Down Expand Up @@ -1276,7 +1276,7 @@ pub fn ktx2_format_to_texture_format(
ktx2::Format::R32G32B32A32_SINT => TextureFormat::Rgba32Sint,
ktx2::Format::R32G32B32A32_SFLOAT => TextureFormat::Rgba32Float,

ktx2::Format::B10G11R11_UFLOAT_PACK32 => TextureFormat::Rg11b10Float,
ktx2::Format::B10G11R11_UFLOAT_PACK32 => TextureFormat::Rg11b10Ufloat,
ktx2::Format::E5B9G9R9_UFLOAT_PACK32 => TextureFormat::Rgb9e5Ufloat,

ktx2::Format::X8_D24_UNORM_PACK32 => TextureFormat::Depth24Plus,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_mesh/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev" }
# misc
bitflags = { version = "2.3", features = ["serde"] }
bytemuck = { version = "1.5" }
wgpu = { version = "22", default-features = false }
wgpu = { git = "https://github.com/gfx-rs/wgpu", branch = "trunk", default-features = false }
serde = { version = "1", features = ["derive"] }
hexasphere = "15.0"
derive_more = { version = "1", default-features = false, features = [
Expand Down
10 changes: 5 additions & 5 deletions crates/bevy_pbr/src/meshlet/visibility_buffer_raster_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ fn fill_cluster_buffers_pass(
});
fill_pass.set_pipeline(fill_cluster_buffers_pass_pipeline);
fill_pass.set_push_constants(0, &cluster_count.to_le_bytes());
fill_pass.set_bind_group(0, fill_cluster_buffers_bind_group, &[]);
fill_pass.set_bind_group(0, Some(fill_cluster_buffers_bind_group), &[]);
fill_pass.dispatch_workgroups(
fill_cluster_buffers_pass_workgroups,
fill_cluster_buffers_pass_workgroups,
Expand Down Expand Up @@ -374,7 +374,7 @@ fn cull_pass(
cull_pass.set_push_constants(0, &raster_cluster_rightmost_slot.to_le_bytes());
cull_pass.set_bind_group(
0,
culling_bind_group,
Some(culling_bind_group),
&[view_offset.offset, previous_view_offset.offset],
);
cull_pass.dispatch_workgroups(culling_workgroups, culling_workgroups, culling_workgroups);
Expand All @@ -384,7 +384,7 @@ fn cull_pass(
remap_1d_to_2d_dispatch_bind_group,
) {
cull_pass.set_pipeline(remap_1d_to_2d_dispatch_pipeline);
cull_pass.set_bind_group(0, remap_1d_to_2d_dispatch_bind_group, &[]);
cull_pass.set_bind_group(0, Some(remap_1d_to_2d_dispatch_bind_group), &[]);
cull_pass.dispatch_workgroups(1, 1, 1);
}
}
Expand Down Expand Up @@ -415,7 +415,7 @@ fn raster_pass(
software_pass.set_pipeline(visibility_buffer_hardware_software_pipeline);
software_pass.set_bind_group(
0,
&meshlet_view_bind_groups.visibility_buffer_raster,
Some(&meshlet_view_bind_groups.visibility_buffer_raster),
&[view_offset.offset],
);
software_pass
Expand Down Expand Up @@ -477,7 +477,7 @@ fn downsample_depth(
meshlet_view_resources.view_size.x,
]),
);
downsample_pass.set_bind_group(0, &meshlet_view_bind_groups.downsample_depth, &[]);
downsample_pass.set_bind_group(0, Some(&meshlet_view_bind_groups.downsample_depth), &[]);
downsample_pass.dispatch_workgroups(
meshlet_view_resources.view_size.x.div_ceil(64),
meshlet_view_resources.view_size.y.div_ceil(64),
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_pbr/src/render/gpu_preprocess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ impl Node for GpuPreprocessNode {
if gpu_culling {
dynamic_offsets.push(view_uniform_offset.offset);
}
compute_pass.set_bind_group(0, &bind_group.0, &dynamic_offsets);
compute_pass.set_bind_group(0, Some(&bind_group.0), &dynamic_offsets);

let workgroup_count = index_buffer.buffer.len().div_ceil(WORKGROUP_SIZE);
compute_pass.dispatch_workgroups(workgroup_count as u32, 1, 1);
Expand Down
20 changes: 14 additions & 6 deletions crates/bevy_pbr/src/ssao/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,14 @@ impl ViewNode for SsaoNode {
timestamp_writes: None,
});
preprocess_depth_pass.set_pipeline(preprocess_depth_pipeline);
preprocess_depth_pass.set_bind_group(0, &bind_groups.preprocess_depth_bind_group, &[]);
preprocess_depth_pass.set_bind_group(
0,
Some(&bind_groups.preprocess_depth_bind_group),
&[],
);
preprocess_depth_pass.set_bind_group(
1,
&bind_groups.common_bind_group,
Some(&bind_groups.common_bind_group),
&[view_uniform_offset.offset],
);
preprocess_depth_pass.dispatch_workgroups(
Expand All @@ -283,10 +287,10 @@ impl ViewNode for SsaoNode {
timestamp_writes: None,
});
ssao_pass.set_pipeline(ssao_pipeline);
ssao_pass.set_bind_group(0, &bind_groups.ssao_bind_group, &[]);
ssao_pass.set_bind_group(0, Some(&bind_groups.ssao_bind_group), &[]);
ssao_pass.set_bind_group(
1,
&bind_groups.common_bind_group,
Some(&bind_groups.common_bind_group),
&[view_uniform_offset.offset],
);
ssao_pass.dispatch_workgroups(camera_size.x.div_ceil(8), camera_size.y.div_ceil(8), 1);
Expand All @@ -301,10 +305,14 @@ impl ViewNode for SsaoNode {
timestamp_writes: None,
});
spatial_denoise_pass.set_pipeline(spatial_denoise_pipeline);
spatial_denoise_pass.set_bind_group(0, &bind_groups.spatial_denoise_bind_group, &[]);
spatial_denoise_pass.set_bind_group(
0,
Some(&bind_groups.spatial_denoise_bind_group),
&[],
);
spatial_denoise_pass.set_bind_group(
1,
&bind_groups.common_bind_group,
Some(&bind_groups.common_bind_group),
&[view_uniform_offset.offset],
);
spatial_denoise_pass.dispatch_workgroups(
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_pbr/src/volumetric_fog/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ impl ViewNode for VolumetricFogNode {
render_pass.set_pipeline(pipeline);
render_pass.set_bind_group(
0,
&view_bind_group.value,
Some(&view_bind_group.value),
&[
view_uniform_offset.offset,
view_lights_offset.offset,
Expand All @@ -461,7 +461,7 @@ impl ViewNode for VolumetricFogNode {
);
render_pass.set_bind_group(
1,
&volumetric_view_bind_group,
Some(&volumetric_view_bind_group),
&[view_fog_volume.uniform_buffer_offset],
);

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_reflect/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ glam = { version = "0.29", features = ["serde"], optional = true }
petgraph = { version = "0.6", features = ["serde-1"], optional = true }
smol_str = { version = "0.2.0", features = ["serde"], optional = true }
uuid = { version = "1.0", optional = true, features = ["v4", "serde"] }
wgpu-types = { version = "22", features = ["serde"], optional = true }
wgpu-types = { git = "https://github.com/gfx-rs/wgpu", branch = "trunk", features = ["serde"], optional = true }

[dev-dependencies]
ron = "0.8.0"
Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_render/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ codespan-reporting = "0.11.0"
# It is enabled for now to avoid having to do a significant overhaul of the renderer just for wasm.
# When the 'atomics' feature is enabled `fragile-send-sync-non-atomic` does nothing
# and Bevy instead wraps `wgpu` types to verify they are not used off their origin thread.
wgpu = { version = "22", default-features = false, features = [
wgpu = { git = "https://github.com/gfx-rs/wgpu", branch = "trunk", default-features = false, features = [
"wgsl",
"dx12",
"metal",
"naga-ir",
"fragile-send-sync-non-atomic-wasm",
] }
naga = { version = "22", features = ["wgsl-in"] }
naga = { git = "https://github.com/gfx-rs/wgpu", branch = "trunk", features = ["wgsl-in"] }
serde = { version = "1", features = ["derive"] }
bytemuck = { version = "1.5", features = ["derive", "must_cast"] }
downcast-rs = "1.2.0"
Expand All @@ -97,12 +97,12 @@ offset-allocator = "0.2"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
# Omit the `glsl` feature in non-WebAssembly by default.
naga_oil = { version = "0.15", default-features = false, features = [
naga_oil = { git = "https://github.com/tychedelia/naga_oil", branch = "wgpu-23", default-features = false, features = [
"test_shader",
] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
naga_oil = "0.15"
naga_oil = { git = "https://github.com/tychedelia/naga_oil", branch = "wgpu-23" }
js-sys = "0.3"
web-sys = { version = "0.3.67", features = [
'Blob',
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/render_phase/draw_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ impl<'a> TrackedRenderPass<'a> {
);

self.pass
.set_bind_group(index as u32, bind_group, dynamic_uniform_indices);
.set_bind_group(index as u32, Some(bind_group), dynamic_uniform_indices);
self.state
.set_bind_group(index, bind_group.id(), dynamic_uniform_indices);
}
Expand Down
Loading
Loading