Adds the minimal WebGPU-backend surface an HDR bloom/post chain needs: 1. wgpuCreateStorageImage2D + StorageImage2D<>: runtime rgba16float (or other format) textures with STORAGE_BINDING|TEXTURE_BINDING usage, no CompressedTextureAsset upload — GPU-produced HDR targets. 2. UICustomBindingKind::StorageTexture (kind 5): write-only storage-texture binding carrying a texel format (the freed UICustomBinding::format byte), wired through all three binding paths (UI custom / RT / plain compute). Float textures already sample via SampledTexture (sampleType float). 3. PipelineRTWebGPU::Init(..., hdrOutputFormat): RESOLVE writes the linear accumulator into a user rgba16float texture (RTPass::outTexHandle) instead of the rgba8unorm canvas, leaving the composite→swapchain pass to the app. Default RGBA8Unorm keeps the canvas path byte-identical. Existing RT examples updated for the _pad→format field rename; the default paths are unchanged (verified RTStress builds + renders). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| closesthit.wgsl | ||
| main.cpp | ||
| miss.wgsl | ||
| project.cpp | ||
| raygen.wgsl | ||
| rayquery_pick.wgsl | ||
| README.md | ||
| resolve.wgsl | ||
RayQueryPick
Regression test for the WebGPU software ray-query shim
(additional/dom-webgpu.js, _rqTraverseTlas).
Builds an 8³ = 512-instance TLAS and shoots one fully-determined ray
through a rayQuery=true PlainComputeShader. The committed hit is read
back to the host and checked against the analytically-known answer
(instance customIndex = 484, t = 40.75). On success the console prints:
[RayQueryPick] result: hit=1 customIndex=484 prim=6 t=40.75
[RayQueryPick] PASS — rayQuery TLAS traversal hit the expected instance
Why 512 instances
The TLAS sweep tree is padded to next_pow2(instanceCount) leaves. The
rayQuery shim used to detect BVH leaves with a hardcoded 16384 - 1 leaf
start, so for any scene with fewer than 8193 instances no node index
ever reached a leaf and every pick missed (issue #25). 512 sits squarely
in that broken regime, so this example fails fast if the shim regresses to
a static leaf start. The shim now derives the leaf start from a per-build
RqTlasMeta.nPadded uniform, matching the megakernel _rtwTraverseTlas.
The scene also renders through the wavefront RT pipeline (same as RTStress) so the run produces a visible frame, but the pass/fail signal is the console line above.
cd examples/RayQueryPick
crafter-build -r --target=wasm32-wasip1
WebGPU/DOM only — the native path uses hardware ray queries.