-
Notifications
You must be signed in to change notification settings - Fork 17
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
Display mipmap preview levels as tabs instead of using a spinner #80
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plasma has a weird thing where it doesn't actually store data for any levels where the width or height is 2px or smaller.
We can finally account for that here in PrpShop to hide tabs with invalid levels:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, good to know. Is this always the case? I'm trying to make sense of the relevant Plasma code and it seems to be specific to DXT compression. It also reads like small sizes would have some data, just not in the usual format? :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It definitely might be specific to DXT compression. I know that OpenGL rejected those smaller levels as invalid data when I was implementing texture loading for plGLPipeline, and there were enough places in Plasma doing tests against
& 0x03
to make it apparent that something weird was going on with those.We also had to workaround this in korman because of similar issues: https://github.com/H-uru/korman/blob/106ef015480fb3dc0ba3cef90491af042458d58b/korlib/texture.cpp#L80-L91
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going off of memories of yester-year, the issue I most remember running into is Cyan's level size calculation for DXT5 compression being wrong. IIRC for a 2x2 mip level, it only allocates an alpha block but no color block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did some quick research (read: punched "DXT" into Wikipedia). Apparently, DXT operates on blocks of 4x4 pixels, so it makes sense that it can't work for textures that are smaller than that along either axis.
I still can't really follow what the Plasma code is doing in that case. But based on some experimentation and staring at hex dumps of a couple of mipmaps, I think any levels narrower than 4 pixels are simply stored uncompressed.
This quick and dirty patch gives me reasonable results for e. g. Ahnonay's mipmaps. (Well, as reasonable as you can get for a texture that's 1 or 2 pixels wide, anyway. I agree with Deledrius' take in the comment that Hoikas linked.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to handle this case correctly in libHSPlasma. AFAICT, the mipmap levels in question do have image data stored, so we shouldn't hide them entirely. The special handling for the different image data format should go into
DecompressImage
and not here.