diff options
Diffstat (limited to 'wgpu/src/image/atlas.rs')
-rw-r--r-- | wgpu/src/image/atlas.rs | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/wgpu/src/image/atlas.rs b/wgpu/src/image/atlas.rs index 660ebe44..4855fa4a 100644 --- a/wgpu/src/image/atlas.rs +++ b/wgpu/src/image/atlas.rs @@ -4,6 +4,8 @@ mod allocation; mod allocator; mod layer; +use std::num::NonZeroU32; + pub use allocation::Allocation; pub use entry::Entry; pub use layer::Layer; @@ -24,7 +26,7 @@ impl Atlas { let extent = wgpu::Extent3d { width: SIZE, height: SIZE, - depth: 1, + depth_or_array_layers: 1, }; let texture = device.create_texture(&wgpu::TextureDescriptor { @@ -294,19 +296,19 @@ impl Atlas { let extent = wgpu::Extent3d { width, height, - depth: 1, + depth_or_array_layers: 1, }; encoder.copy_buffer_to_texture( - wgpu::BufferCopyView { + wgpu::ImageCopyBuffer { buffer, - layout: wgpu::TextureDataLayout { + layout: wgpu::ImageDataLayout { offset: offset as u64, - bytes_per_row: 4 * image_width + padding, - rows_per_image: image_height, + bytes_per_row: NonZeroU32::new(4 * image_width + padding), + rows_per_image: NonZeroU32::new(image_height), }, }, - wgpu::TextureCopyView { + wgpu::ImageCopyTexture { texture: &self.texture, mip_level: 0, origin: wgpu::Origin3d { @@ -334,7 +336,7 @@ impl Atlas { size: wgpu::Extent3d { width: SIZE, height: SIZE, - depth: self.layers.len() as u32, + depth_or_array_layers: self.layers.len() as u32, }, mip_level_count: 1, sample_count: 1, @@ -355,7 +357,7 @@ impl Atlas { } encoder.copy_texture_to_texture( - wgpu::TextureCopyView { + wgpu::ImageCopyTexture { texture: &self.texture, mip_level: 0, origin: wgpu::Origin3d { @@ -364,7 +366,7 @@ impl Atlas { z: i as u32, }, }, - wgpu::TextureCopyView { + wgpu::ImageCopyTexture { texture: &new_texture, mip_level: 0, origin: wgpu::Origin3d { @@ -376,7 +378,7 @@ impl Atlas { wgpu::Extent3d { width: SIZE, height: SIZE, - depth: 1, + depth_or_array_layers: 1, }, ); } |