diff options
Diffstat (limited to 'docs/embedded_shaders.md')
| -rw-r--r-- | docs/embedded_shaders.md | 23 |
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 | |||
| 49 | Measured over all 52 builder containers in one local 1.0.2.1 package; no shader data is included here. The | ||
| 50 | bitcode 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). | ||
| 52 | All 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 | |||
| 47 | The bitcode is what a PC D3D12 compiler consumes; the runtime path is the `XBCH` record. The constructor passes | 66 | The bitcode is what a PC D3D12 compiler consumes; the runtime path is the `XBCH` record. The constructor passes |
| 48 | the **whole container** to the compute-PSO call: at `0x180021330` it loads `DAT_180025700` with size `0x1134` | 67 | the **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 | ||