Skip to content

tests: draw the First Light perspective camera through D3D12 (TEST-D3D12-FIRST-LIGHT-CAMERA) - #1540

Merged
MoonEyes merged 1 commit into
ProjectLeonida:mainfrom
Rain156:rain/d3d12-first-light-camera
Nov 29, 2026
Merged

MoonEyes merged 1 commit into
ProjectLeonida:mainfrom
Rain156:rain/d3d12-first-light-camera

Conversation

@Rain156

@Rain156 Rain156 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: TEST-D3D12-FIRST-LIGHT-CAMERA. Claim

Depends on: #939, #974 (both merged).

What and why

The First Light camera already had a CPU projection and a Vulkan reference image. Its Xbox D3D12 device fixture used an empty root signature, so the same local mesh and shader pair produced a clear target in both camera poses. The fixture now uploads the world and view-projection matrices, creates the two CBVs in their measured descriptor slots, and binds the table through the graphics root signature. It converts the projection to the D3D12 viewport convention before comparing the readbacks. The runbook includes the Windows CTest command.

This is an offscreen draw through the Xbox device proxy and its Windows SDK command list. The model, shader containers and reference images stayed in the local work directory.

Tested

Windows 11 x64, MSVC RelWithDebInfo, NVIDIA GeForce RTX 5070 Ti, driver 617.42. Final build and GPU tests on main bfef489cb.

  • A local Xbox 1.0.2.1 model with 4,213 vertices and 7,968 triangles. The unmodified fixture on 0bc810504 covered 0 of 16,384 pixels at both 30° and 55° yaw. The updated D3D12 fixture covered 6,851 and 6,846 respectively. Each complete 128×128 image matched its independent vk_harness readback bit for bit and passed the centre and four CPU UV probes. Both angles and the orthographic control passed again under Khronos synchronization validation.

  • The two camera images differ at 6,862 pixels. The fixture rejected a substituted camera pose, a zero world matrix, an incomplete matrix row and a changed reference pixel. An older orthographic manifest with the camera field omitted passed.

  • The 48 First Light Python checks passed with the local package fixture enabled. Eight related native CTests passed, covering root arguments, depth resolve, translated and derived draws, compute and mesh. All 6,279 translator tests passed across 487 files. Documentation link and changed-file game-data checks passed.

  • Separate retail smoke test of the same runtime in a zero-capability AppContainer, using the locally rebuilt shader library from b07b9ecb0: the last sampled present was frame 24,321. All 96 sampled swapchain images were black. The title stopped at a breakpoint after 139 seconds. The trigger is still unidentified.

AI-assisted: Yes (Codex).

The claim linked above was posted before this PR. Issue #14 reached GitHub's 2,500-comment limit before the completion notice could be posted.

@PierreEbele

Copy link
Copy Markdown
Contributor

Reviewed 6e3a442: ran tests/test_first_light.py (48 OK, 4 skipped) and check_no_game_data.py on the changed files, plus a CPU probe replaying your CBV layout (world 256 B, view 512 B, viewproj at 0x160), clip-Y column negation and row mapping against first_light.py's camera oracle: CBV bytes, V# slots 1/3 (0x20/0x60) and the s8/s9 placement all agree; the passthrough path is unchanged. I could not run or compile the D3D12 fixture itself (no MSVC/GPU/package here), so the C++ was only read and the RTX 5070 Ti table stands as reported. No findings.

AI-assisted review.

Recommendation: Merge

@OreoFR

OreoFR commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Verified by OreoFR

  • Base: main c1ecf04ed + PR head 6e3a44259; green run in a merge package of 15 PRs, no new ctest failure vs main
  • Test: ctest -R ^d3d12_first_light$
  • Red on main: SKIP
  • Green with the PR: SKIP (builds)
  • Verdict: READY (build only) (test-only PR; the test needs LEONIDA_FIRST_LIGHT_DIR produced by tools/first_light.py from the game package, not run)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

@enlight3d

Copy link
Copy Markdown
Contributor

Run of #1540 (d3d12_first_light), red then green, with a real First Light folder (not a skip).

  • PR head: 6e3a442 (base bfef489). Main tested: 1bc055e. git merge-tree --write-tree of main and the head is clean.
  • GPU/driver: NVIDIA GeForce RTX 3090 24 GB, driver 621.40. OS: Windows 11 Pro 10.0.26300. MSVC 19.44 (VS 2022 Build Tools), CMake 3.31.6, Ninja 1.12.1, RelWithDebInfo.
  • Only the targets the test needs were built (d3d12_first_light_test, vk_harness), not the whole runtime.

Commands (vcvars64 shell, build folder inside the worktree):

cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON
cmake --build runtime/build --target d3d12_first_light_test vk_harness -j 8
python -I tools/first_light.py --game <package> --work <work> --obj <model.obj> --camera --run --harness <build>/vk_harness.exe
set LEONIDA_FIRST_LIGHT_DIR=<first-light-dir>   (= <work>/first_light/camera)
ctest -C RelWithDebInfo -R "^d3d12_first_light$" --output-on-failure -V

The folder came from the tool at the PR head, with the section 1 model (sha256 matches docs/first_light.md) and the carved containers of the same package. first_light.py drew 6,851 of 16,384 pixels, as in the docs. The test executable was deleted before each ctest, so a stale binary could not pass.

Green (PR head, PR test): builds, d3d12_first_light Passed (1/1, 0.49 s, not skipped). Output: 6,851 of 16,384 pixels covered, clear corner kept, centre pixel and the 4 UV probes match, 16,384 of 16,384 pixels bit-exact against vk_harness's image.raw.

Red (PR head with runtime/test/d3d12_first_light_test.cpp put back to its base version; the PR changes only that file and docs): d3d12_first_light Failed, 0 of 1 passed. The old fixture draws with an empty root signature: covered 0 of 16,384 pixels, so the coverage check fails.

Red on main (1bc055e as is, same folder): Failed the same way, covered 0 of 16,384.
Green on main (1bc055e plus the PR's test file only): Passed (1/1, 0.44 s), same numbers as above.

Control: the same ctest without LEONIDA_FIRST_LIGHT_DIR is Skipped (exit 77), so the earlier SKIP-only reports are from the missing folder, not from the test.

Verdict: the test runs for real with the folder and passes with the PR (at the PR head and on current main), and fails at 0 coverage without it.

@MoonEyes
MoonEyes merged commit fd42898 into ProjectLeonida:main Nov 29, 2026
5 of 12 checks passed
@MoonEyes

Copy link
Copy Markdown
Collaborator

Merged after enlight3d (Thib)'s red/green run (RUN, RTX 3090, driver 621.40, Windows 11: green with this PR, red without it, and gta6rt.exe still links) and a re-check here: no conflict with main 5d0a501, same head as run, no-game-data green, and the only ctest failures in the Windows/macOS CI jobs are tests this diff does not touch (known on main or Vulkan: vk_xdxr_postbuild_readback vk_bindless_dimensions d3d12_compile_pool xbox_present ).

AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants