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

Handle 0 height in prepare_bloom_textures #14423

Merged
merged 1 commit into from
Jul 26, 2024

Conversation

NiseVoid
Copy link
Contributor

Objective

  • Fix a confusing panic when the viewport width is non-zero and the height is 0, prepare_bloom_textures tries to create a 4294967295x1 texture.

Solution

  • Avoid dividing by zero
  • Apps still crash after this, but now on a more reasonable error about the zero-size viewport

Testing

  • I isolated and tested the math. A height of 0 sets mip_height_ratio to inf, causing the width to explode if it isn't also 0

@NiseVoid NiseVoid added A-Rendering Drawing game state to the screen S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jul 21, 2024
@NiseVoid NiseVoid added this to the 0.14.1 milestone Jul 21, 2024
@NiseVoid NiseVoid added the D-Straightforward Simple bug fixes and API improvements, docs, test and examples label Jul 21, 2024
@mockersf mockersf added this pull request to the merge queue Jul 26, 2024
Merged via the queue into bevyengine:main with commit a8003b4 Jul 26, 2024
26 checks passed
mockersf pushed a commit that referenced this pull request Aug 2, 2024
# Objective

- Fix a confusing panic when the viewport width is non-zero and the
height is 0, `prepare_bloom_textures` tries to create a `4294967295x1`
texture.

## Solution

- Avoid dividing by zero
- Apps still crash after this, but now on a more reasonable error about
the zero-size viewport

## Testing

- I isolated and tested the math. A height of 0 sets `mip_height_ratio`
to `inf`, causing the width to explode if it isn't also 0
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 D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants