Add new ImageLoaderSettings member for loading as stacked 2d array#20536
Closed
KirmesBude wants to merge 4 commits into
Closed
Add new ImageLoaderSettings member for loading as stacked 2d array#20536KirmesBude wants to merge 4 commits into
KirmesBude wants to merge 4 commits into
Conversation
alice-i-cecile
approved these changes
Aug 12, 2025
Member
|
Very nice! |
abe31c6 to
13a4d42
Compare
Contributor
Author
|
I also changed the tilemap example. I see one use of |
KirmesBude
commented
Aug 18, 2025
| })?; | ||
|
|
||
| if let Some(layers) = settings.layers { | ||
| image.reinterpret_stacked_2d_as_array(layers.into()); |
Contributor
Author
There was a problem hiding this comment.
I just realized this actually panics. So I want to change this so it returns a Result, but I am not sure if I should keep the panicing version? Is there any benefit to it?
Member
There was a problem hiding this comment.
Please swap it to return a Result. Panicking APIs are only worth it when the operation is extremely common and the panics are extremely rare. Neither is the case here :)
This was referenced Aug 30, 2025
Merged
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Oct 6, 2025
…w return a Result (#20797) # Objective Remove panics from image reinterpretation methods. ## Solution Introduce new errors and emit those instead of panicking. ## Testing - Did you test these changes? If so, how? - CI + changed examples - Are there any parts that need more testing? - No - How can other people (reviewers) test your changes? Is there anything specific they need to know? - examples, no - If relevant, what platforms did you test these changes on, and are there any important ones you can't test? - linux, amd cpu, amd gpu --- Moved out of #20536 --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
tigregalis
pushed a commit
to tigregalis/bevy
that referenced
this pull request
Oct 7, 2025
…w return a Result (bevyengine#20797) # Objective Remove panics from image reinterpretation methods. ## Solution Introduce new errors and emit those instead of panicking. ## Testing - Did you test these changes? If so, how? - CI + changed examples - Are there any parts that need more testing? - No - How can other people (reviewers) test your changes? Is there anything specific they need to know? - examples, no - If relevant, what platforms did you test these changes on, and are there any important ones you can't test? - linux, amd cpu, amd gpu --- Moved out of bevyengine#20536 --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
mate-h
pushed a commit
to mate-h/bevy
that referenced
this pull request
Oct 22, 2025
…w return a Result (bevyengine#20797) # Objective Remove panics from image reinterpretation methods. ## Solution Introduce new errors and emit those instead of panicking. ## Testing - Did you test these changes? If so, how? - CI + changed examples - Are there any parts that need more testing? - No - How can other people (reviewers) test your changes? Is there anything specific they need to know? - examples, no - If relevant, what platforms did you test these changes on, and are there any important ones you can't test? - linux, amd cpu, amd gpu --- Moved out of bevyengine#20536 --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Loading images for use as texture 2d array is tedious and should be supported in the context of loading the asset.
Partially fixes #17145
Solution
Add a new
layersmember toImageLoaderSettingswhich determines if and how we callreinterpret_stacked_2d_as_arrayduring asset loading.Testing
array_textureexampleShowcase
I believe the changes in
examples/shader/array_texture.rsshow quite well how this is nicer to work with.