mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
Fix invalid mip level count check
This commit is contained in:
parent
68bf10a3a5
commit
2ee07a2a47
@ -515,7 +515,10 @@ impl<B: GfxBackend> Device<B> {
|
||||
let usage = conv::map_texture_usage(desc.usage, aspects);
|
||||
|
||||
let mip_level_count = desc.mip_level_count;
|
||||
if mip_level_count == 0 && mip_level_count > kind.compute_num_levels() as u32 {
|
||||
if mip_level_count == 0
|
||||
|| mip_level_count > MAX_MIP_LEVELS
|
||||
|| mip_level_count > kind.compute_num_levels() as u32
|
||||
{
|
||||
return Err(resource::CreateTextureError::InvalidMipLevelCount(
|
||||
mip_level_count,
|
||||
));
|
||||
|
||||
@ -239,7 +239,7 @@ pub enum CreateTextureError {
|
||||
CannotCopyD24Plus,
|
||||
#[error(transparent)]
|
||||
InvalidDimension(#[from] TextureDimensionError),
|
||||
#[error("texture descriptor mip level count ({0}) must be less than `MAX_MIP_LEVELS`")]
|
||||
#[error("texture descriptor mip level count ({0}) is invalid")]
|
||||
InvalidMipLevelCount(u32),
|
||||
#[error("Feature {0:?} must be enabled to create a texture of type {1:?}")]
|
||||
MissingFeature(wgt::Features, wgt::TextureFormat),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user