Skip to content

Commit

Permalink
Fixed crash when wgpu tries to read past image data for dds skybox re…
Browse files Browse the repository at this point in the history
… undoing a pre- ddsfile:0.5.2 workaround
  • Loading branch information
Hexorg committed Mar 20, 2024
1 parent ed44eb3 commit 510e35d
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions crates/bevy_render/src/texture/dds.rs
Expand Up @@ -24,23 +24,22 @@ pub fn dds_buffer_to_image(
}
let mut image = Image::default();
let is_cubemap = dds.header.caps2.contains(Caps2::CUBEMAP);
let mut depth_or_array_layers = if dds.get_num_array_layers() > 1 {
let depth_or_array_layers = if dds.get_num_array_layers() > 1 {
dds.get_num_array_layers()
} else {
dds.get_depth()
};
if is_cubemap {
if !dds.header.caps2.contains(
if is_cubemap
&& !dds.header.caps2.contains(
Caps2::CUBEMAP_NEGATIVEX
| Caps2::CUBEMAP_NEGATIVEY
| Caps2::CUBEMAP_NEGATIVEZ
| Caps2::CUBEMAP_POSITIVEX
| Caps2::CUBEMAP_POSITIVEY
| Caps2::CUBEMAP_POSITIVEZ,
) {
return Err(TextureError::IncompleteCubemap);
}
depth_or_array_layers *= 6;
)
{
return Err(TextureError::IncompleteCubemap);
}
image.texture_descriptor.size = Extent3d {
width: dds.get_width(),
Expand Down

0 comments on commit 510e35d

Please sign in to comment.