Skip to content

CompressedImageSaver revamp redux#24223

Merged
alice-i-cecile merged 65 commits into
bevyengine:mainfrom
JMS55:compressed-image-saver3
Jul 7, 2026
Merged

CompressedImageSaver revamp redux#24223
alice-i-cecile merged 65 commits into
bevyengine:mainfrom
JMS55:compressed-image-saver3

Conversation

@JMS55

@JMS55 JMS55 commented May 9, 2026

Copy link
Copy Markdown
Contributor

Redo of #23567 but with:

  • Better normal map handling
  • Better mipmap generation
  • Web assets
  • Fixed docs

Comment thread crates/bevy_image/src/compressed_image_saver/mod.rs

@greeble-dev greeble-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Added some small suggestions. I don't feel I can click approve because my experience with texture compression is limited.

Comment thread crates/bevy_image/src/compressed_image_saver/ctt_helpers.rs
Comment thread crates/bevy_image/src/compressed_image_saver/ctt.rs Outdated
Comment thread _release-content/migration-guides/compressed_image_saver.md Outdated
Comment thread _release-content/release-notes/compressed_image_saver.md Outdated
@JMS55
JMS55 requested review from beicause and greeble-dev June 24, 2026 23:31
Comment thread crates/bevy_image/src/image.rs Outdated
>>("png");
>>(crate::CompressedImageSaver::default().into());

for file_extension in ImageLoader::SUPPORTED_FILE_EXTENSIONS {

@greeble-dev greeble-dev Jun 25, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I saw that the PR originally just did PNG and JPEG, but it was then changed to SUPPORTED_FILE_EXTENSIONS. I think the last change breaks processing as its tries and fails to compress already compressed textures.

ERROR bevy_asset::processor: Failed to process asset environment_maps\sky_skybox.ktx2:
Encountered an error while saving the asset: Expected texture_descriptor.mip_level_count to be 1
ERROR bevy_asset::processor: Failed to process asset textures\Ryfjallet_cubemap_bc7.ktx2:
Encountered an error while saving the asset: Unsupported texture format for compression: Bc7RgbaUnormSrgb   

I guess it needs a smarter processor that can pass through already compressed textures? But I'd click approve on this PR if it went back to hard coded PNG/JPEG or exposed a setting - seems good enough for the short term.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The processor can be a separate plugin exposing the setting. I don't think it should belong to ImagePlugin.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@greeble-dev why is it running for those assets? It should be running only if you set the meta file up for an asset, I thought...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This code sets a default processor, which runs automatically if an asset doesn't have a meta file.

@beicause

Copy link
Copy Markdown
Member

I'm on the fence. My concern is mainly about the current limitations of bevy's asset system, as someone used to Godot's resource loader/saver/importer.

Using env variables and the cargo feature to control BC/ASTC/BasisU output is kind of bad (Ideally, it should be extendable and be able to output all and load one at runtime). TBH, this isn't much more convenient than writing your own script or cargo xtask to process assets if you want to export your project to run on mobile.

And it currently doesn't support hdr/exr images (My proposal is #24224).

@greeble-dev

Copy link
Copy Markdown
Contributor

I would click approve as long as #24223 (comment) is sorted and no new issues are raised - I think this PR is enough of a step forward and lays the foundations for future work. I agree that processing is currently awkward, but that's more to do with the asset processor itself (e.g. no story for glTF embedded textures, no standard for platform specific processing).

@JMS55

JMS55 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@beicause I defiently understand your concerns. I'm not a huge fan of the way this PR turned out either. But it's at least something to get us started.

We probably need larger asset system changes to get this working better.

@greeble-dev greeble-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm clicking approve with a couple of caveats:

  • I don't know much about texture compression, so I couldn't meaningfully review the details.
  • Using the compression image saver in practice is still a bit awkward, particularly with processing. But this PR is good progress.

@andriyDev andriyDev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! Excited to see this!

@andriyDev andriyDev added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jun 29, 2026
@alice-i-cecile alice-i-cecile added M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide M-Release-Note Work that should be called out in the blog due to impact labels Jul 7, 2026
@alice-i-cecile
alice-i-cecile added this pull request to the merge queue Jul 7, 2026
Merged via the queue into bevyengine:main with commit 0539e4d Jul 7, 2026
48 checks passed
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in Assets Jul 7, 2026
@greeble-dev

Copy link
Copy Markdown
Contributor

I've filed #24903 to capture some of the issues raised during review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Assets Load files from disk to use for things like images, models, and sounds C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide M-Release-Note Work that should be called out in the blog due to impact 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.

6 participants