[PR #2085] d3d12: one guarded copy per run of adjacent written geometry tiles (RT-GEOMETRY-READBACK-RUN-MERGE) #2093

Open
opened 2026-11-26 21:20:00 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2085
Author: @BubsMcgee
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: geometry-adjacent-runs


📝 Commits (2)

  • 1942656 d3d12: one guarded copy per run of adjacent written geometry tiles (RT-GEOMETRY-READBACK-RUN-MERGE)
  • 82169e0 d3d12: clear geometry readback lists at refresh start and cap runs at 1 MiB

📊 Changes

2 files changed (+68 additions, -3 deletions)

View changed files

📝 runtime/shims/d3d12_geometry_views.h (+47 -2)
📝 runtime/test/geometry_views_test.cpp (+21 -1)

📄 Description

A GeometryViews refresh copies only the 64 KiB tiles the title wrote (the page diffing already there), but it reads each written tile with its own readability probe and guarded copy. When the title writes a run of tiles across tile boundaries, that is one probe and one copy per 64 KiB for data that is contiguous in title memory.

This groups the written tiles (already in address order) into maximal runs whose addresses differ by one tile, and reads a run a ready view needs as one guarded copy. The per-tile pass then reuses those bytes through read_tile(). A run that cannot be read whole (an uncommitted page inside it) falls back to the per-tile reads, so the zeroing behaviour is unchanged. Whole-view refreshes (LEONIDA_GEOMETRY_WHOLE_VIEWS=1) read nothing here, as before.

Same behaviour as DexNom/VIctory's copy_fetch_runs (crates/victory-gpu/src/host.rs, GPL-3.0-or-later, commit 570a941), re-implemented for this header; no identifiers or code copied. docs/related_projects.md already credits the VIctory readback work.

Files

  • runtime/shims/d3d12_geometry_views.h: read_run() / run_needed() and the run grouping in refresh().
  • runtime/test/geometry_views_test.cpp: case 5, two address-adjacent written tiles of one view are one 128 KiB copy (case 4's non-adjacent tiles stay two 64 KiB copies).

Tests

  • geometry_views_test: 14/14 checks pass (synthetic, fake Vulkan device, no game data or GPU).
  • gta6rt_d3d12_com builds (MSVC 19.44, Windows 11 26300; RTX 3080 Ti on 616.64 present but not needed by the test).

Claimed as RT-GEOMETRY-READBACK-RUN-MERGE in the coordination issue. Independent of #1678, which touches only d3d12_title_buffer_windows.h. No game data. AI-assisted (opencode). Depends on: none.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2085 **Author:** [@BubsMcgee](https://github.com/BubsMcgee) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `geometry-adjacent-runs` --- ### 📝 Commits (2) - [`1942656`](https://github.com/ubiquitarianism/leonida/commit/194265665cda15e2f74c166d84fcd7c018fcb8ca) d3d12: one guarded copy per run of adjacent written geometry tiles (RT-GEOMETRY-READBACK-RUN-MERGE) - [`82169e0`](https://github.com/ubiquitarianism/leonida/commit/82169e0e0311f61bed2ef6fd8561ee36bb681f2b) d3d12: clear geometry readback lists at refresh start and cap runs at 1 MiB ### 📊 Changes **2 files changed** (+68 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/d3d12_geometry_views.h` (+47 -2) 📝 `runtime/test/geometry_views_test.cpp` (+21 -1) </details> ### 📄 Description A `GeometryViews` refresh copies only the 64 KiB tiles the title wrote (the page diffing already there), but it reads each written tile with its own readability probe and guarded copy. When the title writes a run of tiles across tile boundaries, that is one probe and one copy per 64 KiB for data that is contiguous in title memory. This groups the written tiles (already in address order) into maximal runs whose addresses differ by one tile, and reads a run a ready view needs as **one guarded copy**. The per-tile pass then reuses those bytes through `read_tile()`. A run that cannot be read whole (an uncommitted page inside it) falls back to the per-tile reads, so the zeroing behaviour is unchanged. Whole-view refreshes (`LEONIDA_GEOMETRY_WHOLE_VIEWS=1`) read nothing here, as before. Same behaviour as DexNom/VIctory's `copy_fetch_runs` (`crates/victory-gpu/src/host.rs`, GPL-3.0-or-later, commit `570a941`), re-implemented for this header; no identifiers or code copied. `docs/related_projects.md` already credits the VIctory readback work. ## Files - `runtime/shims/d3d12_geometry_views.h`: `read_run()` / `run_needed()` and the run grouping in `refresh()`. - `runtime/test/geometry_views_test.cpp`: case 5, two address-adjacent written tiles of one view are one 128 KiB copy (case 4's non-adjacent tiles stay two 64 KiB copies). ## Tests - `geometry_views_test`: 14/14 checks pass (synthetic, fake Vulkan device, no game data or GPU). - `gta6rt_d3d12_com` builds (MSVC 19.44, Windows 11 26300; RTX 3080 Ti on 616.64 present but not needed by the test). Claimed as `RT-GEOMETRY-READBACK-RUN-MERGE` in the coordination issue. Independent of #1678, which touches only `d3d12_title_buffer_windows.h`. No game data. AI-assisted (opencode). Depends on: none. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#2093
No description provided.