fix(core): don't crash when end bound calc. of TooMany{MipLevels,ArrayLayers} overflows

This commit is contained in:
Erich Gubler authored and Connor Fitzgerald committed 2026-03-25 13:06:23 -04:00
1 parent 591ad3ddfc
commit 99ffaea4cd
2 files changed
+8 -6

No files matched your search

+4
View File
@@ -81,6 +81,10 @@ Bottom level categories:
- Added guards to avoid calling some feature detection methods that are not implemented on `CaptureMTLDevice`. By @andyleiserson in [#9284](https://github.com/gfx-rs/wgpu/pull/9284).
#### Validation
- Don't crash in the `Display` implementation of `CreateTextureViewError::TooMany{MipLevels,ArrayLayers}` when their base and offset overflow. By @ErichDonGubler in [#8808](https://github.com/gfx-rs/wgpu/pull/8808).
## v29.0.0 (2026-03-18)
### Major Changes
+4 -6
View File
@@ -1838,9 +1838,8 @@ pub enum CreateTextureViewError {
#[error("Array layer count is 0")]
ZeroArrayLayerCount,
#[error(
"`TextureView` spans mip levels [{base_mip_level}, {end_mip_level}) \
(`mipLevelCount` {mip_level_count}) but the texture view only has {total} total mip levels",
end_mip_level = base_mip_level + mip_level_count
"`TextureView` starts at mip level {base_mip_level} and spans {mip_level_count} mip \
levels, but the texture view only has {total} total mip levels"
)]
TooManyMipLevels {
base_mip_level: u32,
@@ -1848,9 +1847,8 @@ pub enum CreateTextureViewError {
total: u32,
},
#[error(
"`TextureView` spans array layers [{base_array_layer}, {end_array_layer}) \
(`arrayLayerCount` {array_layer_count}) but the texture view only has {total} total layers",
end_array_layer = base_array_layer + array_layer_count
"`TextureView` starts at array layer {base_array_layer} and spans {array_layer_count}) \
array layers, but the texture view only has {total} total layers"
)]
TooManyArrayLayers {
base_array_layer: u32,