diff options
| author | Vonsek <45567075+Vonsek@users.noreply.github.com> | 2026-11-23 00:19:13 +0100 |
|---|---|---|
| committer | Vonsek <45567075+Vonsek@users.noreply.github.com> | 2026-11-23 00:19:13 +0100 |
| commit | fcda84bb0d2c6abb99e42409f413025d00ddb4be (patch) | |
| tree | 27a5ee092be10547ffa5b4447ee050c623c62850 /docs/embedded_shaders.md | |
| parent | 3a1ed28bebf374321149bc4bbffc005ea6f691c4 (diff) | |
| parent | 3986b50821272791333c00df80bdb8526a8fdb9c (diff) | |
Merge hw4-ps-oracle into hw4-ps-formats (#3499)
docs/shader_validation.md
tools/ps_oracle.py
AI-assisted.
Diffstat (limited to 'docs/embedded_shaders.md')
| -rw-r--r-- | docs/embedded_shaders.md | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/docs/embedded_shaders.md b/docs/embedded_shaders.md index a2aa99262..8e0766993 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 |
| @@ -106,7 +125,6 @@ When this page was first written, 42 translated and 10 stopped at four rules. Th | |||
| 106 | 125 | ||
| 107 | The disassembly count is unchanged: the same 42 programs have no invalid word, and 10 have invalid words in the | 126 | The disassembly count is unchanged: the same 42 programs have no invalid word, and 10 have invalid words in the |
| 108 | code. All 10 of those translate; `Box16Rehydration` is one of the 42 clean ones. | 127 | code. All 10 of those translate; `Box16Rehydration` is one of the 42 clean ones. |
| 109 | | `tools/rdna2spirv.py` | **51** translate and pass `spirv-val` | | ||
| 110 | 128 | ||
| 111 | On current `main`, 51 of the 52 programs translate and pass `spirv-val`. The four earlier blockers were | 129 | On current `main`, 51 of the 52 programs translate and pass `spirv-val`. The four earlier blockers were |
| 112 | implemented in #1871 and #1968 (`427c1376`): | 130 | implemented in #1871 and #1968 (`427c1376`): |
| @@ -122,6 +140,17 @@ The single remaining untranslated program stops at one rule: | |||
| 122 | |---|---| | 140 | |---|---| |
| 123 | | `Box16Rehydration` | `buffer_store_short` (#1864) | | 141 | | `Box16Rehydration` | `buffer_store_short` (#1864) | |
| 124 | 142 | ||
| 143 | | module(s) | blocker then | now | | ||
| 144 | |---|---|---| | ||
| 145 | | `BuildKDOP`, `LoadInstances`, `ReloadProcedurals`, `LoadProceduralGeometry`, `LoadTriangles` | `global_atomic_fmax` | translate | | ||
| 146 | | `PT_LoadInstances` | `global_atomic_fmin` | translates | | ||
| 147 | | `Box32Rehydration`, `ReloadTriangles` | `buffer_load_ushort` | translate | | ||
| 148 | | `LeafRehydration` | `tbuffer_load_format_x GFX10_FORMAT_8_UINT` | translates | | ||
| 149 | | `Box16Rehydration` | `buffer_load_ushort` | stops at `buffer_store_short` (#1864) | | ||
| 150 | |||
| 151 | The disassembly count is unchanged: the same 42 programs have no invalid word, and 10 have invalid words in the | ||
| 152 | code. All 10 of those translate; `Box16Rehydration` is one of the 42 clean ones. | ||
| 153 | |||
| 125 | Reproduction, after `--extract` above: | 154 | Reproduction, after `--extract` above: |
| 126 | 155 | ||
| 127 | ```sh | 156 | ```sh |
| @@ -145,8 +174,8 @@ python -I tools/rdna2spirv.py <work>/embedded/dxbc/disasm --out <work>/embedded/ | |||
| 145 | translates since #1968 (`427c1376`), and only `Box16Rehydration` awaits #1864 (`buffer_store_short`). | 174 | translates since #1968 (`427c1376`), and only `Box16Rehydration` awaits #1864 (`buffer_store_short`). |
| 146 | * **What is still open.** None of the 52 has been executed on a GPU; translation and `spirv-val` do not prove the | 175 | * **What is still open.** None of the 52 has been executed on a GPU; translation and `spirv-val` do not prove the |
| 147 | output. Which of them the game actually creates is a call-site question (RT-5). The module-to-pipeline order | 176 | output. Which of them the game actually creates is a call-site question (RT-5). The module-to-pipeline order |
| 148 | above comes from `ILDN`, not from a runtime trace. The `STAT` bitcode and the `0x07 NOBC` record are not | 177 | above comes from `ILDN`, not from a runtime trace. The `STAT` metadata-only shape is consistent with reflection, |
| 149 | explained. | 178 | but whether the builder consumes it has not been measured. |
| 150 | 179 | ||
| 151 | ## 6. Tool and tests | 180 | ## 6. Tool and tests |
| 152 | 181 | ||