Skip to content
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

Fix array stride calculation for small mip levels #6

Merged
merged 1 commit into from
Oct 29, 2021

Conversation

w-flo
Copy link
Contributor

@w-flo w-flo commented Oct 28, 2021

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 through self.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.

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.
@mikedilger mikedilger merged commit 986c705 into SiegeEngine:master Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

get_array_stride sometimes incorrectly assumes that mip levels have byte-size 1/4 of the previous level
2 participants