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

Image::get_color_at and Image::set_color_at: Support 16-bit float values #17550

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

EmbersArc
Copy link
Contributor

Objective

  • Also support f16 values when getting and setting colors.

Solution

  • Use the half crate to work with f16 until it's in stable Rust.

@EmbersArc EmbersArc changed the title Image::get_color_at and `Image::set_color_at: Support 16-bit float values Image::get_color_at and Image::set_color_at: Support 16-bit float values Jan 26, 2025
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen C-Usability A targeted quality-of-life change that makes Bevy easier to use X-Contentious There are nontrivial implications that should be thought through S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jan 26, 2025
@alice-i-cecile
Copy link
Member

Neat! Do GPUs natively support f16 then? I've seen them used for machine learning, but never for rendering before.

Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

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

I like the implementation, and I'm curious to see what people do with this.

@EmbersArc
Copy link
Contributor Author

Do GPUs natively support f16 then?

They do! I'm using them to store height and normal values for terrain textures. Those don't require as much precision and only having to store half as much data compared to f32 is vital because those textures are big.

@alice-i-cecile
Copy link
Member

Oh fancy :D Right, and this sort of thing is also really handy for weird compute shaders that are passing in "images" 😂

@alice-i-cecile
Copy link
Member

Note: the Contentious label is just because this pulls in a new dependency.

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-Usability A targeted quality-of-life change that makes Bevy easier to use S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Contentious There are nontrivial implications that should be thought through
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants