MCPcopy Create free account
hub / github.com/BinomialLLC/basis_universal

github.com/BinomialLLC/basis_universal @v2_10_final_snapshot

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2_10_final_snapshot ↗ · + Follow
5,175 symbols 13,281 edges 157 files 832 documented · 16% updated 7d agov2_10_final_snapshot · 2026-06-15★ 3,06285 open issues

Browse by type

Functions 4,622 Types & classes 553
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

README_WASI.md

Building and running Basis Universal under WASI / Wasmtime

This document describes how to build the basisu command-line tool as a WASI (WebAssembly System Interface) executable, and how to run it using Wasmtime.
WASI builds run the encoder inside a secure, portable WebAssembly sandbox with no native dependencies.


1. Install Wasmtime

Install Wasmtime using the official installer:

curl https://wasmtime.dev/install.sh | bash

Verify:

wasmtime --version

2. Install WASI-SDK (WASI toolchain)

Download the latest WASI SDK from:

https://github.com/WebAssembly/wasi-sdk/releases/latest https://github.com/WebAssembly/wasi-sdk/releases

Example (adjust version if needed):

wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-29/wasi-sdk-29.0-x86_64-linux.tar.gz
tar xf wasi-sdk-29.0-x86_64-linux.tar.gz

3. Set the WASI_SDK_PATH environment variable

You must set the path so CMake can find the WASI compiler:

export WASI_SDK_PATH=/path/to/wasi-sdk-29.0-x86_64-linux

Example:

export WASI_SDK_PATH=$HOME/wasi-sdk-29.0-x86_64-linux

Verify:

$WASI_SDK_PATH/bin/clang --version

4. Configure the WASI build using CMake

WASI builds come in two modes: - Single-threaded (default) - Multi-threaded (requires wasi-sdk-pthread.cmake and Wasmtime threading flags)

Create a fresh build directory and configure using the WASI toolchain file:

mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=$WASI_SDK_PATH/share/cmake/wasi-sdk-pthread.cmake -DCMAKE_BUILD_TYPE=Release -DBASISU_WASM_THREADING=ON

Or for a single threaded build (will run much slower):

cmake .. -DCMAKE_TOOLCHAIN_FILE=$WASI_SDK_PATH/share/cmake/wasi-sdk.cmake -DCMAKE_BUILD_TYPE=Release -DBASISU_WASM_THREADING=OFF

5. Build the WASI .wasm executable

Build using:

make

This produces:

bin/basisu.wasm
bin/examples.wasm    (if EXAMPLES=ON)

6. Running basisu.wasm with Wasmtime

WASI programs are sandboxed and cannot access your filesystem unless you explicitly grant permission.

Use one or more --dir= arguments to allow input/output files.

Run internal test suite for ETC1S

bin$ wasmtime run --wasm threads=yes --wasi threads=yes --dir=. --dir=.. --dir=../test_files basisu.wasm -test

Use backslashes under Windows: "wasmtime run --wasm threads=yes --wasi threads=yes --dir=. --dir=.. --dir=..\test_files basisu.wasm -test"

For the single threaded wasm executables, "--wasm threads=yes --wasi threads=yes" isn't needed.

A Windows .cmd batch script example:

wasmtime --dir=. --dir=.. --dir=..\test_files --dir=d:/dev/test_images::/test_images --dir=d:/dev/test_images/bik::/bik basisu.wasm %*

A shell script example:

#!/usr/bin/env bash
wasmtime run --dir=. --dir=../test_files --dir=/mnt/d/dev/test_images::/test_images --dir=/mnt/d/dev/test_images/bik::/test_images/bik --wasm threads=yes --wasi threads=yes ./basisu.wasm "$@"

Example: run compression on a PNG to ETC1S

wasmtime run --wasm threads=yes --wasi threads=yes --dir=. basisu.wasm xmen.png -stats

Example: transcode a KTX2 file to .ktx/.png/etc.

wasmtime run --wasm threads=yes --wasi threads=yes --dir=. basisu.wasm xmen.ktx2


Notes

  • WASI builds run inside a secure sandbox with no filesystem access unless explicitly granted via --dir=.
  • The CMake configuration sets a larger stack size to support ASTC/UASTC compression.
  • WASI SDK and Wasmtime can be installed anywhere; just update WASI_SDK_PATH.

Summary

To build and run BasisU under WASI:

  1. Install Wasmtime
  2. Install WASI SDK
  3. Set WASI_SDK_PATH
  4. Run cmake using the WASI toolchain in "build" directory
  5. Build with make
  6. Run using wasmtime with --dir= permissions on .wasm executables in "bin" directory

This produces a safe, portable, sandboxed version of the Basis Universal encoder that runs anywhere.

Core symbols most depended-on inside this repo

Shape

Function 2,485
Method 2,137
Class 490
Enum 63

Languages

C++77%
C9%
TypeScript9%
Python5%

Modules by API surface

zstd/zstddeclib.c466 symbols
webgl/gltf/three.min.js421 symbols
encoder/basisu_enc.h281 symbols
transcoder/basisu_containers.h264 symbols
encoder/cppspmd_sse.h212 symbols
encoder/basisu_math.h208 symbols
example_transcoding/utils.h201 symbols
transcoder/basisu_transcoder_internal.h200 symbols
encoder/3rdparty/tinyexr.h178 symbols
transcoder/basisu_astc_helpers.h166 symbols
webgl/transcoder/basis_wrappers.cpp116 symbols
encoder/basisu_astc_ldr_encode.cpp109 symbols

For agents

$ claude mcp add basis_universal \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page