giha is a playground for experimenting with dart-based geometry processing on Slang.
The project focuses on implementing cyclic permutations of connectivity representations for geometry processing workflows.
- Dart-based combinatorial model
- A relaxed-condition half-edge structure allowing multiple edges (
include/giha/geometry/dart.h). - Converts sparse face-vertex incidence lists into a canonical dart structure via a SpGEMM-like stitch phase (
include/giha/geometry).
- A relaxed-condition half-edge structure allowing multiple edges (
- Reference kernels — Runnable compute-kernel geometry-processing algorithms.
- Dart-based structure for connectivity and induced maps
- Orbit collector topology query
- Loop-like subdivision
- Delaunay triangulation pass
- Spatial acceleration construction and its query (e.g., BVH, KD-tree)
include/ # Public C++ headers (geometry, linalg, slang helpers)
module/ # Slang modules and kernels
src/ # Host-side runtime and Slang helpers
test/ # Optional tests (enable with GIHA_TEST)
cmake/ # Helper scripts (e.g., DownloadGithubRelease.cmake)
Key building blocks:
module/giha/geometry/dart.slangmirrors the dart map on the GPU and adds mutable/atomic variants suited for lock-free edits.module/giha_kernel, … Compute kernels for geometry processing against the combinatorial model.include/giha/slanghosts the slang compile binder.include/giha/slang/adaptershosts descriptors that bind dart buffers into RHI pipelines (easy to use or for test).
- CMake ≥ 3.25
- A C++20 compiler (MSVC, clang, or gcc)
- Optional: GPU + Slang for shader compilation (downloaded automatically when
GIHA_SLANG=ON, the default). - Optional: slang-rhi (fetched automatically when
GIHA_SLANG_RHI=ON).
# 1. Configure (defaults: GIHA_SLANG=ON, GIHA_SLANG_RHI=OFF, GIHA_TEST=OFF)
cmake -S . -B build \
-DGIHA_SLANG=ON \
-DGIHA_SLANG_RHI=OFF \
-DGIHA_TEST=OFF
# 2. Build
cmake --build buildUseful options:
| Option | Default | Description |
|---|---|---|
GIHA_SLANG |
ON |
Enable Slang support and download the matching SDK. |
GIHA_SLANG_RHI |
OFF |
Build slang-rhi adapters/kernels (downloads slang-rhi). |
GIHA_TEST |
OFF |
Build the test suite in test/. |
GIHA_LOG_LEVEL |
3 |
Compile-time log verbosity (0 silent … 3 debug). |
Set options at configure time, e.g. -DGIHA_TEST=ON.
cmake -S . -B build -DGIHA_TEST=ON
cmake --build build
cmake --build build --target test # or: ctest --test-dir buildTests rely on slang-rhi, so enabling them forces GIHA_SLANG_RHI=ON inside test/CMakeLists.txt.
- Build with
GIHA_SLANG_RHI=ONso the slang-rhi runtime is available. - Use the adapters in
include/giha/geometry/adapters/slang-rhi/to upload agiha::DartMapinto GPU buffers and bind them into a shader cursor. - Compile the desired kernels from
module/giha_kernel/*.slang(e.g., orbit collectors or subdivision) usinggiha::kernelhelpers (include/giha/slang/slang.h). - Dispatch through slang-rhi’s
ComputeKernelwrapper (src/slang/adapters/slang-rhi.cpp).
See module/giha_kernel/subdivide.slang for a complete in-shader example of inserting darts, connecting orbits, and updating induced vertex keys.
- Slang — shading language & compiler used for GPU kernels.
- slang-rhi — rendering hardware interface leveraged by the runtime adapters.
Distributed under the MIT License; see LICENSE for details.