Skip to content

Commit e5180aa

Browse files
fix(core): don't crash when end bound calc. of TooMany{MipLevels,ArrayLayers} overflows
1 parent 4e30a92 commit e5180aa

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ Bottom level categories:
4848

4949
- Fix limit comparison logic for `max_inter_stage_shader_variables` By @ErichDonGubler in [9264](https://github.com/gfx-rs/wgpu/pull/9264).
5050

51+
#### Validation
52+
53+
- 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).
54+
5155
## v29.0.0 (2026-03-18)
5256

5357
### Major Changes

wgpu-core/src/resource.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,19 +1838,17 @@ pub enum CreateTextureViewError {
18381838
#[error("Array layer count is 0")]
18391839
ZeroArrayLayerCount,
18401840
#[error(
1841-
"`TextureView` spans mip levels [{base_mip_level}, {end_mip_level}) \
1842-
(`mipLevelCount` {mip_level_count}) but the texture view only has {total} total mip levels",
1843-
end_mip_level = base_mip_level + mip_level_count
1841+
"`TextureView` starts at mip level {base_mip_level} and spans {mip_level_count} mip \
1842+
levels, but the texture view only has {total} total mip levels"
18441843
)]
18451844
TooManyMipLevels {
18461845
base_mip_level: u32,
18471846
mip_level_count: u32,
18481847
total: u32,
18491848
},
18501849
#[error(
1851-
"`TextureView` spans array layers [{base_array_layer}, {end_array_layer}) \
1852-
(`arrayLayerCount` {array_layer_count}) but the texture view only has {total} total layers",
1853-
end_array_layer = base_array_layer + array_layer_count
1850+
"`TextureView` starts at array layer {base_array_layer} and spans {array_layer_count}) \
1851+
array layers, but the texture view only has {total} total layers"
18541852
)]
18551853
TooManyArrayLayers {
18561854
base_array_layer: u32,

0 commit comments

Comments
 (0)