Standalone, bloat-free clean-room hardware GPU compute SDK (MIT OR Apache-2.0) for Xbox Series X|S translation layers, DirectStorage IDStorageQueueX hooks, Vulkan 1.3 Linux layers (OpenScarlett / Proton), and GPU backends for Ahmet-Dedeler/bcpack-rs.
No game assets, no demo media bloat, zero copyrighted data — only the production C-ABI DLL (bcpack_gpu.dll), Rust crate (bcpack-gpu-sdk v0.15.0), include/bcpack_gpu.h, 15 HLSL SM 6.6 + DXIL compute kernels, and 14 precompiled Vulkan 1.3 SPIR-V (.spv) kernels supporting all 6 BCPack formats: Full BC1, BC3, BC4, BC5, BC6H (Modes 1–14), and Multi-Mode BC7 (Modes 0–7) with mixed-format GPU batching (BcPackDecodeBatch), batched zero-copy 2D texture streaming (BcPackDecodeBatchToTextures), and optional caller-supplied runtime table uploads.
Looking for the full 4K streaming benchmark, 12.41M Mesh-Shader showcase, MP4/GIF captures, and 19-test verification harness? See the companion showcase repository:
POMXARK/bcpack-gpu-hlsl(which links this SDK via Git submodule atsdk/). AI coding agents & crawlers: readllms.txtanddocs/AI_ARCHITECTURE.md.
- Zero-Barrier Wave32 BCPack MDU rANS Decoders (
11.33 GB/sBC1,6.02 GB/sBC7 rANS):- Dual-chunk warp packing (
2 × 12lanes for BC1 =24/32active;2 × 16lanes for BC7 =32/32100% Wave32 utilization). - Register-resident
64Bstream sliding window withWaveReadLaneAtsymbol transpose and 4-step branchless binary search — zeroGroupMemoryBarrierWithGroupSync()inside hot loops.
- Dual-chunk warp packing (
- Full 6-Format Block Rebuilders (
BC1/BC3/BC4/BC5/BC6HModes 1–14 /BC7Modes 0–7):shaders/bcpack_bc7_rebuild.hlsl(Bc7FullGpuDecoder/BCPACK_FORMAT_BC7): complete 128-bit BC7 block assembly across all 8 modes (0..7), partitions, Mode 4/5 channel rotations & index-selection, p-bits, anchor omissions, 255-entry dictionary, and 256-block history ring.shaders/bcpack_bc6h_rans.hlsl+shaders/bcpack_bc6h_rebuild.hlsl(Bc6hFullGpuDecoder/BCPACK_FORMAT_BC6H): 16-lane Wave32 rANS + all 14 BC6H HDR modes (1..14), ascending high base bits (13..14), signed index deltas, 255-entry dictionary, and 256-block history ring.shaders/bcpack_bcn_rans.hlsl+shaders/bcpack_bcn_rebuild.hlsl(BcnGpuDecoder/BCPACK_FORMAT_BC3,BC4,BC5, and full-tableBC1): generalized 12-lane Wave32 rANS + pair/quad rank tables + dictionary/history rebuild.shaders/bc16_pack.hlsl+shaders/gfx10_detile.hlsl: inline RDNA2 bit-permutation detile (SW_64KB_D8B/16B,SW_4KB_S8B at432.6 GB/s) onD3D12_COMMAND_LIST_TYPE_COMPUTEbeforeCopyTextureRegion.
- Zero-Copy & Batched Shared-Device C-ABI (
bcpack_gpu.dll+include/bcpack_gpu.h):- Attach directly to a caller's
ID3D12Device*(bcpack_gpu_create_from_device) and decode + detile straight intoD3D12_HEAP_TYPE_DEFAULTbuffers (BcPackDecodeToBuffer),DXGI_FORMAT_BC{1,3,4,5,6H_UF16,7}_UNORM2D subresources (BcPackDecodeToTexture2D), or batched zero-copy multi-texture targets (BcPackDecodeBatchToTextures: automatic Gfx10 detile +256Brow-pitch padding, singlequeue->Wait(compute_fence)-> singleCopyTextureRegioncommand list -> single direct fence with zero per-item CPU waits; verified on RTX 5080 across10/11mixed 6-format/Gfx10/multi-mip items +1isolated error,0byte mismatches,16.0 MiB(128×512×512 BC1) in40.58 ms(394.3 MB/s)). - Submit heterogeneous multi-chunk batches via
BcPackDecodeBatch(BcPackBatchItemarray acrossBC1/BC3/BC4/BC5/BC6H/BC7): groups items by pipeline family (Bc1Fast,Bcn,Bc6h,Bc7), auto sub-batches within context caps, isolates invalid items peritem.status, and eliminates per-chunk dispatch overhead (41.7×faster than loopingBcPackDecodeAsync). - Callers with external Xbox BCPack tables can upload them cleanly at runtime via
bcpack_gpu_set_bc1_tables,bcpack_gpu_set_bc6h_tables, andbcpack_gpu_set_bc7_tables(0proprietary constants embedded).
- Attach directly to a caller's
- SM 6.6 Virtual
ResourceDescriptorHeap[]Pager (1.25M → 262Kslots in0.064 ms):- Solves NVIDIA DX12
~1Mshader-visible descriptor heapE_OUTOFMEMORYcrashes viaCopyDescriptorsSimpleLRU paging +ResourceDescriptorHeap[NonUniformResourceIndex(g_VirtToPhys[id])].
- Solves NVIDIA DX12
- Cross-Vendor Console Compute Helpers (DXIL + Vulkan 1.3 SPIR-V):
- Conservative 6-mip Hi-Z pyramid (
hiz_build,hiz_cull), 4-bone GPU Crowd Skinning (crowd_skin), Hardware VRS Tier 2 tile classifier (aaa_vrs), and Xbox/RDNA2-style ComputeRayQueryDiffuse RTGI (aaa_rtgi_cs,VK_KHR_ray_query).
- Conservative 6-mip Hi-Z pyramid (
Download bcpack_gpu.dll, bcpack_gpu.dll.lib, and bcpack_gpu.h from Releases (or build with cargo build --release), then link bcpack_gpu.dll.lib:
#include "bcpack_gpu.h"
// Attach to caller's existing ID3D12Device* (zero ownership transfer):
BcPackContext* ctx = bcpack_gpu_create_from_device(
d3d12_device,
NULL, // internal D3D12_COMMAND_LIST_TYPE_COMPUTE queue
2048, // max chunks per batch
8388608, // max BC blocks
96u * 1024 * 1024);
// Decode + Gfx10 SW_64KB_D detile directly into caller Texture2D subresource (zero CPU copy):
uint64_t fence = 0;
BcPackDecodeToTexture2D(
ctx,
compressed_bytes, compressed_size,
width_blocks * height_blocks,
BCPACK_FORMAT_BC1,
BCPACK_SWIZZLE_GFX10_64KB_D,
width_blocks, height_blocks,
dst_texture2d, subresource_idx, 0, 0, &fence);
// Pure GPU-side handoff before sampling in graphics shaders:
direct_queue->Wait((ID3D12Fence*)BcPackGetDirectFence(ctx), fence);See full working wrapper in examples/directstorage_hook.cpp and step-by-step integration patterns in docs/INTEGRATION_GUIDE.md.
All 9 core compute kernels are precompiled with official Microsoft DirectXShaderCompiler v1.9.2609 (-spirv -fspv-target-env=vulkan1.3 -T cs_6_6 -E CSMain -O3):
- Enable
VK_EXT_subgroup_size_control(requiredSubgroupSize = 32) when dispatchingbcpack_decode.spvorbcpack_bc7_rans.spvon 64-wide RDNA2/RDNA3 GPUs. - Enable
VK_KHR_ray_querywhen loadingaaa_rtgi_cs.spv([numthreads(8,8,1)]=2× Wave32NVIDIA /1× Wave64AMD). - Recompile anytime on Linux/Windows via
shaders/compile_spirv.sh.
[dependencies]
bcpack-gpu-sdk = { git = "https://github.com/POMXARK/bcpack-gpu-sdk.git", tag = "v0.14.1" }use bcpack_gpu::gpu_decoder::{pack_batch, BcpackGpuDecoder, GpuContext};
use bcpack_gpu::descriptor_paging::VirtualDescriptorPager;Or add this repository as a Git submodule:
git submodule add https://github.com/POMXARK/bcpack-gpu-sdk.git sdk| Kernel / Module | Targets | Wave / Threadgroup | Key Register Bindings | Role |
|---|---|---|---|---|
bcpack_decode.{hlsl,dxil,spv} |
SM 6.6, VK 1.3 | [WaveSize(32)] 32 |
t0..t4, u0 (uint2), u1 |
Dual-chunk BC1 rANS + predictor + quad reconstruction |
bcpack_bcn_rans.{hlsl,dxil,spv} |
SM 6.6, VK 1.3 | [WaveSize(32)] 32 |
t0..t2, u0 (uint ×6/row), u1 |
Generalized 12-lane Wave32 rANS (BC1 / BC3 / BC4 / BC5) |
bcpack_bcn_rebuild.{hlsl,dxil,spv} |
SM 6.6, VK 1.3 | 64 |
b0, t0..t4, u0, u1 |
BC1 / BC3 / BC4 / BC5 pair/quad/dict/history block rebuilder |
bcpack_bc6h_rans.{hlsl,dxil,spv} |
SM 6.6, VK 1.3 | [WaveSize(32)] 32 |
t0..t2, u0 (uint ×8/row), u1 |
32/32 16-lane BC6H rANS entropy stage (64B/block syms) |
bcpack_bc6h_rebuild.{hlsl,dxil,spv} |
SM 6.6, VK 1.3 | 64 |
b0, t0..t2, u0 (uint4), u1 |
Full BC6H (Modes 1–14) dict/history block rebuilder |
bcpack_bc7_rans.{hlsl,dxil,spv} |
SM 6.6, VK 1.3 | [WaveSize(32)] 32 |
t0..t2, u0 (uint ×8/row), u1 |
32/32 16-lane BC7 rANS entropy stage (64B/block syms) |
bcpack_bc7_rebuild.{hlsl,dxil,spv} |
SM 6.6, VK 1.3 | 64 |
b0, t0..t3, u0 (uint4), u1 |
Full Multi-Mode BC7 (Modes 0–7) dict/history block rebuilder |
bc16_pack.{hlsl,dxil,spv} |
SM 6.6, VK 1.3 | 64 |
t0, u0 (Store2), b0 |
Collapses 16-lane symbol rows into 16B BC7/BC5 blocks |
gfx10_detile.{hlsl,dxil,spv} |
SM 6.6, VK 1.3 | 64 |
t0, u0, b0 |
AMD Gfx10 SW_64KB_D (8B/16B) & SW_4KB_S detiler |
bindless_paging.{hlsl,dxil,spv} |
SM 6.6, VK 1.3 | 64 |
t0, t1, u0, b0 |
ResourceDescriptorHeap[NonUniformResourceIndex(phys)] pager |
crowd_skin.{hlsl,dxil,spv} |
SM 6.6, VK 1.3 | 64 |
t0, t1, u0, b0 |
4-bone Linear Blend Skinning for 500+ NPCs |
hiz_build.{hlsl,dxil,spv} |
SM 6.6, VK 1.3 | 8×8 |
t0, u0, b0 |
6-mip conservative MAX depth pyramid |
hiz_cull.{hlsl,dxil} |
SM 6.6 | 64 |
t0..t8, u0, b0 |
Frustum + 4-texel Hi-Z bounding sphere occlusion test |
aaa_vrs.{hlsl,dxil,spv} |
SM 6.6, VK 1.3 | 8×8 |
t0, t1, u0 (R8_UINT), b0 |
VRS Tier 2 (16×16) motion/luma/sky rate map |
aaa_rtgi_cs.{hlsl,dxil,spv} |
SM 6.6, VK 1.3 | 8×8 (VK_KHR_ray_query) |
t0..t6 (t2=TLAS), u0, b0 |
Coalesced Compute RayQuery diffuse GI |
src/ffi.rs + include/bcpack_gpu.h |
cdylib (Win64) |
Async Compute + Direct | C-ABI opaque BcPackContext* |
bcpack_gpu_create_from_device, BcPackDecodeBatch, BcPackDecodeToTexture2D, BcPackDecodeToBuffer |
All measurements verified against Ahmet-Dedeler/bcpack-rs CPU reference oracle (0 byte/symbol mismatches):
- Correctness (
5/5 PASS,0byte mismatches againstbcpack-rs7b2b421):bc1_lane1_index_reference_bit_exact:512BC1 blocks with non-zerolane 1index references via branchless 16-pixel SWAR (codes_to_lines/add_lines/lines_to_codes+ring_line[2][256]inbcpack_decode.hlsl) verified0mismatches (kernel=0.593 ms).bc7_rotation_ignored_outside_modes_4_5: restricts BC7rotationstrictly to modes4and5(bcpack_bc7_rebuild.hlsl,Bc7FullGpuDecoder::update_tables), verified0mismatches (1,024bytes).BcPackDecodeToTexture2D: all 6 formats (BC1/BC3/BC4/BC5/BC6H/BC7) at256×256 pxand unaligned12×12 px(row_pad_default), plus>16 MiBrow-padded2052×8192 pxBC7 (16.03 MiBraw /16.50 MiBpadded in 64 strips),4096×4096 pxBC7 (16.00 MiBin 64 strips viadst_y_blocks), and pre-submission-5bounds guard (>128 MiB).BcPackDecodeBatch:62/66mixedBC1/BC3/BC4/BC5/BC6H/BC7chunks auto-sub-batched (max_chunks=16) +4isolated error items (-2,-4,-4,-1) with0byte mismatches (kernel=7.478 ms).
- Throughput (
384realistic64 KiBchunks =24.0 MiBmixed 6-fmt; CPU subset =320chunks /20.0 MiBBC1/3/4/5/7on Ryzen 7 5700X):
| Path / API | Scale | Latency | Throughput | Notes |
|---|---|---|---|---|
CPU bcpack-rs (1 thread, #8) |
20.0 MiB (BC1/3/4/5/7) |
365.87 ms |
0.06 GB/s |
Baseline CPU (7b2b421) |
CPU bcpack-rs (16 threads, #8) |
20.0 MiB (BC1/3/4/5/7) |
62.61 ms |
0.33 GB/s |
Full 8C/16T Ryzen 7 5700X |
GPU BcPackDecodeAsync loop |
24.0 MiB (384 calls) |
6,681.02 ms |
< 0.01 GB/s |
1-chunk submit/sync overhead |
GPU BcPackDecodeBatch (wall) |
24.0 MiB (384 chunks) |
156.29 ms |
0.16 GB/s |
42.7× faster than async loop, 2.3× vs 1T CPU |
GPU BcPackDecodeBatch (kernel) |
24.0 MiB (384 chunks) |
118.13 ms |
0.21 GB/s |
Cumulative DX12 GPU timestamps |
GPU BcPackDecodeToTexture2D |
8.0 MiB (32 × 512px BC7) |
4,451.95 ms |
< 0.01 GB/s |
Zero-copy per-texture DX12 copy |
| Workload / Kernel | Output / Scale | CPU 1-Core Baseline | bcpack-gpu-sdk (RTX 5080) |
Speedup / Notes |
|---|---|---|---|---|
| BC1 4K-Tiled Decode | 64.0 MiB (2,048 tiles) |
1,576.11 ms (40.6 MB/s) |
5.650 ms (11,327.6 MB/s) |
279.0× (0 mismatches) |
BC7 16-Lane rANS (32/32 Wave32) |
32.0 MiB equiv (1,024 chunks) |
1,312.73 ms (24.4 MB/s) |
5.312 ms (6,024.0 MB/s) |
247.1× (0 mismatches) |
Full Multi-Mode BC7 (0..7 + SW_64KB_D) |
5 chunks (1,984 blks + Tex2D) |
— | 9.163 ms (0 mismatches) |
Modes 0–7, rot, sel, p-bits, dict |
Mixed BC3 + BC4 + BC5 Batch |
1,152 blocks (C-ABI + GPU) |
— | 1.289 ms (0 mismatches) |
Pair/quad rank + dict + 256-hist |
AMD Gfx10 SW_64KB_D Detile |
64.0 MiB (512 × 512×512) |
— | 0.144 ms (432.6 GB/s) |
Fused on COMPUTE queue |
| Virtual Descriptor Paging | 1.25M → 262,144 physical slots |
— | 0.064 ms (65,536 px) |
Fixes NVIDIA ~1M E_OUTOFMEMORY |
| GPU 4-Bone Crowd Skinning | 500 NPCs (512k verts, 32k bones) |
— | 0.075 ms (max_err=7.63e-6) |
Per-limb motion vectors |
VRS Tier 2 + Compute RayQuery RTGI |
1920×1080 HDR (ultra preset) |
155.66 FPS (PS RTGI, VRS OFF) |
196.77 FPS (+VRS: 258.91 FPS) |
Eliminates 2×2 helper ray waste |
- DXC
-O3Wave-Intrinsics Divergence Bug (bcpack_decode.hlsl,bcpack_bc7_rans.hlsl): CombiningWavePrefixCountBits+WaveActiveCountBitsin a split-half Wave32 byte allocator miscompilesstream_posunderdxc -O3. Resolved via explicitWaveActiveBallot+countbits(mask & ((1u << ll) - 1u)). - NVIDIA DX12
~1MDescriptor Heap Limit (descriptor_paging.rs): PreventsE_OUTOFMEMORYwhen translation layers allocate> 1,000,000SHADER_VISIBLEdescriptors by paging staging SRVs through262,144physical Tier-3 slots withCopyDescriptorsSimple. - NVIDIA RTX 5080 Driver
621.24RT-Cache Flicker (aaa_rtgi_cs.hlsl): Isolate TLAS builds withuav_barrier_all()+ explicit fence flush before mixing Async Compute texture uploads withRayQuerydispatches. - RDNA2 / Vulkan Subgroup Dispatch:
Use
VK_EXT_subgroup_size_control(Wave32) forbcpack_decode.spv/bcpack_bc7_rans.spv, whereas[numthreads(8,8,1)]inaaa_rtgi_cs.hlslmaps natively to2× Wave32(NVIDIA) or1× Wave64(AMD RDNA2+) with zero changes.
Licensed under MIT OR Apache-2.0 (LICENSE-MIT, LICENSE-APACHE).
100% clean-room implementation building on the public format research in Ahmet-Dedeler/bcpack-rs and Microsoft's MIT-licensed microsoft/silicon-rans.