Pure-MoonBit Direct3D 12 bindings (zero user C, runtime-loaded d3d12.dll / dxgi.dll)
Part of the Tycho graphics stack — mounted there as the dx12/ submodule.
| Surface | Notes |
|---|---|
| Device | FL 12_0 device + direct queue + fence; hardware adapter first, WARP on request; optional debug layer (ID3D12InfoQueue message counting); wait_idle, raw() for raw COM interop |
| CommandList | direct allocator + command list, begin / transition / clear / draw / draw_indexed / bind_vertex / bind_index / copy_to_readback / execute_wait |
| ResourceState | typed states (RenderTarget, CopySource, CopyDest, Present, …); the shim tracks the native state per texture and only emits a barrier when it actually changes, and drawing/copying from the wrong state fails with E_ILLEGAL_METHOD_CALL |
| Pipeline | graphics PSO from DXIL blobs: root signature (root CBVs + SRV/sampler or UAV tables), depth state, and an input layout built from packed element records (TEXCOORD(location * 10), the index Slang emits) |
| Texture | RGBA8 UNORM render target with its own RTV heap (state() reports the tracked state) |
| Swapchain | DXGI flip-model (DXGI_SWAP_EFFECT_FLIP_DISCARD, 3 buffers) on an HWND; target(index) wraps a back buffer, present() distinguishes presented / occluded / failed, resize() recreates the RTV heap |
| Readback | READBACK-heap buffer, rows repacked to tightly packed RGBA8 on the MoonBit side |
| generated dispatch | dispatch_generated.c / dispatch_generated.mbt: one thunk per COM method for 125 interfaces (2753 methods), generated from registry/d3d12-abi.txt |
| raw COM lifetime | com_release / com_add_ref (IUnknown, omitted from the manifest) + int32_ptr / int64_ptr / bytes_ptr marshalling helpers for the raw dispatch ABI |
python tools/gen-dx12-bindings.py # writes dispatch_generated.{c,mbt}
python tools/gen-dx12-bindings.py --check # drift gate; also run by python tools/codegen.py check
python tools/dx12-coverage.py --check # 100% gate: header surface vs manifest (binding)
python tools/dx12-exec-coverage.py --check # 100% gate: 2753/2753 COM methods + 15/15 free entry points
python tools/dx12-exec-coverage.py --live-only # report genuinely live-exercised methods separatelyThis package contains over 2944 items.
Install
Download zipPure-MoonBit Direct3D 12 bindings (zero user C, runtime-loaded d3d12.dll / dxgi.dll)