Feature/supercompressed#5
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new CapriKit.SuperCompressed library that wraps the basis_universal submodule via P/Invoke, including native build helpers and a new test suite to validate encoding/transcoding behavior and native version expectations.
Changes:
- Introduces
CapriKit.SuperCompressedmanaged API (Image loading, KTX2 encoding, KTX2 transcoding) plus interop types/enums/flags. - Adds a native build flow (CMake +
build.ps1+.defexports) and wires CI to build the native DLL before running tests. - Adds unit tests and updates solution/docs/submodule setup to include
external/basis_universal.
Reviewed changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| source/CapriKit.Tests/SuperCompressed/TestImages.cs | Test helpers for generating images/TGA data used by new tests. |
| source/CapriKit.Tests/SuperCompressed/NativeMethodsTests.cs | Smoke tests for native version and key interop calls. |
| source/CapriKit.Tests/SuperCompressed/Ktx2TranscoderTests.cs | Validates KTX2 metadata and transcoding outputs/sizes. |
| source/CapriKit.Tests/SuperCompressed/Ktx2EncoderTests.cs | Validates encoder produces a KTX2 header/magic. |
| source/CapriKit.Tests/SuperCompressed/ImageTests.cs | Tests image decoding and raw-pixel constructor behavior. |
| source/CapriKit.Tests/CapriKit.Tests.csproj | References the new CapriKit.SuperCompressed project. |
| source/CapriKit.SuperCompressed/TranscodeFormat.cs | Public enum mirroring basis_universal transcode formats. |
| source/CapriKit.SuperCompressed/TranscodedImage.cs | Record type describing one transcoded image/mip. |
| source/CapriKit.SuperCompressed/README.md | Usage and native build/update documentation for the new package. |
| source/CapriKit.SuperCompressed/NativeMethods.cs | P/Invoke surface for basis_universal C API (bu_*/bt_*). |
| source/CapriKit.SuperCompressed/Ktx2Transcoder.cs | KTX2 open/transcode APIs, including parallel transcoding. |
| source/CapriKit.SuperCompressed/Ktx2FileHandle.cs | SafeHandle wrapper owning the native KTX2 reader + pinned data. |
| source/CapriKit.SuperCompressed/Ktx2Encoder.cs | Encoding wrapper around bu_* functions producing KTX2 bytes. |
| source/CapriKit.SuperCompressed/Image.cs | RGBA32 image wrapper + StbImageSharp-based decoding. |
| source/CapriKit.SuperCompressed/DecodeFlags.cs | Public decode flags mirroring basis_universal constants. |
| source/CapriKit.SuperCompressed/CompressionFlags.cs | Public encode flags mirroring basis_universal constants. |
| source/CapriKit.SuperCompressed/CompParamsHandle.cs | SafeHandle for encoder compression-parameter lifetime. |
| source/CapriKit.SuperCompressed/CapriKit.SuperCompressed.csproj | Adds StbImageSharp and packs/copies the native DLL asset. |
| source/CapriKit.SuperCompressed/BasisTexFormat.cs | Public enum mirroring basis_universal intermediate formats. |
| source/CapriKit.SuperCompressed/basis_universal/exports.def | DLL export list generated from upstream headers. |
| source/CapriKit.SuperCompressed/basis_universal/CMakeLists.txt | CMake project to build caprikit_basisu.dll. |
| source/CapriKit.SuperCompressed/basis_universal/build.ps1 | Build script to configure/build/copy the native DLL. |
| research/TextureProcessing.md | Background/problem statement and integration constraints. |
| research/SuperCompressedPlan.md | Research/plan documenting chosen integration approach. |
| README.md | Updates top-level build instructions to include submodules. |
| external/README.md | Adds guidance on submodule usage and “do not modify” policy. |
| external/BASIS_UNIVERSAL.md | Adds brief build notes for the basis_universal submodule. |
| Directory.Packages.props | Adds central package version for StbImageSharp. |
| CLAUDE.md | Notes that external contains submodules and shouldn’t be modified. |
| CapriKit.slnx | Adds CapriKit.SuperCompressed project and extra platform entries. |
| .gitmodules | Adds external/basis_universal submodule configuration. |
| .github/workflows/unit-tests.yml | Checks out submodules and builds native DLL before running tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| I've settled on using basis_universal project, see `external/basis_universal` for the basis_universal repository (git submodule) which also contains the documentation and usage examples. basis_universal is a c++ project but I want to access the functionality of this library from C#. | ||
|
|
||
| For a much older version of basis_unversal I created two small projects, one in C++/CLR to integrate with the basis_universal library, and one plain C#/.NET t expose this functionality better to other C# projects. The code for that is in `C:\projects\csharp\SuperCompressed`, but I am not certain if this is the best approach. Do not blindly make another C++/CLR project. But consider all options you have for integrating with C++ code. |
| - I want the C# classes/enums/records feel as a very lightweight wrapper for the C++ code, from C# you should not have to work with raw pointers. Though working with things like a `Span<>` or `ReadOnlySpan<>` is fine. | ||
|
|
||
|
|
||
| ## Follow-up information after Claude read the intial instructions: |
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
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.
Add basis_univeral texture processing library