Skip to content

Handle 0 height in prepare_bloom_textures#14423

Merged
mockersf merged 1 commit intobevyengine:mainfrom
NiseVoid:handle_0_size_in_bloom
Jul 26, 2024
Merged

Handle 0 height in prepare_bloom_textures#14423
mockersf merged 1 commit intobevyengine:mainfrom
NiseVoid:handle_0_size_in_bloom

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
@NiseVoid NiseVoid force-pushed the handle_0_size_in_bloom branch from 57ae2c4 to 4c5cc14 Compare July 26, 2024 14:00
@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
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