mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:00:52 +01:00
[PR #35] TEST-924: every texture format the game uses, from a real game texture, through the D3D12 layer (all 20 formats) #88
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#88
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/35
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:old-pr/4251📝 Commits (10+)
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)cbe4c99first light: every texture format the game uses, from a real texture, through the D3D12 layera52ce94docs/first_light.md §8: all 20 game texture formats run through the layer📊 Changes
5 files changed (+1168 additions, -1 deletions)
View changed files
📝
docs/first_light.md(+124 -1)📝
runtime/CMakeLists.txt(+6 -0)➕
runtime/test/d3d12_first_light_textured_test.cpp(+453 -0)📝
tests/test_first_light.py(+229 -0)📝
tools/first_light.py(+356 -0)📄 Description
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):Claim (new TEST item).
Depends on:
#2906(and through it on#2887). Its commits are the base here; only the top commit,b90d802b, is new.What
This checks every texture format the game actually uses by sampling a real game texture through the D3D12 layer, each in its own format, BC blocks included.
The package's 357,115 TTPF descriptors use 20 DXGI formats, counted on my 1.0.2.1 copy:
The changes:
first_light.py --texture-dds <file>reads a DX10 DDS's mip 0 (asttpf_mips.py exportwrites it) intotexture.binin its own format. It writes the CPU reference toexpected.raw, decoded withttpf_mips.decode_pixelsand these per-format rules:d3d12_first_light_textureduploads block-compressed formats (rows of 4×4 blocks) and skips NaN channels.dds_tolerance).Result: RTX 3060, driver 616.64, one game texture per format with ≥ 64 distinct values
| RGBA16F (256×2), RGBA16 UNORM (128×4) | ≤ 0.0045 | 2/255 | pass |
| RGBA8 sRGB (4×4, uniform: a weak case) | 0 | 2/255 | pass |
All 20 formats pass. RGBA8 sRGB's only 2D texture in the package is a uniform 4×4. Its sRGB decode is the same one that BGRA8 sRGB and the BC sRGB rows exercise with real content.
Why some tolerances are wider (a measurement, not a guess). It's the decoder arithmetic, not the layer. I regenerated the BC1/BC3 reference with different palette arithmetic: integer weights
(43a + 21b + 32) >> 6match the RTX 3060's output 5–7× better than the exact(2a + b) / 3thatttpf_mipsuses (the channels over 2/255 drop from 287 to 40 for BC1 and from 892 to 355 for BC3). BC4/BC5 interpolate their palette above 8 bits.Negative control. I declared the BC1 sRGB texture as BC1 UNORM, the bug a layer that drops the sRGB decode would have. That gives a worst error of 0.31 with 28,829 channels over, and the test fails. Every tolerance is under 0.05, which a unit test pins.
Tests without the package
tests/test_first_light.py, 32 run (4 package-gated skips):The ramp result from
#2906is unchanged (worst 0.00028).No texture data, shaders or images are in the PR; everything stays in the user's work folder.
Thanks
@CaravelaLabsfor the AMD RADV run (GFX1151) that caughtps_m2_literalmissing from the GPU runner's harness map (fixed in#2887,5cd7fe73).@SweatierKeyfor the code read and CPU checks of the whole stack at81f91972(Linux).@thronyfor the RTX 4080 run with another model and 24 textures that showed the reference needed to allow for the GPU's sub-pixel snapping (fixed inf50b4844).@traeb0nfor the RTX 5070 run of everything that needs no game files (150/150 under validation).@SpositoDouglasfor the AMD RDNA4 Windows run (RX 9060 XT, 154/154 ctest with validation,ps_m2_literalchecks pass).@KorahX365for the AMD RX 6600 Windows build and test run.@465d6a0eacfor the RTX 3070 Ti re-run ofbd7b4567with two models (28/28 draws, plus the missed-sRGB control), and for the note on model choice, now in §9 (39c63602).@elderdragon0for thebd7b4567run on an RX 5700 XT (RDNA 1) with six textures from a local export: 7/7 cases, the first RDNA 1 result.Update: the reference allows for sub-pixel snapping (
f50b4844)@throny's run on another model failed on a few hundred channels. Two rasteriser effects explained every one:The reference now treats a sample within 1/128 px of an edge as an edge sample. It also writes a per-pixel band,
expected_band.raw: how much its value changes when the sample moves 1/32 px along the UV gradient. Float formats get a relative tolerance.Re-run on 4 game models × 37 textures (all 20 formats): 148/148 pass, 0 channels over. The missed-sRGB control still fails (9,992 channels over).
@elderdragon0: tested on RX 5700 XT.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.