Update stb-image port version and improve StbImageLoader#2772
Merged
Conversation
Agent-Logs-Url: https://github.com/jMonkeyEngine/jmonkeyengine/sessions/06d3e2b9-a0ea-4a94-b058-73910f64df28 Co-authored-by: riccardobl <4943530+riccardobl@users.noreply.github.com>
…tbImageLoader Agent-Logs-Url: https://github.com/jMonkeyEngine/jmonkeyengine/sessions/06d3e2b9-a0ea-4a94-b058-73910f64df28 Co-authored-by: riccardobl <4943530+riccardobl@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix AssetLoadException in TestQ3 crash
Fix StbImageLoader crash on TGA images (channels=0 from info())
May 12, 2026
Member
|
@copilot this was actually a bug in the java port of stb-image, it is now fixed in version 2.30.5 , please update the library and remove your workaround. Keep other fixes and tests |
Agent-Logs-Url: https://github.com/jMonkeyEngine/jmonkeyengine/sessions/5423734c-78c5-402f-b5b4-4cd189354a46 Co-authored-by: riccardobl <4943530+riccardobl@users.noreply.github.com>
Contributor
Author
Done in a2755a4. Updated stb-image to 2.30.5 and removed the |
Copilot
AI
changed the title
Fix StbImageLoader crash on TGA images (channels=0 from info())
Fix StbImageLoader crash on TGA images
May 12, 2026
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.
TgaDecoder.info()in the stb-image library never set thechannelsfield — it was only populated insideload(). This causedinfo.getChannels()to return0for all TGA images, hitting thedefault:branch ofStbImageLoader's switch and throwingIOException: Unsupported number of channels: 0, crashing any app that loads a TGA texture (e.g. TestQ3). This bug has been fixed upstream in stb-image 2.30.5.Changes
gradle/libs.versions.toml: Updated stb-image dependency from2.30.4to2.30.5, which contains the upstream fix forTgaDecoder.info()not populatingchannels.selectFormat()helper (new): Extracted the channel-count →Image.Formatmapping into a shared private static method, replacing the original inline switch blocks and improving maintainability.convertImageData(): UseimgData.getChannels()(actual output count) instead ofimgData.getRequestedChannels()when computingsampleCountfor 16-bit/float conversion.StbImageLoaderTest: Regression tests for 24-bit RGB TGA (RGB8) and 8-bit grayscale TGA (Luminance8).