Skip to content

Commit

Permalink
Deps: Update wgpu from 23 to 24.
Browse files Browse the repository at this point in the history
  • Loading branch information
kpreid committed Jan 15, 2025
1 parent 21cc1dc commit a55f9df
Show file tree
Hide file tree
Showing 14 changed files with 189 additions and 144 deletions.
194 changes: 106 additions & 88 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ unicode-width = { version = "0.2", default-features = false }
# explicitly enabling "std" needed for <https://github.com/rustwasm/wasm-bindgen/issues/4303>
wasm-bindgen-futures = { version = "0.4.46", default-features = false, features = ["std"] }
web-time = { version = "1.1.0", default-features = false }
wgpu = { version = "23.0.0", default-features = false, features = ["wgsl"] }
wgpu = { version = "24.0.0", default-features = false, features = ["wgsl"] }
yield-progress = { version = "0.1.6", default-features = false }

# Note: Lints are also necessarily redefined in the workspaces other than this one.
Expand Down
2 changes: 2 additions & 0 deletions all-is-cubes-desktop/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
//! so that additional development tools can reuse the same UI code. Use at your own risk.
//! Documentation is lacking.
// Increase recursion limit for deeply nested wgpu types
#![recursion_limit = "256"]
// Crate-specific lint settings. (General settings can be found in the workspace manifest.)
#![forbid(unsafe_code)]

Expand Down
6 changes: 3 additions & 3 deletions all-is-cubes-desktop/src/winit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ pub async fn create_winit_wgpu_desktop_session(
window.window.inner_size(),
));

let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::util::backend_bits_from_env().unwrap_or_else(wgpu::Backends::all),
let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor {
backends: wgpu::Backends::from_env().unwrap_or_else(wgpu::Backends::all),
..Default::default()
});

Expand All @@ -215,7 +215,7 @@ pub async fn create_winit_wgpu_desktop_session(
wgpu::util::initialize_adapter_from_env(&instance, Some(&surface));
if adapter.is_none() {
let request_adapter_future = instance.request_adapter(&wgpu::RequestAdapterOptions {
power_preference: wgpu::util::power_preference_from_env()
power_preference: wgpu::PowerPreference::from_env()
.unwrap_or(wgpu::PowerPreference::HighPerformance),
compatible_surface: Some(&surface),
force_fallback_adapter: false,
Expand Down
1 change: 1 addition & 0 deletions all-is-cubes-gpu/src/in_wgpu/bloom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ fn bloom_mip_view(mip_level: u32, bloom_texture: &wgpu::Texture) -> wgpu::Textur
label: Some(&format!("BloomResources bloom[{mip_level}]")),
format: None,
dimension: None,
usage: None,
aspect: wgpu::TextureAspect::default(),
base_mip_level: mip_level,
mip_level_count: Some(1),
Expand Down
4 changes: 2 additions & 2 deletions all-is-cubes-gpu/src/in_wgpu/frame_texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl<In, Out: Copy + Default + bytemuck::Pod> DrawableTexture<In, Out> {
if let Some(texture) = &self.texture {
let full_width = self.local_buffer.size().width;
queue.write_texture(
wgpu::ImageCopyTexture {
wgpu::TexelCopyTextureInfo {
texture,
mip_level: 0,
origin: wgpu::Origin3d {
Expand All @@ -113,7 +113,7 @@ impl<In, Out: Copy + Default + bytemuck::Pod> DrawableTexture<In, Out> {
* dirty_rect.top_left.y as usize
+ dirty_rect.top_left.x as usize..],
),
wgpu::ImageDataLayout {
wgpu::TexelCopyBufferLayout {
offset: 0,
bytes_per_row: Some(u32::try_from(size_of::<Out>()).unwrap() * full_width),
rows_per_image: None,
Expand Down
4 changes: 2 additions & 2 deletions all-is-cubes-gpu/src/in_wgpu/glue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ pub fn write_texture_by_aab<T: Pod, U>(
let size = region.size();

queue.write_texture(
wgpu::ImageCopyTexture {
wgpu::TexelCopyTextureInfo {
texture,
mip_level: 0,
origin: point_to_origin(region.min),
aspect: wgpu::TextureAspect::All,
},
bytemuck::must_cast_slice::<T, u8>(data),
wgpu::ImageDataLayout {
wgpu::TexelCopyBufferLayout {
offset: 0,
bytes_per_row: Some(size_of::<T>() as u32 * size.width),
rows_per_image: Some(size.height),
Expand Down
10 changes: 5 additions & 5 deletions all-is-cubes-gpu/src/in_wgpu/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ use all_is_cubes_render::{camera, Flaws, Rendering};
#[doc(hidden)]
pub async fn create_instance_for_test_or_exit() -> wgpu::Instance {
let stderr = &mut std::io::stderr();
let backends = wgpu::util::backend_bits_from_env().unwrap_or_else(wgpu::Backends::all);
let backends = wgpu::Backends::from_env().unwrap_or_else(wgpu::Backends::all);

let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor {
backends,
..Default::default()
});
Expand Down Expand Up @@ -97,7 +97,7 @@ pub async fn try_create_adapter_for_test(
));
adapter = instance
.request_adapter(&wgpu::RequestAdapterOptions {
power_preference: wgpu::util::power_preference_from_env()
power_preference: wgpu::PowerPreference::from_env()
.unwrap_or(wgpu::PowerPreference::HighPerformance),
compatible_surface: surface.as_ref(),
force_fallback_adapter: false,
Expand Down Expand Up @@ -290,9 +290,9 @@ impl TextureCopyParameters {
device.create_command_encoder(&wgpu::CommandEncoderDescriptor::default());
encoder.copy_texture_to_buffer(
texture.as_image_copy(),
wgpu::ImageCopyBuffer {
wgpu::TexelCopyBufferInfo {
buffer: &temp_buffer,
layout: wgpu::ImageDataLayout {
layout: wgpu::TexelCopyBufferLayout {
offset: 0,
bytes_per_row: Some(padded_bytes_per_row),
rows_per_image: Some(self.size.height),
Expand Down
6 changes: 3 additions & 3 deletions all-is-cubes-gpu/src/in_wgpu/light_texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,16 +460,16 @@ impl LightTexture {
// TODO: When compute shaders are available, use a compute shader to do these
// scattered writes instead of issuing individual commands.
encoder.copy_buffer_to_texture(
wgpu::ImageCopyBuffer {
wgpu::TexelCopyBufferInfo {
buffer: &self.copy_buffer,
layout: wgpu::ImageDataLayout {
layout: wgpu::TexelCopyBufferLayout {
offset: (index_in_batch * (LIGHT_CHUNK_VOLUME * Self::COMPONENTS))
as u64,
bytes_per_row: None,
rows_per_image: None,
},
},
wgpu::ImageCopyTexture {
wgpu::TexelCopyTextureInfo {
texture: &self.texture,
mip_level: 0,
origin: point_to_origin(
Expand Down
2 changes: 1 addition & 1 deletion all-is-cubes-gpu/src/in_wgpu/skybox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ fn compute_skybox(queue: &wgpu::Queue, texture: &wgpu::Texture, sky: &Sky) {
queue.write_texture(
texture.as_image_copy(),
bytemuck::must_cast_slice::<[Component; CHANNELS], u8>(&data[..]),
wgpu::ImageDataLayout {
wgpu::TexelCopyBufferLayout {
offset: 0,
bytes_per_row: Some(resolution * (size_of::<Component>() * CHANNELS) as u32),
rows_per_image: Some(resolution),
Expand Down
Loading

0 comments on commit a55f9df

Please sign in to comment.