Skip to content

Commit da6a165

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

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ By @kpreid in [#9042](https://github.com/gfx-rs/wgpu/pull/9042).
303303
- Reject non-constructible types (runtime- and override-sized arrays, and structs containing non-constructible types) in more places where they should not be allowed. By @andyleiserson in [#8873](https://github.com/gfx-rs/wgpu/pull/8873).
304304
- The query set type for an occlusion query is now validated when opening the render pass, in addition to within the call to `beginOcclusionQuery`. By @andyleiserson in [#9086](https://github.com/gfx-rs/wgpu/pull/9086).
305305
- Require that the blend factor is `One` when the blend operation is `Min` or `Max`. The `BlendFactorOnUnsupportedTarget` error is now reported within `ColorStateError` rather than directly in `CreateRenderPipelineError`. By @andyleiserson in [#9110](https://github.com/gfx-rs/wgpu/pull/9110).
306+
- 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).
306307

307308
#### Vulkan
308309

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)