Add opt-in Zstd supercompression for UASTC KTX2 - #103
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opt-in CLI option to apply Zstandard supercompression to UASTC KTX2 texture output, wiring the setting from the CLI through GltfConverterOptions into the libktx encoding path, and documenting the constraint/usage in the README.
Changes:
- Add
--ktx2-zstd-level 0|1-22option (default0disabled) and validate it in CLI option checks. - Plumb the option into
GltfConverterOptionsand invokektxTexture2_DeflateZstdafterktxTexture2_CompressBasisExwhen enabled. - Add focused option-contract tests and documentation updates for the UASTC-only Zstd constraint.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
README.md |
Documents the new --ktx2-zstd-level option, constraints, and an example invocation. |
Obj2Tiles/Program.cs |
Validates --ktx2-zstd-level constraints and passes the value into GltfConverterOptions for tiling. |
Obj2Tiles/Options.cs |
Adds the new CLI option definition and help text. |
Obj2Tiles.Test/Ktx2ZstdOptionsTests.cs |
Adds tests covering parsing and validation rules for the new option. |
Obj2Gltf/Ktx2/Ktx2Encoder.cs |
Adds P/Invoke for ktxTexture2_DeflateZstd and applies it conditionally for UASTC KTX2 output. |
Obj2Gltf/GltfConverterOptions.cs |
Adds Ktx2ZstdLevel to carry the setting from CLI into the encoder. |
# Conflicts: # Obj2Tiles/Options.cs # Obj2Tiles/Program.cs # README.md
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.
Summary
--ktx2-zstd-level 1-22for UASTC KTX2 output0as the default, preserving the existing output pathktxTexture2_DeflateZstdAPI afterktxTexture2_CompressBasisExThe range and ETC1S restriction follow the official KTX tools contract. This PR is independent of #102 and does not include its thread-count CLI change.
Validation
dotnet test Obj2Tiles.sln --configuration Release --verbosity minimalObj2Tiles.Library.Test: 135 passedObj2Tiles.Test: 87 passedtileset.jsonand two B3DM outputsktx.dllis byte-identical to the official v4.4.2 release DLLsupercompressionScheme = 2(Zstd)ktxv4.4.2, for every embedded image:validate --warnings-as-errors --gltf-basisu: passedtranscode --target rgba8: passed