upleb.uk

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

summaryrefslogtreecommitdiff
path: root/docs/first_light.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/first_light.md')
-rw-r--r--docs/first_light.md35
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
104Without `LEONIDA_FIRST_LIGHT_DIR` the test prints SKIP and exits 77. 104Without `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
108Passing `--dds <exported.dds>` to `tools/first_light.py` switches the default pixel shader to a translated
109single-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
119set 0 (`binding 0` 2D images with a 1×1 magenta fallback at index 0 and the decoded texture at index 1; `binding 1`
120samplers with the decoded `S#` at index 1; `binding 2` the `DescriptorTable` hash buffer), and draws the mesh.
121
122The 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
124magenta 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
128package). With `LEONIDA_FIRST_LIGHT_DIR` set against a local package run, all **14/14** tests pass.
129
130```sh
131python -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
134LEONIDA_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.