vertexcodec: Reintroduce tracing and add roundtrip fuzzing #780
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 change reintroduces TRACE macro to vertex encoder; we used to have tracing code but it was removed in 2020 as the v0 codec was finalized. However, in order to make progress towards v1 codec we need to bring some of it back; this change adds byte tracking back with a more concise but complete summary display, and also adds bit consistency tracking (a bit is considered consistent if it is the same as the last bit in the same position for the entire byte group). Bit consistency tracking helps analyze opportunities where rotation or reorganization of data can improve compression.
Note that tracing relies on global state and is not thread-safe; since it prints data to stdout it's not really useful in a threaded context either way, and the thread safety issues should not cause any runtime issues, just incorrect data aggregation (nor will tracing ever be enabled by default or exposed as an official configuration, so it's mostly moot).
Also add roundtrip fuzzing to the existing codec fuzzer; if we were to implement v1, we would need a way to ensure data is compressed losslessly.
This contribution is sponsored by Valve.