Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9ac8cf2
bump versions with patches
ChristopherBiscardi Jul 2, 2026
ba59d29
new NoopBackendOptions and RequestAdapterOptions
ChristopherBiscardi Jul 2, 2026
8c2d8d7
SurfaceColorSpace
ChristopherBiscardi Jul 2, 2026
5cb235f
get_mapped_range returns a Result
ChristopherBiscardi Jul 2, 2026
12404f6
empty BufferSlices no longer panic
ChristopherBiscardi Jul 2, 2026
c28f13e
vertex buffer slots are optional now
ChristopherBiscardi Jul 2, 2026
792ab3d
rework presentation
ChristopherBiscardi Jul 2, 2026
3211306
enable declaration for wgpu_binding_array
ChristopherBiscardi Jul 2, 2026
f82e2ff
interpolate(flat) must be declared, even though it is the only option
ChristopherBiscardi Jul 2, 2026
5173396
format bevy_image Cargo.toml
ChristopherBiscardi Jul 2, 2026
ac70dfa
enable declaration for wgpu_binding_array
ChristopherBiscardi Jul 2, 2026
9324356
enable declaration for wgpu_binding_array
ChristopherBiscardi Jul 2, 2026
905d3e6
direct access to atomic variable is not allowed
ChristopherBiscardi Jul 2, 2026
3bc2099
update dlss usage for responsivity_mask
ChristopherBiscardi Jul 2, 2026
e939dbe
get_mapped_range returns a Result
ChristopherBiscardi Jul 2, 2026
9b5a6a5
clippy wants boxes, clippy gets boxes
ChristopherBiscardi Jul 2, 2026
edb8f0f
use references instead of cloning RenderQueue
ChristopherBiscardi Jul 2, 2026
80694b2
clippy and unbox a no-longer-needed box
ChristopherBiscardi Jul 2, 2026
b7446bd
get_mapped_range returns a Result
ChristopherBiscardi Jul 2, 2026
585bfc4
get_mapped_range returns a Result
ChristopherBiscardi Jul 2, 2026
919b077
wgpu_binding_array and more atomicLoad fixes
ChristopherBiscardi Jul 2, 2026
5833e47
we arent going to expose responsivity_mask from dlss_wgpu
ChristopherBiscardi Jul 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,10 @@ tracing = { version = "0.1", default-features = false, optional = true }
[target.'cfg(not(target_family = "wasm"))'.dependencies]
bevy_dylib = { path = "crates/bevy_dylib", version = "0.20.0-dev", default-features = false, optional = true }

[patch.crates-io]
Comment thread
ChristopherBiscardi marked this conversation as resolved.
naga_oil = { git = "https://github.com/christopherbiscardi/naga_oil", branch = "wgpu-30" }
dlss_wgpu = { git = "https://github.com/christopherbiscardi/dlss_wgpu", branch = "wgpu-30" }

[dev-dependencies]
rand = "0.10.0"
chacha20 = { version = "0.10.0", default-features = false, features = ["rng"] }
Expand Down
2 changes: 2 additions & 0 deletions assets/shaders/texture_binding_array.wgsl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
enable wgpu_binding_array;

#import bevy_pbr::forward_io::VertexOutput

