Skip to content

use wgpu TextureDataOrder #19829

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

Merged
merged 1 commit into from
Jun 27, 2025
Merged

use wgpu TextureDataOrder #19829

merged 1 commit into from
Jun 27, 2025

Conversation

atlv24
Copy link
Contributor

@atlv24 atlv24 commented Jun 27, 2025

Objective

Solution

  • Use TextureDataOrder

Testing

  • ran some examples that use ktx2 textures, they look fine

@atlv24 atlv24 added A-Rendering Drawing game state to the screen S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it D-Straightforward Simple bug fixes and API improvements, docs, test and examples labels Jun 27, 2025
// Assign the data and fill in the rest of the metadata now the possible
// error cases have been handled
let mut image = Image::default();
image.texture_descriptor.format = texture_format;
image.data = Some(wgpu_data.into_iter().flatten().collect::<Vec<_>>());
image.data = Some(levels.into_iter().flatten().collect::<Vec<_>>());
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't need to block merging imo, but fwiw: when benchmarking on #18411, I found that levels.flatten().collect() suffers from unnecessary vec resizing. Pre-calculating a capacity and using extend was faster.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i noticed you wrote it differently, ive been chopping little bits off of that PR to make it easier to reason about in isolation. i have a rebased version of it locally i've been tracking. just want to get the simplest bits in first basically

@superdump superdump added this pull request to the merge queue Jun 27, 2025
Merged via the queue into bevyengine:main with commit 5fabb53 Jun 27, 2025
39 checks passed
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-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

bevy_image ktx2 reorders data instead of using wgpu MipXLayerYFaceZ
5 participants