diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index d742ee83fb..e984aef7c4 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -55,7 +55,7 @@ fn own_label(label: &Label) -> String { } pub const MAX_COLOR_TARGETS: usize = 4; -pub const MAX_MIP_LEVELS: usize = 16; +pub const MAX_MIP_LEVELS: u32 = 16; pub const MAX_VERTEX_BUFFERS: usize = 16; pub const MAX_ANISOTROPY: u8 = 16; pub const SHADER_STAGE_COUNT: usize = 3; @@ -478,7 +478,7 @@ impl Device { let aspects = format.surface_desc().aspects; let usage = conv::map_texture_usage(desc.usage, aspects); - let mip_level_count = desc.mip_level_count as usize; + let mip_level_count = desc.mip_level_count; if mip_level_count >= MAX_MIP_LEVELS { return Err(CreateTextureError::InvalidMipLevelCount(mip_level_count)); } @@ -3055,5 +3055,5 @@ pub enum CreateTextureError { "texture descriptor mip level count ({0}) must be less than device max mip levels ({})", MAX_MIP_LEVELS )] - InvalidMipLevelCount(usize), + InvalidMipLevelCount(u32), } diff --git a/wgpu-core/src/track/texture.rs b/wgpu-core/src/track/texture.rs index b340a11b2b..4d55571b83 100644 --- a/wgpu-core/src/track/texture.rs +++ b/wgpu-core/src/track/texture.rs @@ -14,7 +14,7 @@ type PlaneStates = RangedStates>; #[derive(Clone, Debug, Default, PartialEq)] pub(crate) struct TextureState { - mips: ArrayVec<[PlaneStates; MAX_MIP_LEVELS]>, + mips: ArrayVec<[PlaneStates; MAX_MIP_LEVELS as usize]>, /// True if we have the information about all the subresources here full: bool, }