@group(#{MATERIAL_BIND_GROUP}) @binding(0) var textures: binding_array<texture_2d<f32>>;
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_anti_alias/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ bevy_diagnostic = { path = "../bevy_diagnostic", version = "0.20.0-dev" }

# other
tracing = { version = "0.1", default-features = false, features = ["std"] }
dlss_wgpu = { version = "4.0.0", optional = true }
dlss_wgpu = { version = "5.0.0", optional = true }
uuid = { version = "1.21.0", optional = true }

[lints]
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_camera/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ bevy_color = { path = "../bevy_color", version = "0.20.0-dev", features = [
bevy_window = { path = "../bevy_window", version = "0.20.0-dev" }

# other
wgpu-types = { version = "29.0.3", default-features = false }
wgpu-types = { version = "30", 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"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_clipboard/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ bevy_platform = { path = "../bevy_platform", version = "0.20.0-dev", default-fea
[target.'cfg(any(windows, unix))'.dependencies]
bevy_asset = { path = "../bevy_asset", version = "0.20.0-dev", default-features = false, optional = true }
bevy_image = { path = "../bevy_image", version = "0.20.0-dev", default-features = false, optional = true }
wgpu-types = { version = "29.0.3", default-features = false, optional = true }
wgpu-types = { version = "30", default-features = false, optional = true }
arboard = { version = "3.6.1", default-features = false, optional = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_color/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "29.0.3", default-features = false, optional = true }
wgpu-types = { version = "30", default-features = false, optional = true }
encase = { version = "0.12", default-features = false, optional = true }

[features]
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_gltf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.140"
smallvec = { version = "1", default-features = false }
tracing = { version = "0.1", default-features = false, features = ["std"] }
wgpu-types = { version = "29.0.3", default-features = false }
wgpu-types = { version = "30", default-features = false }

[dev-dependencies]
bevy_log = { path = "../bevy_log", version = "0.20.0-dev" }
Expand Down
4 changes: 1 addition & 3 deletions crates/bevy_image/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ image = { version = "0.25.2", default-features = false }
# misc
bitflags = { version = "2.3", features = ["serde"] }
bytemuck = { version = "1.5" }
wgpu-types = { version = "29.0.3", default-features = false, features = [
"serde",
] }
wgpu-types = { version = "30", default-features = false, features = ["serde"] }
serde = { version = "1", features = ["derive"] }
thiserror = { version = "2", default-features = false }
futures-lite = "2.0.1"
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_light/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ bevy_log = { path = "../bevy_log", version = "0.20.0-dev" }

# other
tracing = { version = "0.1", default-features = false }
wgpu-types = { version = "29.0.3", default-features = false }
wgpu-types = { version = "30", default-features = false }
half = "2.7.1"
smallvec = { version = "1", default-features = false }

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_material/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ bevy_platform = { path = "../bevy_platform", version = "0.20.0-dev" }
encase = "0.12"
tracing = { version = "0.1", default-features = false, features = ["std"] }
thiserror = { version = "2", default-features = false }
wgpu-types = { version = "29.0.3", default-features = false }
wgpu-types = { version = "30", default-features = false }
variadics_please = "2.0"
smallvec = { version = "1", default-features = false }

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 @@ -27,7 +27,7 @@ bevy_platform = { path = "../bevy_platform", version = "0.20.0-dev", default-fea
# other
bitflags = { version = "2.3", features = ["serde"] }
bytemuck = { version = "1.5" }
wgpu-types = { version = "29.0.3", default-features = false }
wgpu-types = { version = "30", default-features = false }
serde = { version = "1", default-features = false, features = [
"derive",
], optional = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_pbr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ tracing = { version = "0.1", default-features = false, features = ["std"] }
offset-allocator = "0.2"
arrayvec = { version = "0.7", default-features = false }
indexmap = { version = "2" }
wgpu-types = "29.0.3"
wgpu-types = "30"

[lints]
workspace = true
Expand Down
5 changes: 4 additions & 1 deletion crates/bevy_pbr/src/cluster/gpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,10 @@ fn cluster_on_gpu(

{
// Use `encase` to populate a `ClusterMetadata`.
let buffer_view = captured_staging_buffer.slice(..).get_mapped_range();
let buffer_view = captured_staging_buffer
.slice(..)
.get_mapped_range()
.unwrap();
let Ok(mut buffer_reader) =
Reader::new::<ClusterMetadata>(buffer_view[..].to_vec(), 0)
else {
Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_pbr/src/lightmap/lightmap.wgsl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
enable wgpu_binding_array;

#define_import_path bevy_pbr::lightmap

#import bevy_pbr::mesh_bindings::mesh
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_pbr/src/prepass/prepass_io.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ struct VertexOutput {
@location(6) unclipped_depth: f32,
#endif // UNCLIPPED_DEPTH_ORTHO_EMULATION
#ifdef VERTEX_OUTPUT_INSTANCE_INDEX
@location(7) instance_index: u32,
@location(7) @interpolate(flat) instance_index: u32,
#endif

#ifdef VERTEX_COLORS
Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_pbr/src/render/mesh_view_bindings.wgsl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
enable wgpu_binding_array;

#define_import_path bevy_pbr::mesh_view_bindings

#import bevy_pbr::mesh_view_types as types
Expand Down
9 changes: 5 additions & 4 deletions crates/bevy_post_process/src/auto_exposure/auto_exposure.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ fn compute_histogram(
// Accumulate the workgroup histogram into the global histogram.
// Note that the global histogram was not cleared at the beginning,
// as it will be cleared in compute_average.
atomicAdd(&histogram[local_invocation_index], histogram_shared[local_invocation_index]);
var histogram_value = atomicLoad(&histogram_shared[local_invocation_index]);
atomicAdd(&histogram[local_invocation_index], histogram_value);
}

@compute @workgroup_size(1, 1, 1)
Expand All @@ -132,7 +133,7 @@ fn compute_average(@builtin(local_invocation_index) local_index: u32) {
// This way we can quickly exclude the portion of lowest and highest samples as required by
// the low_percent and high_percent settings.
for (var i=0u; i<64u; i+=1u) {
histogram_sum += histogram[i];
histogram_sum += atomicLoad(&histogram[i]);
histogram_shared[i] = histogram_sum;

// Clear the histogram bin for the next frame
Expand All @@ -148,8 +149,8 @@ fn compute_average(@builtin(local_invocation_index) local_index: u32) {
// The number of pixels in the bin. The histogram values are clamped to
// first_index and last_index to exclude the lowest and highest samples.
let bin_count =
clamp(histogram_shared[i], first_index, last_index) -
clamp(histogram_shared[i - 1u], first_index, last_index);
clamp(atomicLoad(&histogram_shared[i]), first_index, last_index) -
clamp(atomicLoad(&histogram_shared[i - 1u]), first_index, last_index);

sum += f32(bin_count) * f32(i);
count += bin_count;
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 @@ -129,7 +129,7 @@ uuid = { version = "1.21.0", default-features = false, optional = true, features
"serde",
] }
variadics_please = "2.0"
wgpu-types = { version = "29.0.3", features = [
wgpu-types = { version = "30", features = [
"serde",
], optional = true, default-features = false }

Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_render/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,16 @@ 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 = "29.0.3", default-features = false, features = [
wgpu = { version = "30", default-features = false, features = [
"wgsl",
"dx12",
"metal",
"vulkan",
"naga-ir",
"fragile-send-sync-non-atomic-wasm",
] }
wgpu-types = { version = "29.0.3", default-features = false }
naga = { version = "29.0.3", features = ["wgsl-in"] }
wgpu-types = { version = "30", default-features = false }
naga = { version = "30", 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 }
Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_render/src/bindless.wgsl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
enable wgpu_binding_array;

// Defines the common arrays used to access bindless resources.
//
// This need to be kept up to date with the `BINDING_NUMBERS` table in
Expand Down
12 changes: 6 additions & 6 deletions crates/bevy_render/src/diagnostic/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl RecordDiagnostics for DiagnosticsRecorder {
{
assert_eq!(
buffer.size(),
BufferSize::new(4).unwrap(),
BufferSize::new(4).unwrap().get(),
"DiagnosticsRecorder::record_f32 buffer slice must be 4 bytes long"
);
assert!(
Expand All @@ -169,7 +169,7 @@ impl RecordDiagnostics for DiagnosticsRecorder {
{
assert_eq!(
buffer.size(),
BufferSize::new(4).unwrap(),
BufferSize::new(4).unwrap().get(),
"DiagnosticsRecorder::record_u32 buffer slice must be 4 bytes long"
);
assert!(
Expand Down Expand Up @@ -427,7 +427,7 @@ impl FrameData {
buffer.offset(),
&dest_buffer,
0,
Some(buffer.size().into()),
Some(buffer.size()),
);

command_encoder.map_buffer_on_submit(&dest_buffer, MapMode::Read, .., |_| {});
Expand Down Expand Up @@ -533,7 +533,7 @@ impl FrameData {
}

for (buffer, diagnostic_path, is_f32) in self.value_buffers.drain(..) {
let buffer = buffer.get_mapped_range(..);
let buffer = buffer.get_mapped_range(..).unwrap();
diagnostics.push(RenderDiagnostic {
path: DiagnosticPath::from_components(
core::iter::once("render")
Expand Down Expand Up @@ -578,7 +578,7 @@ impl FrameData {
return true;
};

let data = read_buffer.slice(..).get_mapped_range();
let data = read_buffer.slice(..).get_mapped_range().unwrap();

let timestamps = data[..(self.num_timestamps * 8) as usize]
.as_chunks()
Expand Down Expand Up @@ -675,7 +675,7 @@ impl FrameData {
}

for (buffer, diagnostic_path, is_f32) in self.value_buffers.drain(..) {
let buffer = buffer.get_mapped_range(..);
let buffer = buffer.get_mapped_range(..).unwrap();
diagnostics.push(RenderDiagnostic {
path: DiagnosticPath::from_components(
core::iter::once("render").chain(core::iter::once(diagnostic_path.as_ref())),
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/diagnostic/tracy_gpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ fn initial_timestamp(device: &RenderDevice, queue: &RenderQueue) -> i64 {
.poll(PollType::wait_indefinitely())
.expect("Failed to poll device for map async");

let view = map_buffer.slice(..).get_mapped_range();
let view = map_buffer.slice(..).get_mapped_range().unwrap();
i64::from_le_bytes((*view).try_into().unwrap())
}
2 changes: 1 addition & 1 deletion crates/bevy_render/src/gpu_readback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ fn map_buffers(mut readbacks: ResMut<GpuReadbacks>) {
slice.map_async(wgpu::MapMode::Read, move |res| {
res.expect("Failed to map buffer");
let buffer_slice = buffer.slice(..);
let data = buffer_slice.get_mapped_range();
let data = buffer_slice.get_mapped_range().unwrap();
let result = Vec::from(&*data);
drop(data);
buffer.unmap();
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 @@ -14,7 +14,7 @@ use wgpu::{IndexFormat, QuerySet, RenderPass};
#[cfg(feature = "detailed_trace")]
use bevy_log::trace;

type BufferSliceKey = (BufferId, wgpu::BufferAddress, wgpu::BufferSize);
type BufferSliceKey = (BufferId, wgpu::BufferAddress, wgpu::BufferAddress);

/// Tracks the state of a [`TrackedRenderPass`].
///
Expand Down
10 changes: 6 additions & 4 deletions crates/bevy_render/src/render_resource/pipeline_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,12 @@ impl PipelineCache {
.vertex
.buffers
.iter()
.map(|layout| RawVertexBufferLayout {
array_stride: layout.array_stride,
attributes: &layout.attributes,
step_mode: layout.step_mode,
.map(|layout| {
Some(RawVertexBufferLayout {
array_stride: layout.array_stride,
attributes: &layout.attributes,
step_mode: layout.step_mode,
})
})
.collect::<Vec<_>>();

Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_render/src/render_resource/texture.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::renderer::{RenderDevice, WgpuWrapper};
use crate::renderer::{RenderDevice, RenderQueue, WgpuWrapper};
use bevy_derive::{Deref, DerefMut};
use bevy_ecs::{
resource::Resource,
Expand Down Expand Up @@ -74,8 +74,8 @@ pub struct SurfaceTexture {
}

impl SurfaceTexture {
pub fn present(self) {
self.value.into_inner().present();
pub fn present(self, render_queue: &RenderQueue) {
render_queue.present(self.value.into_inner());
}
}

Expand Down
8 changes: 6 additions & 2 deletions crates/bevy_render/src/renderer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub fn render_system(
});

if view_needs_present || window.needs_initial_present {
window.present();
window.present(world.resource::<RenderQueue>());
window.needs_initial_present = false;
}
}
Expand Down Expand Up @@ -204,7 +204,10 @@ pub async fn initialize_renderer(
force_shader_model: ForceShaderModelToken::default(),
agility_sdk: None,
},
noop: wgpu::NoopBackendOptions { enable: false },
noop: wgpu::NoopBackendOptions {
enable: false,
..Default::default()
},
},
};

Expand Down Expand Up @@ -250,6 +253,7 @@ pub async fn initialize_renderer(
power_preference: options.power_preference,
compatible_surface: surface.as_ref(),
force_fallback_adapter,
apply_limit_buckets: false,
};

#[cfg(not(target_family = "wasm"))]
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_render/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ impl RenderResources {
/// An enum describing how the renderer will initialize resources. This is used when creating the [`RenderPlugin`](crate::RenderPlugin).
pub enum RenderCreation {
/// Allows renderer resource initialization to happen outside of the rendering plugin.
Manual(RenderResources),
Manual(Box<RenderResources>),
/// Lets the rendering plugin create resources itself.
Automatic(Box<WgpuSettings>),
}
Expand Down Expand Up @@ -265,7 +265,7 @@ impl RenderCreation {
) -> bool {
match self {
RenderCreation::Manual(resources) => {
*future_resources.lock().unwrap() = Some(resources.clone());
*future_resources.lock().unwrap() = Some(*resources.clone());
}
RenderCreation::Automatic(render_creation) => {
let Some(backends) = render_creation.backends else {
Expand Down Expand Up @@ -302,7 +302,7 @@ impl RenderCreation {

impl From<RenderResources> for RenderCreation {
fn from(value: RenderResources) -> Self {
Self::Manual(value)
Self::Manual(Box::new(value))
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/slab_allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ where
mapped_at_creation: true,
});
{
let mut slice = buffer.slice(..).get_mapped_range_mut();
let mut slice = buffer.slice(..).get_mapped_range_mut().unwrap();

fill_data(slice.slice(..len));
}
Expand Down
Loading
Loading