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/first_light.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/first_light.md')
| -rw-r--r-- | docs/first_light.md | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/docs/first_light.md b/docs/first_light.md index 60013c4cf..6f15a134e 100644 --- a/docs/first_light.md +++ b/docs/first_light.md | |||
| @@ -103,12 +103,41 @@ LEONIDA_FIRST_LIGHT_DIR=~/leonida-work/first_light/out ctest --test-dir <build> | |||
| 103 | 103 | ||
| 104 | Without `LEONIDA_FIRST_LIGHT_DIR` the test prints SKIP and exits 77. | 104 | Without `LEONIDA_FIRST_LIGHT_DIR` the test prints SKIP and exits 77. |
| 105 | 105 | ||
| 106 | ## 6. Limits and next | 106 | ## 6. With a texture (`TEST-524`) |
| 107 | |||
| 108 | Passing `--dds <exported.dds>` to `tools/first_light.py` switches the default pixel shader to a translated | ||
| 109 | single-sample game pixel shader (`PS_Copy_3ea4b38a_Wrapped`, FSSM SHA-256 | ||
| 110 | `19e2e7612505b9d3b19e6607b47e09dcdde02a2c9987a63e834d9586f217090f`, wave32, `inputs=[0]`, `outputs=[0]`, | ||
| 111 | `shader_link_check.py check`: compatible with `VS_main_170e32e6_Wrapped`). `first_light.py` decodes the DDS | ||
| 112 | (for example a BCPack-decoded TTPF albedo) with `tools/dds_png.py`, writes `texture.rgba` (`u32 width, u32 height` + | ||
| 113 | `R8G8B8A8_UNORM` texels) into the output folder, and passes `VKH_TEX_RGBA`, `VKH_TSHARP_VA` (`0x100`), | ||
| 114 | `VKH_SSHARP` (the shader's literal sampler `0x92, 0xc00000, 0x14500000, 0`, bilinear + clamp-to-edge) and | ||
| 115 | `VKH_SGPRS` (`s9 = 0x100`) to `vk_harness`. | ||
| 116 | |||
| 117 | `vk_harness` enables `bufferDeviceAddress`, `runtimeDescriptorArray` and `descriptorIndexing` only when | ||
| 118 | `VKH_TEX_RGBA` is set (inert otherwise), writes the 8-dword `T#` at `VKH_TSHARP_VA` in the 64 KiB heap, binds | ||
| 119 | set 0 (`binding 0` 2D images with a 1×1 magenta fallback at index 0 and the decoded texture at index 1; `binding 1` | ||
| 120 | samplers with the decoded `S#` at index 1; `binding 2` the `DescriptorTable` hash buffer), and draws the mesh. | ||
| 121 | |||
| 122 | The CPU oracle (`check_image`) samples the decoded `R8G8B8A8_UNORM` texture bilinearly (clamp-to-edge) at | ||
| 123 | `centre_uv` and each `uv_probes` entry and requires the GPU readback to match within `0.02` (rejecting the | ||
| 124 | magenta unbound-texture fallback and wrong-colour probes). Verified on Windows 11 with an NVIDIA GeForce RTX 3060 | ||
| 125 | (driver 621.24, Vulkan 1.4.357): **12,804/16,384 (0.781)** covered. Without `LEONIDA_FIRST_LIGHT_DIR`, | ||
| 126 | `python -I tests/test_first_light.py -v` runs **14 tests: 11 passed, 3 skipped** (the 3 package-gated | ||
| 127 | `FirstLightTests` require `LEONIDA_FIRST_LIGHT_DIR`; the 4 `OracleTests` and 7 `TexturedOracleTests` run without a | ||
| 128 | package). With `LEONIDA_FIRST_LIGHT_DIR` set against a local package run, all **14/14** tests pass. | ||
| 129 | |||
| 130 | ```sh | ||
| 131 | python -I tools/first_light.py --game "<package>" --work ~/leonida-work \ | ||
| 132 | --obj ~/leonida-work/assets/data/models/<model>.obj \ | ||
| 133 | --dds ~/leonida-work/assets/ttpf/<pool>/<texture>.dds --no-fit --run | ||
| 134 | LEONIDA_FIRST_LIGHT_DIR=~/leonida-work/first_light/out python -I tests/test_first_light.py -v | ||
| 135 | ``` | ||
| 136 | |||
| 137 | ## 7. Limits and next | ||
| 107 | 138 | ||
| 108 | * The chosen VS applies no matrix; the tool's fit is an orthographic stand-in for the game's view/projection. A | 139 | * The chosen VS applies no matrix; the tool's fit is an orthographic stand-in for the game's view/projection. A |
| 109 | real camera needs a VS that reads its constants, which is the next model/shader pair. | 140 | real camera needs a VS that reads its constants, which is the next model/shader pair. |
| 110 | * No texture: the PS writes the UV map. A texture path needs a TTPF albedo, BCPack decode, a T# in the bindless | ||
| 111 | set and the game's sampler. | ||
| 112 | * One model and one draw. The `levels.rpf` windows have world props with POSITION/NORMAL/COLOUR/UV layouts that | 141 | * One model and one draw. The `levels.rpf` windows have world props with POSITION/NORMAL/COLOUR/UV layouts that |
| 113 | match the `sga_dr_*`/`Rage_Transform*` families by signature; pairing one of those is the natural next image. | 142 | match the `sga_dr_*`/`Rage_Transform*` families by signature; pairing one of those is the natural next image. |
| 114 | * The game still cannot boot: the executable is not in the package (RT-5), so no call site selects these programs. | 143 | * The game still cannot boot: the executable is not in the package (RT-5), so no call site selects these programs. |