Fix array stride calculation for small mip levels - #6
Merged
mikedilger merged 1 commit intoOct 29, 2021
Conversation
The next mipmap level of a 16x4 texture does not take up 1/4 the number of bytes when using block compression. It takes up half the number of bytes, because 8x2 textures are stored as two blocks (total dimensions of 8x4 where half of those stored pixels are ignored). This is more than the "min mipmap size" so the calculation would give an incorrect result previously. Fixes SiegeEngine#5.
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.
This works for me, as far as I can tell. However I feel a bit uneasy about the fact that the
public fn get_array_stride()never takes the linear_size into account now, while it did so previously throughself.get_main_texture_size(). Maybe that's alright though? I don't have a lot of different dds files to see if it breaks anything and don't really know the details of the format well enough, and there are no unit or integration tests as far as I can tell.The next mipmap level of a 16x4 texture does not take up 1/4 the number
of bytes when using block compression. It takes up half the number of
bytes, because 8x2 textures are stored as two blocks (total dimensions
of 8x4 where half of those stored pixels are ignored). This is more than
the "min mipmap size" so the calculation would give an incorrect result
previously.
Fixes #5.