mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Fix invalid mip level count check
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user