diff options
Diffstat (limited to 'docs/first_light.md')
| -rw-r--r-- | docs/first_light.md | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/docs/first_light.md b/docs/first_light.md index 9eaff8f37..b6ddd8bb3 100644 --- a/docs/first_light.md +++ b/docs/first_light.md | |||
| @@ -70,9 +70,7 @@ python -I tools/first_light.py --check --out ~/leonida-work/first_light/out | |||
| 70 | 70 | ||
| 71 | `--check` on an existing folder re-runs the harness through the same fresh path and `check_image` as the test; a | 71 | `--check` on an existing folder re-runs the harness through the same fresh path and `check_image` as the test; a |
| 72 | harness that exits 0 without writing, an all-opaque image and a swapped-U/V image all exit 1. The test has | 72 | harness that exits 0 without writing, an all-opaque image and a swapped-U/V image all exit 1. The test has |
| 73 | twenty-five cases: the two package-gated draw/manifest checks, the `--check` command, four oracle fixtures, the | 73 | 48 cases; `python -I tests/test_first_light.py -v` prints each one. |
| 74 | mesh depth fit, a preview with non-finite readback channels, the stage files of two shaders with the same name, two | ||
| 75 | OBJ parsing checks, seven checks of the textured path (section 6) and six CPU checks of `--camera` (section 7). | ||
| 76 | 74 | ||
| 77 | `first_light.py` carves `shaders.rpf` if the work folder does not have it, translates only the chosen pair, converts | 75 | `first_light.py` carves `shaders.rpf` if the work folder does not have it, translates only the chosen pair, converts |
| 78 | the OBJ to the harness's mesh file (`u32 vertex_count, u32 index_count`, `(x,y,z,u,v) f32` vertices, `u32` | 76 | the OBJ to the harness's mesh file (`u32 vertex_count, u32 index_count`, `(x,y,z,u,v) f32` vertices, `u32` |
| @@ -140,10 +138,10 @@ The CPU oracle (`check_image`) samples the decoded `R8G8B8A8_UNORM` texture bili | |||
| 140 | `centre_uv` and each `uv_probes` entry and requires the GPU readback to match within `0.02` (rejecting the | 138 | `centre_uv` and each `uv_probes` entry and requires the GPU readback to match within `0.02` (rejecting the |
| 141 | magenta unbound-texture fallback and wrong-colour probes). Verified on Windows 11 with an NVIDIA GeForce RTX 3060 | 139 | magenta unbound-texture fallback and wrong-colour probes). Verified on Windows 11 with an NVIDIA GeForce RTX 3060 |
| 142 | (driver 621.24, Vulkan 1.4.357): **12,804/16,384 (0.781)** covered. Without `LEONIDA_FIRST_LIGHT_DIR`, | 140 | (driver 621.24, Vulkan 1.4.357): **12,804/16,384 (0.781)** covered. Without `LEONIDA_FIRST_LIGHT_DIR`, |
| 143 | `python -I tests/test_first_light.py -v` runs **46 tests: 42 passed, 4 skipped** (the 3 package-gated | 141 | `python -I tests/test_first_light.py -v` runs **48 tests: 44 passed, 4 skipped** (the 3 package-gated |
| 144 | `FirstLightTests` require `LEONIDA_FIRST_LIGHT_DIR`, and `test_harness_rejects_wrapped_tsharp_va_overflow` needs a | 142 | `FirstLightTests` require `LEONIDA_FIRST_LIGHT_DIR`, and `test_harness_rejects_wrapped_tsharp_va_overflow` needs a |
| 145 | built `vk_harness`; the 4 `OracleTests` and the other 11 `TexturedOracleTests` run without a package). With | 143 | built `vk_harness`; the 4 `OracleTests` and the other 11 `TexturedOracleTests` run without a package). With |
| 146 | `LEONIDA_FIRST_LIGHT_DIR` set against a local package run (and `vk_harness` built) none of the 46 is skipped. | 144 | `LEONIDA_FIRST_LIGHT_DIR` set against a local package run (and `vk_harness` built) none of the 48 is skipped. |
| 147 | 145 | ||
| 148 | ```sh | 146 | ```sh |
| 149 | python -I tools/first_light.py --game "<package>" --work ~/leonida-work \ | 147 | python -I tools/first_light.py --game "<package>" --work ~/leonida-work \ |
| @@ -203,13 +201,36 @@ python -I tools/first_light.py --game "<package>" --work ~/leonida-work \ | |||
| 203 | LEONIDA_FIRST_LIGHT_DIR=~/leonida-work/first_light/camera python -I tests/test_first_light.py -v | 201 | LEONIDA_FIRST_LIGHT_DIR=~/leonida-work/first_light/camera python -I tests/test_first_light.py -v |
| 204 | ``` | 202 | ``` |
| 205 | 203 | ||
| 204 | ### Through the Xbox D3D12 device | ||
| 205 | |||
| 206 | Generate the reference with `--camera --run`. In PowerShell, set `$work` to the First Light workspace and | ||
| 207 | `$build` to the CMake build directory, then point the section 5 CTest at the camera output. | ||
| 208 | |||
| 209 | ```powershell | ||
| 210 | $env:LEONIDA_FIRST_LIGHT_DIR = Join-Path $work 'first_light/camera' | ||
| 211 | ctest --test-dir $build -C RelWithDebInfo -R '^d3d12_first_light$' --output-on-failure -V | ||
| 212 | ``` | ||
| 213 | |||
| 214 | The fixture uploads the two matrices beside the mesh in a DEFAULT buffer. It creates two CBVs in slots 1 and 3 | ||
| 215 | of a shader-visible heap and binds that table with `SetGraphicsRootDescriptorTable`. The first graphics root dword | ||
| 216 | occupies s8, placing the table in s9 as the VS expects. The CPU reference and `vk_harness` use a y-down viewport. | ||
| 217 | The D3D12 draw negates the clip-Y column of the view-projection matrix so the same model point lands on the same | ||
| 218 | pixel in both readbacks. | ||
| 219 | |||
| 220 | On Windows 11 with an RTX 5070 Ti and NVIDIA 617.42, the section 1 model gave the following results at 128×128. | ||
| 221 | Both views also passed with Vulkan synchronization validation enabled. | ||
| 222 | |||
| 223 | | Camera yaw (pitch 25°, FOV 50°) | Covered pixels | Pixels bit-identical to `vk_harness` | CPU UV probes | | ||
| 224 | |---|---:|---:|---:| | ||
| 225 | | 30° | 6,851 | 16,384 / 16,384 | centre + 4 | | ||
| 226 | | 55° | 6,846 | 16,384 / 16,384 | centre + 4 | | ||
| 227 | |||
| 206 | ## 8. Limits and next | 228 | ## 8. Limits and next |
| 207 | 229 | ||
| 208 | * The camera draw (section 7) runs in `vk_harness` only. Through the D3D12 layer, s9 and the table it points at | ||
| 209 | have to come from root arguments, which `d3d12_first_light_test` does not set up yet. | ||
| 210 | * `--camera` and `--dds` don't combine: the camera VS's table and the textured PS's T# both take s9 of the shared | 230 | * `--camera` and `--dds` don't combine: the camera VS's table and the textured PS's T# both take s9 of the shared |
| 211 | push constants and heap VA 0x100, so `first_light.py` refuses the pair. A textured perspective draw needs a | 231 | push constants and heap VA 0x100, so `first_light.py` refuses the pair. A textured perspective draw needs a |
| 212 | second constant layout. | 232 | second constant layout. |
| 213 | * One model and one draw. The `levels.rpf` windows have world props with POSITION/NORMAL/COLOUR/UV layouts that | 233 | * One model and one draw. The `levels.rpf` windows have world props with POSITION/NORMAL/COLOUR/UV layouts that |
| 214 | match the `sga_dr_*`/`Rage_Transform*` families by signature; pairing one of those is the natural next image. | 234 | match the `sga_dr_*`/`Rage_Transform*` families by signature; pairing one of those is the natural next image. |
| 215 | * The game still cannot boot: the executable is not in the package (RT-5), so no call site selects these programs. | 235 | * First Light selects the model and the shader pair explicitly. For observations from the title's own render loop, |
| 236 | see the [Windows first-run UI](first_run_ui.md) and [story-load measurements](linux_proton.md). | ||