From 67655976e61b9ef9002c15250b03f1849512426f Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Mon, 1 Mar 2021 23:21:45 -0500 Subject: [PATCH] [rs] Update wgpu depth_or_array_layers --- wgpu/Cargo.toml | 6 +++--- wgpu/examples/capture/main.rs | 2 +- wgpu/examples/cube/main.rs | 2 +- wgpu/examples/mipmap/main.rs | 2 +- wgpu/examples/msaa-line/main.rs | 2 +- wgpu/examples/shadow/main.rs | 6 +++--- wgpu/examples/skybox/main.rs | 9 ++++++--- wgpu/examples/texture-arrays/main.rs | 18 +++--------------- wgpu/examples/water/main.rs | 2 +- wgpu/src/backend/web.rs | 2 +- wgpu/src/util/device.rs | 6 +++--- 11 files changed, 24 insertions(+), 33 deletions(-) diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index 4ea6c2b551..f909498453 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -26,20 +26,20 @@ webgl = ["wgc"] [target.'cfg(not(target_arch = "wasm32"))'.dependencies.wgc] package = "wgpu-core" git = "https://github.com/gfx-rs/wgpu" -rev = "ecbddedfaf67299bc2c507f69d138b2c3e3226b3" +rev = "8a5668e0da36bc863091d70853a0766be8b330be" features = ["raw-window-handle", "cross"] [target.'cfg(target_arch = "wasm32")'.dependencies.wgc] package = "wgpu-core" git = "https://github.com/gfx-rs/wgpu" -rev = "ecbddedfaf67299bc2c507f69d138b2c3e3226b3" +rev = "8a5668e0da36bc863091d70853a0766be8b330be" features = ["raw-window-handle", "cross"] optional = true [dependencies.wgt] package = "wgpu-types" git = "https://github.com/gfx-rs/wgpu" -rev = "ecbddedfaf67299bc2c507f69d138b2c3e3226b3" +rev = "8a5668e0da36bc863091d70853a0766be8b330be" [dependencies] arrayvec = "0.5" diff --git a/wgpu/examples/capture/main.rs b/wgpu/examples/capture/main.rs index 71157c202b..a1e9b21d30 100644 --- a/wgpu/examples/capture/main.rs +++ b/wgpu/examples/capture/main.rs @@ -61,7 +61,7 @@ async fn create_red_image_with_dimensions( let texture_extent = wgpu::Extent3d { width: buffer_dimensions.width as u32, height: buffer_dimensions.height as u32, - depth: 1, + depth_or_array_layers: 1, }; // The render pipeline renders data into this texture diff --git a/wgpu/examples/cube/main.rs b/wgpu/examples/cube/main.rs index b923f18aa8..ec5ada9880 100644 --- a/wgpu/examples/cube/main.rs +++ b/wgpu/examples/cube/main.rs @@ -183,7 +183,7 @@ impl framework::Example for Example { let texture_extent = wgpu::Extent3d { width: size, height: size, - depth: 1, + depth_or_array_layers: 1, }; let texture = device.create_texture(&wgpu::TextureDescriptor { label: None, diff --git a/wgpu/examples/mipmap/main.rs b/wgpu/examples/mipmap/main.rs index e2c1df571d..6ab80330d4 100644 --- a/wgpu/examples/mipmap/main.rs +++ b/wgpu/examples/mipmap/main.rs @@ -219,7 +219,7 @@ impl framework::Example for Example { let texture_extent = wgpu::Extent3d { width: size, height: size, - depth: 1, + depth_or_array_layers: 1, }; let texture = device.create_texture(&wgpu::TextureDescriptor { size: texture_extent, diff --git a/wgpu/examples/msaa-line/main.rs b/wgpu/examples/msaa-line/main.rs index 666f8f971d..7800a6e71d 100644 --- a/wgpu/examples/msaa-line/main.rs +++ b/wgpu/examples/msaa-line/main.rs @@ -96,7 +96,7 @@ impl Example { let multisampled_texture_extent = wgpu::Extent3d { width: sc_desc.width, height: sc_desc.height, - depth: 1, + depth_or_array_layers: 1, }; let multisampled_frame_descriptor = &wgpu::TextureDescriptor { size: multisampled_texture_extent, diff --git a/wgpu/examples/shadow/main.rs b/wgpu/examples/shadow/main.rs index 3b64bd08ea..ac926d7092 100644 --- a/wgpu/examples/shadow/main.rs +++ b/wgpu/examples/shadow/main.rs @@ -171,7 +171,7 @@ impl Example { const SHADOW_SIZE: wgpu::Extent3d = wgpu::Extent3d { width: 512, height: 512, - depth: Self::MAX_LIGHTS as u32, + depth_or_array_layers: Self::MAX_LIGHTS as u32, }; const DEPTH_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Depth32Float; @@ -641,7 +641,7 @@ impl framework::Example for Example { size: wgpu::Extent3d { width: sc_desc.width, height: sc_desc.height, - depth: 1, + depth_or_array_layers: 1, }, mip_level_count: 1, sample_count: 1, @@ -687,7 +687,7 @@ impl framework::Example for Example { size: wgpu::Extent3d { width: sc_desc.width, height: sc_desc.height, - depth: 1, + depth_or_array_layers: 1, }, mip_level_count: 1, sample_count: 1, diff --git a/wgpu/examples/skybox/main.rs b/wgpu/examples/skybox/main.rs index fd777e91ee..fa3b90ee79 100644 --- a/wgpu/examples/skybox/main.rs +++ b/wgpu/examples/skybox/main.rs @@ -272,10 +272,13 @@ impl framework::Example for Skybox { let size = wgpu::Extent3d { width: IMAGE_SIZE, height: IMAGE_SIZE, - depth: 6, + depth_or_array_layers: 6, }; - let layer_size = wgpu::Extent3d { depth: 1, ..size }; + let layer_size = wgpu::Extent3d { + depth_or_array_layers: 1, + ..size + }; let max_mips = layer_size.max_mips(); log::debug!( @@ -338,7 +341,7 @@ impl framework::Example for Skybox { size: wgpu::Extent3d { width: sc_desc.width, height: sc_desc.height, - depth: 1, + depth_or_array_layers: 1, }, mip_level_count: 1, sample_count: 1, diff --git a/wgpu/examples/texture-arrays/main.rs b/wgpu/examples/texture-arrays/main.rs index 26b5bf1d04..2eeb066968 100644 --- a/wgpu/examples/texture-arrays/main.rs +++ b/wgpu/examples/texture-arrays/main.rs @@ -130,11 +130,7 @@ impl framework::Example for Example { let green_texture_data = create_texture_data(Color::GREEN); let texture_descriptor = wgpu::TextureDescriptor { - size: wgpu::Extent3d { - width: 1, - height: 1, - depth: 1, - }, + size: wgpu::Extent3d::default(), mip_level_count: 1, sample_count: 1, dimension: wgpu::TextureDimension::D2, @@ -166,11 +162,7 @@ impl framework::Example for Example { bytes_per_row: 4, rows_per_image: 0, }, - wgpu::Extent3d { - width: 1, - height: 1, - depth: 1, - }, + wgpu::Extent3d::default(), ); queue.write_texture( wgpu::TextureCopyView { @@ -184,11 +176,7 @@ impl framework::Example for Example { bytes_per_row: 4, rows_per_image: 0, }, - wgpu::Extent3d { - width: 1, - height: 1, - depth: 1, - }, + wgpu::Extent3d::default(), ); let sampler = device.create_sampler(&wgpu::SamplerDescriptor::default()); diff --git a/wgpu/examples/water/main.rs b/wgpu/examples/water/main.rs index f9c7f1b10f..5b21fdfa77 100644 --- a/wgpu/examples/water/main.rs +++ b/wgpu/examples/water/main.rs @@ -187,7 +187,7 @@ impl Example { let texture_extent = wgpu::Extent3d { width: sc_desc.width, height: sc_desc.height, - depth: 1, + depth_or_array_layers: 1, }; let reflection_texture = device.create_texture(&wgpu::TextureDescriptor { diff --git a/wgpu/src/backend/web.rs b/wgpu/src/backend/web.rs index 81d04017f0..46513edfe6 100644 --- a/wgpu/src/backend/web.rs +++ b/wgpu/src/backend/web.rs @@ -736,7 +736,7 @@ fn map_vertex_state_descriptor( fn map_extent_3d(extent: wgt::Extent3d) -> web_sys::GpuExtent3dDict { let mut mapped = web_sys::GpuExtent3dDict::new(); - mapped.depth(extent.depth); + mapped.depth(extent.depth_or_array_layers); mapped.height(extent.height); mapped.width(extent.width); mapped diff --git a/wgpu/src/util/device.rs b/wgpu/src/util/device.rs index 3ac9296304..dff6423674 100644 --- a/wgpu/src/util/device.rs +++ b/wgpu/src/util/device.rs @@ -78,9 +78,9 @@ impl DeviceExt for crate::Device { (1, desc.size) } else { ( - desc.size.depth, + desc.size.depth_or_array_layers, crate::Extent3d { - depth: 1, + depth_or_array_layers: 1, ..desc.size }, ) @@ -105,7 +105,7 @@ impl DeviceExt for crate::Device { let height_blocks = mip_physical.height / format_info.block_dimensions.1 as u32; let bytes_per_row = width_blocks * format_info.block_size as u32; - let data_size = bytes_per_row * height_blocks * mip_extent.depth; + let data_size = bytes_per_row * height_blocks * mip_extent.depth_or_array_layers; let end_offset = binary_offset + data_size as usize;