Repository navigation
First Light: ignore depth-clipped fragments when checking GPU draws (TEST-870) - #3967
Merged
ItsNotRexed merged 1 commit intoNov 23, 2026
Merged
Conversation
Skip clipped fragments when retained mesh depth crosses the near or far plane. Check partial triangles, visibility in draw order, and clear probes with synthetic geometry (TEST-870).
Contributor
|
Tested 98a9f7e on Windows, CPython 3.14.7, CPU only (no GPU, no game files): pass.
I compared I did not test a GPU draw. I found no defect. AI-assisted. |
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.
Related issue
TEST-870, claimed in the coordination thread.
Problem
First Light could reject a correct GPU draw with
--keep-zor--no-fit. Onaa2988cc, an overlapping triangle beyond the far clip plane supplied the expected centre UV(0.75, 0.125). The RTX actually drew the visible triangle underneath, giving(0.125, 0.75). The previous manifest madefirst_light.py --checkexit 1.Root cause and solution
The CPU chose the last triangle covering the pixel in XY, including portions clipped in Z. The harness disables depth testing, but Vulkan still clips primitives. For the existing passthrough vertex shader (
w=1), interpolate the float32 mesh depths at the pixel centre and accept the fragment only within[0, 1]. This feeds centre UVs, texture probes and clear-corner selection. Visible triangles still win in draw order. Vulkan primitive clipping.Tests
Windows, NVIDIA GeForce RTX 5070 Ti, driver 621.35. A synthetic passthrough vertex shader and UV-output fragment shader were assembled with
tools/spirv_asm.pyand run withvk_harnessat 64×64. Each scene drew a background triangle, followed by an overlapping triangle with the depths below. The same raw readback was compared to each revision ofuv_at. Each row covers 21 interior pixels with RGBA tolerance 0.002.aa2988ccpython -I tools/first_light.py --check --out <fixture> --harness <vk_harness.exe>exit 0 on the same GPU, with 1,568 of 4,096 pixels covered.python -I tests/test_first_light.py -vwithLEONIDA_VK_HARNESSset passed 18 tests. Three tests requiring a prepared game draw were skipped. The two new methods produced five failures against the base implementation.python -I tests/test_first_light_harness_paths.pypassed 4 tests.python -I tests/test_first_light_bad_json.pypassed 9.python -m compileall -q make_game.py tools testsandgit diff --cached --checksucceeded.Compatibility and limitations
The change applies to the existing orthographic probe calculation, builds directly on
main, and keeps the manifest format. Existing bundles need their manifest regenerated to pick up corrected probes. The hardware comparison used synthetic draws and sampled away from raster edges. The retail corpus and the separate perspective-camera proposal in #2855 were not tested.AI assistance
AI-assisted with OpenAI Codex (requested model GPT-6.2 Astra), including independent GPU reproduction.