gg: always use 4 channels in init_sokol_image #16564
Merged
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.
Fixes vlang/vab#239
Will probably obsolete #16561
At some point
init_sokol_image()
was changed to use the number of channels detected by stbi instead of the hardcoded4
. While this should've been a good idea, and the most logical thing to do - reality is a little different. sokol_gl expects.rgba8
/4 channels in it's default contexts, whichgg
currently also uses when loading images. This PR set the number of channels back where it came from and leaves a more juicy note for next time :)I don't think it's a good idea to manipulate the channel number like this in unexpected places:
https://github.com/vlang/v/pull/15981/files#diff-3566edbb636a40b3c608bb8b51fb2403f57929e1626e96f39ccb7256f0573a99R121
The correct channel info is nice to have in other situations - the "problem" is the sokol_gl default contexts which expects 4 channels. So I've removed the ugly workaround in this PR as well
I guess this is a good reason to look at getting
v gret
visual tests up and running for Android/vab
as well...I've tested the PR against the images provided in #16024 with the image viewer also - they all load and work except for
basn3p08.png
andbasn3p08.gif
which also both fail to load in GIMP.