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

Update image requirement from 0.24 to 0.25 #12458

Merged
merged 5 commits into from
Mar 29, 2024

Conversation

mnmaita
Copy link
Member

@mnmaita mnmaita commented Mar 13, 2024

Objective

Solution

  • Refactored code that was changed/deprecated in image 0.25.
  • Please review this PR carefully since I'm just making the changes without any context or deep knowledge of the module.

@SolarLiner SolarLiner added C-Dependencies A change to the crates that Bevy depends on A-Rendering Drawing game state to the screen labels Mar 13, 2024
Copy link
Contributor

@rparrett rparrett left a comment

Choose a reason for hiding this comment

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

I think there are a few issues here:

  • read_image needs a buffer sized to total_bytes (not just with that capacity)
  • The code that was adding alpha back into the image data is still needed if we are returning a TextureFormat::Rgba32Float. The hdr format never has an alpha channel.

There's an .hdr file in the assets folder you can test with -- modify examples/2d/sprite.rs to load textures/spiaggia_di_mondello_1k.hdr.

@mnmaita
Copy link
Member Author

mnmaita commented Mar 13, 2024

I think there are a few issues here:

  • read_image needs a buffer sized to total_bytes (not just with that capacity)
  • The code that was adding alpha back into the image data is still needed if we are returning a TextureFormat::Rgba32Float. The hdr format never has an alpha channel.

There's an .hdr file in the assets folder you can test with -- modify examples/2d/sprite.rs to load textures/spiaggia_di_mondello_1k.hdr.

Thanks a lot for the review, I needed some guidance here. I'll take a look at these issues and push some updates later.

dependabot bot and others added 2 commits March 28, 2024 02:51
Updates the requirements on [image](https://github.com/image-rs/image) to permit the latest version.
- [Changelog](https://github.com/image-rs/image/blob/main/CHANGES.md)
- [Commits](image-rs/image@v0.24.0...v0.25.0)

---
updated-dependencies:
- dependency-name: image
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
@mnmaita
Copy link
Member Author

mnmaita commented Mar 28, 2024

@rparrett I managed to make changes so the example you've provided would load that HDR image properly. Please check if what I'm doing now is correct; I'm still unsure if I'm sizing the data buffer properly.

Also, I'd appreciate some input on the error messages since I'm not convinced on how I wrote them.

@mnmaita mnmaita requested a review from rparrett March 28, 2024 03:46
Copy link
Contributor

@rparrett rparrett left a comment

Choose a reason for hiding this comment

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

Nice. Looks good to me and seems to work.

@matiqo15 matiqo15 added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Mar 28, 2024
Copy link
Contributor

@bushrat011899 bushrat011899 left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@james7132 james7132 enabled auto-merge March 29, 2024 06:30
@james7132 james7132 added this pull request to the merge queue Mar 29, 2024
Merged via the queue into bevyengine:main with commit 1b7837c Mar 29, 2024
31 checks passed
@mnmaita mnmaita deleted the image-0.25 branch March 30, 2024 13:27
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-Dependencies A change to the crates that Bevy depends on S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants