Repository navigation
BCPack: keep all 32 indices in the first BC7 dictionary entry - #374
Open
davutsimsekk wants to merge 1 commit into
Open
davutsimsekk wants to merge 1 commit into
davutsimsekk wants to merge 1 commit into
Conversation
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.
BCPack's BC7 dictionary stores 255 entries. Entry 0 has its 32
i16indices immediately after the two bit-width bytes; every later entry repeats the width bytes first.Tables::parseskipped au16for every entry, so entry 0 read index 0 as the width field and shifted all its indices by one.pickcan referencedictionary[0](for example a block whose restored index is 0), so this produced wrong BC7 indices for those blocks.This keeps the width skip only for entries after the first.
Test
bc7_first_dictionary_entry_keeps_all_32_indicesbuilds the table with entry 0's width bytes and indices 2, 1, and asserts the parsed entry keepsix[0][0] == 2andix[0][1] == 1. Onmainthe first value is 0.cargo test -p victory-formats --lib: 25 passed, 0 failed, 4 ignoredcargo clippy -p victory-formats --all-targets --locked -- -D warnings: cleanrustfmt --edition 2024 --check crates/victory-formats/src/bcpack.rs: clean