779: Update wgpu depth_or_array_layers r=kvark a=kvark

Based on https://github.com/gfx-rs/wgpu/pull/1241

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
This commit is contained in:
bors[bot]
2021-03-02 04:26:42 +00:00
committed by GitHub
11 changed files with 24 additions and 33 deletions

View File

@@ -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"

View File

@@ -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

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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());

View File

@@ -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 {

View File

@@ -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

View File

@@ -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;