Skip to content

yet-another-ai/comptex

Repository files navigation

comptex

comptex is a Rust GDExtension workspace that implements a texture pipeline using:

  • Godot GPU texture formats (BC7/ASTC/ETC2) at import time
  • GDeflate tile-stream compression for on-disk payloads (default storage codec)
  • QOT compression for texutres
  • CPU decompression path (complete)
  • GPU decompression interface (with compute-shader scaffolding and CPU fallback)

.comptex v2 headers add an explicit payload_codec field (GdeflateTileStream, Qot1, or Qot2). v1 files remain supported and imply GDeflate.

Workspace crates

  • crates/libgdeflate-sys: raw FFI bindings to NVIDIA's libdeflate fork
  • crates/comptex-format: .comptex and TileStream format types
  • crates/comptex-codec: safe compress/decompress API
  • crates/comptex-godot: Godot-facing integration helpers

Setup

Initialize the NVIDIA codec dependency:

git submodule update --init --recursive

Then build:

cargo build

Xtask workflow

Use the workspace xtask helper for common development flows:

# Build comptex-godot (debug)
cargo run -p xtask -- build

# Build comptex-godot (release)
cargo run -p xtask -- build --release

# Run all workspace tests
cargo run -p xtask -- test

# Run comptex-codec benchmarks
cargo run -p xtask -- bench

# Build benchmark binaries without running them
cargo run -p xtask -- bench --no-run

# Bundle a copy-ready Godot addon folder at dist/addons/comptex
cargo run -p xtask -- bundle

# Bundle release addon to a custom directory
cargo run -p xtask -- bundle --release --out-dir dist/addons/comptex

bundle generates:

  • addons/comptex/comptex.gdextension
  • addons/comptex/lib/<platform>/<dynamic-library>
  • addons/comptex/plugin.cfg
  • addons/comptex/plugin.gd

Godot benchmark example

A draft benchmark project is available at examples/godot-bench.

Bundle addon files directly into that project:

cargo xtask bundle --release --out-dir examples/godot-bench/addons/comptex

Then place benchmark assets in examples/godot-bench/assets/ and open the project in Godot.

Rust codec benchmarks

Compression/decompression micro-benchmarks are available for comptex-codec:

cargo bench -p comptex-codec

The benchmark covers multiple synthetic datasets (zeros, pattern, mixed), sizes (1 MiB, 8 MiB), GDeflate compression levels, and QOT1/QOT2 encode/decode.

Godot import: payload codec

In the Comptex importer (lossless preset), set Payload codec to GDeflate_TileStream (default), QOT1, or QOT2. QOT1 and QOT2 are only valid with Lossless (RGBA8); VRAM BC3/BC7 presets always use GDeflate.

License

MIT. See LICENSE.

About

A texture compression library for game engines

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors