mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[rs] Merge #496
496: Replace u32 with NonZeroU32 in TextureView r=kvark a=kunalmohan Includes https://github.com/gfx-rs/wgpu/pull/865 Co-authored-by: Kunal Mohan <kunalmohan99@gmail.com>
This commit is contained in:
@@ -27,14 +27,14 @@ vulkan-portability = ["wgc/gfx-backend-vulkan"]
|
||||
package = "wgpu-core"
|
||||
version = "0.5"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "78546f410da6c3d48152c8b7d2cf3799babf956b"
|
||||
rev = "8057acf120f9944056a6b5de6cf326f18ae7671d"
|
||||
features = ["raw-window-handle"]
|
||||
|
||||
[dependencies.wgt]
|
||||
package = "wgpu-types"
|
||||
version = "0.5"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "78546f410da6c3d48152c8b7d2cf3799babf956b"
|
||||
rev = "8057acf120f9944056a6b5de6cf326f18ae7671d"
|
||||
|
||||
[dependencies]
|
||||
arrayvec = "0.5"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
mod framework;
|
||||
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use std::borrow::Cow::Borrowed;
|
||||
use std::{borrow::Cow::Borrowed, num::NonZeroU32};
|
||||
use wgpu::util::DeviceExt;
|
||||
|
||||
const TEXTURE_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Rgba8UnormSrgb;
|
||||
@@ -160,7 +160,7 @@ impl Example {
|
||||
dimension: wgpu::TextureViewDimension::D2,
|
||||
aspect: wgpu::TextureAspect::All,
|
||||
base_mip_level: mip,
|
||||
level_count: Some(1),
|
||||
level_count: NonZeroU32::new(1),
|
||||
base_array_layer: 0,
|
||||
array_layer_count: None,
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use std::{borrow::Cow::Borrowed, iter, mem, ops::Range, rc::Rc};
|
||||
use std::{borrow::Cow::Borrowed, iter, mem, num::NonZeroU32, ops::Range, rc::Rc};
|
||||
|
||||
#[path = "../framework.rs"]
|
||||
mod framework;
|
||||
@@ -391,7 +391,7 @@ impl framework::Example for Example {
|
||||
base_mip_level: 0,
|
||||
level_count: None,
|
||||
base_array_layer: i as u32,
|
||||
array_layer_count: Some(1),
|
||||
array_layer_count: NonZeroU32::new(1),
|
||||
}))
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
@@ -1202,11 +1202,11 @@ impl crate::Context for Context {
|
||||
mapped_desc.aspect(map_texture_aspect(d.aspect));
|
||||
mapped_desc.base_array_layer(d.base_array_layer);
|
||||
if let Some(count) = d.array_layer_count {
|
||||
mapped_desc.array_layer_count(count);
|
||||
mapped_desc.array_layer_count(count.get());
|
||||
}
|
||||
mapped_desc.base_mip_level(d.base_mip_level);
|
||||
if let Some(count) = d.level_count {
|
||||
mapped_desc.mip_level_count(count);
|
||||
mapped_desc.mip_level_count(count.get());
|
||||
}
|
||||
// TODO: label
|
||||
texture.0.create_view_with_descriptor(&mapped_desc)
|
||||
|
||||
Reference in New Issue
Block a user