Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed crash when wgpu tries to read past image data for dds skybox #12598

Closed
wants to merge 0 commits into from

Conversation

Hexorg
Copy link
Contributor

@Hexorg Hexorg commented Mar 20, 2024

Objective

Fixes a crash in wgpu-0.19.3/src/util/device.rs:174:26 when it's trying to read past image data... Image is a skybox coming from a dds file.

Solution

Stop bevy from multiplying amount of layers by 6. DDS crate already reads the skybox as 6 layers.

Migration Guide

Any dds skyboxes I can make work with this fix. I'm not sure if there's a reference dds skybox somewhere.

Copy link
Contributor

Welcome, new contributor!

Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨

@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen labels Mar 20, 2024
@Hexorg Hexorg force-pushed the main branch 2 times, most recently from 0fceb99 to 510e35d Compare March 20, 2024 22:05
@Hexorg
Copy link
Contributor Author

Hexorg commented Mar 20, 2024

Here's a sample file that causes a crash before the fix and gets loaded correctly otherwise.
skybox.dds.zip

bestRanar in discord mentioned I should mention ddsfile 0.5.2 - I did in the commit message. That's when number of layers started to be correct.

Copy link
Member

@mockersf mockersf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Hexorg
Copy link
Contributor Author

Hexorg commented Mar 21, 2024

@mockersf done and checked to make sure it still works.

@Hexorg Hexorg closed this Mar 24, 2024
github-merge-queue bot pushed a commit that referenced this pull request Apr 8, 2024
Fixed a bug where skybox ddsfile would crash from wgpu while trying to
read past the file buffer.
Added a unit-test to prevent regression.
Bumped ddsfile dependency version to 0.5.2

# Objective

Prevents a crash when loading dds skybox.

## Solution

ddsfile already automatically sets array layers to be 6 for skyboxes.
Removed bevy's extra *= 6 multiplication.

---

This is a copy of
[#12598](#12598) ... I made that
one off of main and wasn't able to make more pull requests without
making a new branch.

---------

Co-authored-by: François Mockers <francois.mockers@vleue.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants