File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,7 @@ the same every time it is rendered, we now warn if it is missing.
113
113
- Validate the number of color attachments in ` create_render_pipeline ` by @nical in [ #2913 ] ( https://github.com/gfx-rs/wgpu/pull/2913 )
114
114
- Validate against the maximum binding index in ` create_bind_group_layout ` by @nical in [ #2892 ] ( https://github.com/gfx-rs/wgpu/pull/2892 )
115
115
- Validate that map_async's range is not negative by @nical in [ #2938 ] ( https://github.com/gfx-rs/wgpu/pull/2938 )
116
+ - Fix calculation/validation of layer/mip ranges in create_texture_view by @nical in [ #2955 ] ( https://github.com/gfx-rs/wgpu/pull/2955 )
116
117
- Validate the sample count and mip level in ` copy_texture_to_buffer ` by @nical in [ #2958 ] ( https://github.com/gfx-rs/wgpu/pull/2958 )
117
118
118
119
#### DX12
Original file line number Diff line number Diff line change @@ -948,18 +948,21 @@ impl<A: HalApi> Device<A> {
948
948
} ,
949
949
} ;
950
950
951
- let required_level_count =
952
- desc. range . base_mip_level + desc. range . mip_level_count . map_or ( 1 , |count| count. get ( ) ) ;
951
+ let mip_count = desc. range . mip_level_count . map_or ( 1 , |count| count. get ( ) ) ;
952
+ let required_level_count = desc. range . base_mip_level . saturating_add ( mip_count) ;
953
+
953
954
let required_layer_count = match desc. range . array_layer_count {
954
- Some ( count) => desc. range . base_array_layer + count. get ( ) ,
955
+ Some ( count) => desc. range . base_array_layer . saturating_add ( count. get ( ) ) ,
955
956
None => match view_dim {
956
957
wgt:: TextureViewDimension :: D1
957
958
| wgt:: TextureViewDimension :: D2
958
959
| wgt:: TextureViewDimension :: D3 => 1 ,
959
960
wgt:: TextureViewDimension :: Cube => 6 ,
960
961
_ => texture. desc . array_layer_count ( ) ,
961
- } ,
962
+ }
963
+ . max ( desc. range . base_array_layer . saturating_add ( 1 ) ) ,
962
964
} ;
965
+
963
966
let level_end = texture. full_range . mips . end ;
964
967
let layer_end = texture. full_range . layers . end ;
965
968
if required_level_count > level_end {
You can’t perform that action at this time.
0 commit comments