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

Allow Image to be created without data #17746

Closed
tychedelia opened this issue Feb 8, 2025 · 1 comment
Closed

Allow Image to be created without data #17746

tychedelia opened this issue Feb 8, 2025 · 1 comment
Labels
A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes

Comments

@tychedelia
Copy link
Contributor

What problem does this solve or what need does it fill?

Currently, the RenderAsset implementation for GpuImage unconditionally calls create_texture_with_data. This is unhelpful for creating textures that are intended to be filled in on the GPU, for example during a compute pass that runs prior to rendering.

What solution would you like?

ShaderStorageBufffer already has a similar solution where different constructors are provided with/without data. Do the same for Image and determine whether we need to create a texture with data based on the presence of data in Image.

@tychedelia tychedelia added A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes labels Feb 8, 2025
github-merge-queue bot pushed a commit that referenced this issue Feb 10, 2025
…17760)

# Objective
#17746
## Solution
- Change `Image.data` from being a `Vec<u8>` to a `Option<Vec<u8>>`
- Added functions to help with creating images
## Testing

- Did you test these changes? If so, how?
All current tests pass
Tested a variety of existing examples to make sure they don't crash
(they don't)
- If relevant, what platforms did you test these changes on, and are
there any important ones you can't test?
Linux x86 64-bit NixOS 
---
## Migration Guide
Code that directly access `Image` data will now need to use unwrap or
handle the case where no data is provided.
Behaviour of new_fill slightly changed, but not in a way that is likely
to affect anything. It no longer panics and will fill the whole texture
instead of leaving black pixels if the data provided is not a nice
factor of the size of the image.

---------

Co-authored-by: IceSentry <[email protected]>
@Lege19
Copy link
Contributor

Lege19 commented Feb 11, 2025

this can probably be closed now

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-Feature A new feature, making something new possible D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes
Projects
None yet
Development

No branches or pull requests

2 participants