mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:10:52 +01:00
[PR #33] TEST-524: first light with a texture — the real model through a game PS that samples a T# #85
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#85
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/33
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:old-pr/2906📝 Commits (8)
c838d60First light with a texture: the real model through a game PS that samples a T# (TEST-524)996591ffirst_light: UV-seam pixels are reported, not guessed, in the textured reference178d4c8first_light: a seam is judged from the latest hit back to the first interior one44db1edfirst_light: the shared-edge shortcut needs a real shared edge16003a6d3d12_first_light_textured_test: read LEONIDA_FIRST_LIGHT_TEX_DIR with _dupenv_s7a08f9fd3d12_first_light_textured_test: the comment on d3d12_textured.raw names no option that doesn't exist5cb119cfirst_light: the ramp's manifest keys no longer collide with the --dds harness path9410b62first_light textured: the PS's pointer SGPR and T# slot come from the PS (13 game copy shaders pass)📊 Changes
5 files changed (+782 additions, -1 deletions)
View changed files
📝
docs/first_light.md(+59 -1)📝
runtime/CMakeLists.txt(+6 -0)➕
runtime/test/d3d12_first_light_textured_test.cpp(+414 -0)📝
tests/test_first_light.py(+141 -0)📝
tools/first_light.py(+162 -0)📄 Description
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):TEST-524, claim. It follows the first light work in
#1906and#2001.Depends on:: merged in round 44, so this PR now sits directly on#2887main.What
The first textured draw of a real game model through translated game shaders and the D3D12 layer. The model is the
data.rpfmesh from#1906/#2001 and the VS is the sameVS_main_170e32e6. The PS is a game pixel shader that samples a texture.The PS, picked by census rather than by hand (counts over the full carve):
image_sampleand no other memory access.shader_link_check.py batch).$PS_PassthroughCopy. It interpolates TEXCOORD,s_loads the T# through the 32-bit table pointer in user SGPRs8, samples with a literal S# (0x92, 0xC00000, 0x14500000, 0: CLAMP_LAST_TEXEL, bilinear, mip point, MAX_LOD 12) and exports withv_cvt_pkrtz_f16_f32.The draw (
runtime/test/d3d12_first_light_textured_test.cpp, ctestd3d12_first_light_textured, package-gated):s0..s7) and [1] a one-SRV table. The layer's packing (docs/d3d12_vulkan.md3.5) lands the table ats8:s9, exactly where the game's PS reads it.CopyTextureRegioninto a DEFAULT texture, andCreateShaderResourceViewwrites its T# into a shader-visible heap.#2887).The oracle.
first_light.py --texture rampwritestexture.bin, a 64×64 R16G16B16A16_FLOAT coordinate ramp in which texel (x, y) holds its own centre. Bilinear sampling with clamp therefore gives back the UV, clamped to the outer texel centres.expected.raw, the CPU reference: the ramp sampled at every covered pixel's interpolated UV (uv_map, the same last-triangle-wins rule asuv_at).Result: RTX 3060, Windows 11, driver 616.64, Vulkan SDK 1.4.363.1
#2887)#2887The coverage is the same 12,804 pixels as
d3d12_first_light, which still passes, as do the other D3D12 tests (d3d12_m2_textured,d3d12_descriptor,d3d12_vulkan_device,d3d12_translated_draw,d3d12_pipeline_library,shader_library).This test is how
#2887was found. Every value came out as a texel centre, which is point sampling, because the literal S# had never been registered and the lookup found the fallback sampler.Tests without the package
tests/test_first_light.pyaddsTexturedOracleTests:uv_mapequal touv_atat every pixel of two overlapping triangles;@whattheflop's diagonal quad, both draw orders give the same 24 seam pixels and identical pixels everywhere else.15 tests run; the 3 package-gated ones skip.
Not in this PR
A real albedo. The path a game texture takes is the same T#, table and literal S#; what remains is decoding the model's own TTPF texture into
texture.binand comparing it with a CPU bilinear reference.docs/first_light.md§7 lists this as the next step.No game data in the PR. The mesh, shaders, texture and drawn image stay in the user's work folder.
Thanks
@whattheflopfor the review and the diagonal-quad fixture that showed a UV seam could fail a correct draw; seam pixels are now reported and that fixture is a unit test.@JRamos1993for the RTX 5090 run (131/131, both textured tests 20/20 and clean under validation) and the C4996 report.@kapitchefor the RTX 4080 SUPER (130/130) and Intel UHD 770 runs, the first non-NVIDIA pass of both textured tests.@zzEmmazzfor rebuilding the inputs from their own copy and the first AMD run (Ryzen RDNA2 iGPU: worst 0.00077) next to an RTX 3070, red and green on both.@nschlaepferfor the RTX 5090 run and the first Apple result (M3 Max through MoltenVK), with a point-sampling and missing-literal-sampler sensitivity check (19,041 channels over on both).@Vonsekfor the10d3eb4run on an AMD RDNA2 iGPU (26.10.1) and an RTX 5080 (616.92).@Ayinakifor the first independent run of the textured draw on their own package (RTX 5070, another model: 2,615 pixels, worst 0.00031).@sh1shu1for the9410b624run on an RTX 4070 SUPER with MSVC: pass, with the full ctest and GPU suite compared against main.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.