Files
mandy/docs/contracts/ray_tracing.json

26 lines
2.4 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"piece": "Ray tracing",
"status": "gpu_verified",
"rank": 67,
"sentences": [
"`image_bvh_intersect_ray` / `image_bvh64_intersect_ray` (64 CS: RT shadows) are one traversal step against AMD's hardware BVH node format.",
"The traversal loop lives in the game's shader.",
"The step is emulated over buffer reads following Mesa RADV's software path (`radv_nir_rt_common.c`, `intersect_ray_amd_software_box/_tri`; node layouts from `bvh_defines.h`).",
"Node id = address >> 3 \\| type (0–3 triangle, 4 box16, 5 box32).",
"Box nodes give the four child ids, with misses and NaN boxes = `0xFFFFFFFF`, sorted by entry distance when descriptor bit 63 (box_sort_enable) is set.",
"Triangle nodes read their three vertices from the slots the node type picks: TRI0 (0,1,2), TRI1 (1,3,2), TRI2 (2,3,4), TRI3 (2,4,0), 12 bytes each.",
"They use the watertight test with RADV's shared edge/vertex tie-breaks and give (t/\\|det\\|, sign(det), b_i/\\|det\\|, b_j/\\|det\\|), or (inf, 1, 0, 0) on a miss.",
"The weights i and j are chosen by the node type's byte of the triangle-ID word at +60: bits [1:0] and [3:2], 0/1/2 = vertex 0/1/2; `0x09` gives RADV's (v, w).",
"Vertex slots and remap follow AMD GPURT (`CalcTriangleCompressionVertexIndices`, `SwizzleBarycentrics`) and the public XDXR software path ([bvh.md](bvh.md) §7a).",
"These two references agree; no game BVH is decoded yet to count over.",
"A GPU can't confirm the rule either, because every GPU runs this emulation and none runs the native instruction.",
"`tests/semantic/test_image_bvh_tri.py` runs every node type and remap byte on the interpreter.",
"The game's code divides by `.y` exactly as for the hardware's numerator/denominator.",
"Address = descriptor base + ((node & ~7) << 3), base = descriptor bits [39:0] in 256-byte units (**assumption**: RADV only uses base 0).",
"**The runtime must build the game's acceleration structures in this AMD node format** (RADV's GPU BVH builder produces it) wherever the game's D3D12 calls build them.",
"Far branches with `s_sub_u32`/`s_subb_u32` (backward) are folded too.",
"GPU-checked with `runtime/test/shaders/cs_bvh.asm`: sorted box children and the triangle result are exact.",
"The 32-bit form (11 address dwords: the node id has no high dword) runs the same scene in `cs_bvh32.asm` and gives the same eight words."
]
}