upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs/embedded_shaders.md
diff options
context:
space:
mode:
authorcaua-an <cauapxa@gmail.com>2026-11-22 15:21:01 -0300
committercaua-an <cauapxa@gmail.com>2026-11-22 15:21:01 -0300
commitdfde07df6da7eabf71fca65003fec533cfb5dde7 (patch)
tree5f0cb8ee72aeaaf1def76f5634cbc627b4cc071e /docs/embedded_shaders.md
parentec8ec4c9a46c6623f1a9c125afd3566da97f1e0c (diff)
Docs: describe embedded DXIL reflection parts
Diffstat (limited to 'docs/embedded_shaders.md')
-rw-r--r--docs/embedded_shaders.md23
1 files changed, 21 insertions, 2 deletions
diff --git a/docs/embedded_shaders.md b/docs/embedded_shaders.md
index cfd316094..aba4c2914 100644
--- a/docs/embedded_shaders.md
+++ b/docs/embedded_shaders.md
@@ -44,6 +44,25 @@ validator rejects it (the scan reports both counts).
44 holds tag `0x07` (a second `DXIL` program header) and tag `0x12` (a 16-byte hash). The `STAT` chunk holds a 44 holds tag `0x07` (a second `DXIL` program header) and tag `0x12` (a 16-byte hash). The `STAT` chunk holds a
45 second, different bitcode blob, not the same one. 45 second, different bitcode blob, not the same one.
46 46
47### `STAT` and the `0x07` program header
48
49Measured over all 52 builder containers in one local 1.0.2.1 package; no shader data is included here. The
50bitcode spans below use the `DxilProgramHeader`/`DxilBitcodeHeader` offsets and sizes defined by
51[DirectXShaderCompiler](https://github.com/microsoft/DirectXShaderCompiler/blob/main/include/dxc/DxilContainer/DxilContainer.h).
52All spans fit inside their enclosing parts, and all 104 `STAT` and outer `DXIL` bitcode modules were accepted by
53`llvm-dis` 21.1.8. The header's size-in-dwords equals its enclosing part or record length in every case.
54
55* **`STAT`:** 52/52 contain a `DXIL` program header and a bitcode module distinct from the outer `DXIL` bitcode.
56 All have `dx.entryPoints` and `dx.resources` metadata, and none defines a function in the `llvm-dis` output;
57 the outer modules define functions. DirectXShaderCompiler calls this the shader-statistics part and uses a valid
58 `STAT` module for reflection (see its
59 [container reflection implementation](https://github.com/microsoft/DirectXShaderCompiler/blob/main/lib/HLSL/DxilContainerReflection.cpp)).
60 The metadata-only shape is consistent with that role; the builder's actual consumption of `STAT` is not measured.
61* **XDAT tag `0x07`:** 52/52 contain a `DXIL` program header whose declared bitcode is byte-identical to that of
62 the outer `DXIL` part. None contains the `NOBC` marker. The whole `0x07` record is not the same as the whole
63 outer part, which also contains `XDAT`. This differs from the `NOBC` form documented for the game's shader
64 corpus in [fssm_crosscheck.md](fssm_crosscheck.md); it does not change that separate measurement.
65
47The bitcode is what a PC D3D12 compiler consumes; the runtime path is the `XBCH` record. The constructor passes 66The bitcode is what a PC D3D12 compiler consumes; the runtime path is the `XBCH` record. The constructor passes
48the **whole container** to the compute-PSO call: at `0x180021330` it loads `DAT_180025700` with size `0x1134` 67the **whole container** to the compute-PSO call: at `0x180021330` it loads `DAT_180025700` with size `0x1134`
49(4,404 bytes, the size of container 0, `CopyAndCompactBVH`) and calls `FUN_18000c470`, whose vtable call at 68(4,404 bytes, the size of container 0, `CopyAndCompactBVH`) and calls `FUN_18000c470`, whose vtable call at
@@ -112,8 +131,8 @@ python -I tools/rdna2spirv.py <work>/embedded/dxbc/disasm --out <work>/embedded/
112 into runtime trees ([bvh.md](bvh.md) §3.1). Two of the four rules stand between them and translation. 131 into runtime trees ([bvh.md](bvh.md) §3.1). Two of the four rules stand between them and translation.
113* **What is still open.** None of the 52 has been executed on a GPU; translation and `spirv-val` do not prove the 132* **What is still open.** None of the 52 has been executed on a GPU; translation and `spirv-val` do not prove the
114 output. Which of them the game actually creates is a call-site question (RT-5). The module-to-pipeline order 133 output. Which of them the game actually creates is a call-site question (RT-5). The module-to-pipeline order
115 above comes from `ILDN`, not from a runtime trace. The `STAT` bitcode and the `0x07 NOBC` record are not 134 above comes from `ILDN`, not from a runtime trace. The `STAT` metadata-only shape is consistent with reflection,
116 explained. 135 but whether the builder consumes it has not been measured.
117 136
118## 6. Tool and tests 137## 6. Tool and tests
119 138