Repository navigation
Conversation
…ples a T# (TEST-524) d3d12_first_light_textured_test draws the first-light mesh through the D3D12 layer with the game's VS and $PS_PassthroughCopy, picked by census (780 of 12,101 PS do one image_sample and nothing else; 148 of those link with the VS). The PS loads its T# through the table pointer in s8 and samples with a literal S#; the root signature puts a one-SRV table at s8:s9 behind eight padding constants. first_light.py --texture ramp writes texture.bin, a 64x64 coordinate ramp (texel (x, y) holds its own centre, so bilinear sampling gives back the UV), and expected.raw, the CPU reference at every covered pixel's UV. RTX 3060: 12,804 pixels, the same coverage as d3d12_first_light, worst channel error 0.00028 against a 0.002 tolerance; point sampling is off by up to 1/128, which is what this draw gave before #2887. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d reference A sample on a shared edge between triangles that give it different UVs belongs to whichever triangle the rasteriser's tie-break rule picks; uv_map let the last one win, so a correct draw could fail at a seam. Those pixels are now marked in expected.raw (alpha -2): coverage is still checked, the colour is not, and the test counts them. Found by @whattheflop's diagonal-quad fixture, which is now a unit test. The first-light model has no seam pixels; its result is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nterior one An earlier edge no longer exempts a pixel that a later interior owns (@whattheflop's nested-triangle fixture), and a lone edge over an older interior with another UV is ambiguous. Edge hits after the last interior that share one UV are an edge both triangles share, which the tie-break gives to one of them: not ambiguous. Without that rule the flattened first-light model's front layer, drawn over its back layer, marked 188 pixels; with it, 0, and all 12,804 are compared. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Equal UVs don't make two triangles share an edge. The rasteriser gives one owner only to triangles on opposite sides of a common edge with identical endpoints, so the shortcut now requires such a pair among the later edge hits; a sample on a vertex never takes it. @whattheflop's overlapping right edges (same side, different endpoints) stay ambiguous. The first-light model: 8 ambiguous samples, 12,796 compared, unchanged worst error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h _dupenv_s MSVC warns about std::getenv (C4996); pe_loader_test reads its environment the same way. Reported by @JRamos1993. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mes no option that doesn't exist Reported by @zzEmmazz. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s harness path Since the rebase onto 7e1aecf, --texture ramp exited with a TypeError: write_textured_inputs stored "texture": "ramp" and files["texture"], which harness_env reads as the --dds dict. The ramp's keys are now layer_texture*; a unit test feeds harness_env a ramp manifest (fails on the old keys). The vk_harness tests skip a ramp folder, which only the D3D12-layer test can draw. docs/first_light.md §7: the command names its --out, and the count without #2887 is 19,041 channels (measured here and on three other GPUs). Found by @zzEmmazz. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… PS (13 game copy shaders pass) d3d12_first_light_textured fixed the table at s8 and the T# at slot 0. It now reads layer_ptr_sgpr (from the index's user_sgpr_reads) and layer_tsharp_offset (the PS's first s_load_dwordx8 offset), pads the root signature to that SGPR and puts the SRV in that slot, so any 2D copy PS can be checked. Of the 24 copy PS that link with the first-light VS, all 13 comparable ones pass on an RTX 3060 with worst error 0.00028 (11 plain copies, 2 that remap channels, checked per channel); 7 transform the UV and 4 use array/cube textures. docs/first_light.md §7 has the table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.