Skip to content

Fix array stride calculation for small mip levels - #6

Merged
mikedilger merged 1 commit into
SiegeEngine:masterfrom
w-flo:fix_array_stride_calculation
Oct 29, 2021
Merged

Fix array stride calculation for small mip levels#6
mikedilger merged 1 commit into
SiegeEngine:masterfrom
w-flo:fix_array_stride_calculation

Conversation

@w-flo

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

Copy link
Copy Markdown
Contributor

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