Skip to content

Feature/supercompressed#5

Merged
roy-t merged 11 commits into
mainfrom
feature/supercompressed
Jul 10, 2026
Merged

Feature/supercompressed#5
roy-t merged 11 commits into
mainfrom
feature/supercompressed

Conversation

@roy-t

@roy-t roy-t commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Add basis_univeral texture processing library

@roy-t
roy-t marked this pull request as ready for review July 9, 2026 18:28
Copilot AI review requested due to automatic review settings July 9, 2026 18:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.SuperCompressed managed API (Image loading, KTX2 encoding, KTX2 transcoding) plus interop types/enums/flags.
  • Adds a native build flow (CMake + build.ps1 + .def exports) 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.

Comment thread source/CapriKit.SuperCompressed/Ktx2Transcoder.cs
Comment thread source/CapriKit.SuperCompressed/Ktx2FileHandle.cs Outdated
Comment thread README.md Outdated
Comment thread external/README.md Outdated
Comment thread source/CapriKit.Tests/SuperCompressed/TestImages.cs
Comment thread research/TextureProcessing.md Outdated

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.
Comment thread research/TextureProcessing.md Outdated
- 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:
@roy-t roy-t self-assigned this Jul 9, 2026
@roy-t
roy-t merged commit e4b8800 into main Jul 10, 2026
1 check passed
@roy-t
roy-t deleted the feature/supercompressed branch July 10, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants