Repository navigation
PR 0085 Vulkan avoid false surface readbacks for adjacent vertex data
- GitHub state: Open draft
- Disposition at review: HOLD
-
Current head at review:
0883fb63009c6cc804681cbdb39e4454b44d8456(fix/vulkan-vertex-surface-freshness) -
Reviewed head:
0883fb63009c6cc804681cbdb39e4454b44d8456 - Last reviewed: 2026-09-14 UTC
-
Base:
mainat9148241de690617ac0a21a26b41858585c1e3cab - Subsystem: Vulkan memory / synchronization
Review freshness: current at the reviewed head. Before acting on this open/draft PR, compare the live GitHub head with Reviewed head below. If it differs, treat implementation details, file impact, flow, and result qualification as stale until re-reviewed. The historical lesson remains valid unless newer evidence explicitly overturns it.
- What it changes: Vulkan: avoid false surface readbacks for adjacent vertex data
- Why it was attempted: A vertex request is widened to dirty-memory pages for upload. The old code used that wider range to decide whether to download a GPU-authored surface. In the pinned Morrowind snapshot, adjacent pages created false overlaps and expensive SURFACE DOWN waits. This PR checks surface overlap on the pre-alignment request and retains page-aligned dirty tracking and ordered vertex upload. It also marks the vertex mirror dirty after successful readback. Code: vk/v…
- Current/final result: Open draft/HOLD correctness work: exact vertex-fetch ranges and surface freshness are being repaired and remain prerequisites for later vertex fast paths.
- Lesson: Before CPU-side vertex decoding/upload, prove guest memory is authoritative for the exact fetched range when GPU-authored surfaces may overlap it; coherency must precede optimization.
| Implementation file | Δ | Why it matters |
|---|---|---|
hw/xbox/nv2a/pgraph/vk/draw.c |
+45/-21 | Vulkan draw preparation/recording and the PR hot-path decision. |
hw/xbox/nv2a/pgraph/vk/renderer.c |
+2/-2 | Renderer lifecycle, pending work, synchronization, or teardown ownership. |
hw/xbox/nv2a/pgraph/vk/renderer.h |
+5/-2 | Renderer-owned state needed by the implementation. |
hw/xbox/nv2a/pgraph/vk/surface.c |
+8/-4 | Surface ownership, overlap, readback, upload, or freshness path. |
hw/xbox/nv2a/pgraph/vk/vertex-fetch-span.h |
+52/-0 | Vertex range calculation, upload, storage, or command-buffer lifetime path. |
hw/xbox/nv2a/pgraph/vk/vertex.c |
+68/-21 | Vertex range calculation, upload, storage, or command-buffer lifetime path. |
tests/unit/meson.build |
+1/-0 | Focused/regression validation for the implementation contract. |
tests/unit/test-xbox-vk-vertex-fetch-span.c |
+57/-0 | Focused/regression validation for the implementation contract. |
flowchart LR
subgraph Before
A[Guest vertex bytes change] --> B[Resolve source/freshness] --> C[Upload/storage ordering] --> D[Draw]
end
subgraph PR_85[PR #85]
E[Guest vertex bytes change] --> F[PR #85 lifetime/bounds rule] --> G[Qualified fast path or safe fallback] --> H[Draw]
end
This PR changes the implementation paths listed in Code impact to implement or test “Vulkan: avoid false surface readbacks for adjacent vertex data”. The file table is the quick source map; use the linked PR diff for line-level mechanics.
Open draft/HOLD correctness work: exact vertex-fetch ranges and surface freshness are being repaired and remain prerequisites for later vertex fast paths.
Before CPU-side vertex decoding/upload, prove guest memory is authoritative for the exact fetched range when GPU-authored surfaces may overlap it; coherency must precede optimization.
Do not skip surface readback from a broad dirty-bit assumption, and do not use oversized overlap ranges that turn correctness checks into unnecessary synchronization.
Pointers only; the detailed evidence remains in its original location.
- https://github.com/Mainkill1/xemu-perf-tests/blob/evidence/pr89-vulkan-vertex-versions/docs/evidence/pr89-vertex-repair-20260912/SURFACE-VERTEX-ORACLE.md
- https://github.com/Mainkill1/xemu-perf-tests/releases/tag/suite-57c2438-20260912
- https://github.com/Mainkill1/xemu-perf-tests/blob/evidence/pr89-vulkan-vertex-versions/docs/evidence/pr89-vertex-repair-20260912/RECONCILED.md
- https://github.com/Mainkill1/xemu-perf-tests/blob/evidence/pr89-vulkan-vertex-versions/docs/evidence/pr89-vertex-repair-20260912/CACHE-EXPERIMENT.md
- https://github.com/Mainkill1/xemu-perf-tests/blob/evidence/pr89-vulkan-vertex-versions/docs/evidence/pr89-vertex-repair-20260912/CPU-ATTRIBUTION.md
- https://github.com/Mainkill1/xemu-perf-tests/blob/evidence/pr89-vulkan-vertex-versions/docs/evidence/pr89-vertex-repair-20260912/REPORT.md
- https://github.com/Mainkill1/xemu-perf-tests/pull/36
- https://github.com/Mainkill1/xemu-perf-tests/blob/evidence/pr89-vulkan-vertex-versions/docs/evidence/pr89-vertex-repair-20260912/BUILD-AUDIT.md
- https://github.com/Mainkill1/xemu-perf-tests/blob/65d6d37/docs/evidence/pr85-vertex-surface-20260912/REPORT.md
- https://github.com/Mainkill1/xemu-perf-tests/blob/65d6d37/docs/evidence/pr85-vertex-surface-20260912/review-pr85-body-20260912.md
docs/evidence/pr89-vertex-repair-20260912/SURFACE-VERTEX-ORACLE.mddocs/evidence/pr89-vertex-repair-20260912/RECONCILED.mddocs/evidence/pr89-vertex-repair-20260912/CACHE-EXPERIMENT.mddocs/evidence/pr89-vertex-repair-20260912/CPU-ATTRIBUTION.mddocs/evidence/pr89-vertex-repair-20260912/REPORT.mddocs/evidence/pr89-vertex-repair-20260912/BUILD-AUDIT.md
Related PRs referenced by this PR:
DSP tooling guide and navigation updated November 2, 2026 for experimental PR #384, source 8f51d237. Capture/replay usage and limits.
The earlier wiki-wide review was published November 1, 2026. Emulator source: b7140848. Reviewed wiki content: 1d2b671. Current status · Release availability · Publication process.
- Home
- Current status
- Stable versus main
- Implemented mechanisms
- Controls and defaults
- Measured results and limits
- Complete change register
- System
- CPU and vCPU
- Memory and DMA
- Graphics / NV2A
- APU and audio
- Timing and timers
- Platform and I/O
- Hardware observations
- Fidelity boundaries
- Methodology
- PGR2 routes
- Debugging lag / hot paths
- Tools and commands
- DSP capture, replay and fuzzing
- HLE readiness and public XISO proof
- Concurrent DSP shadow and OpenAL proof
- DSP HLE operation inventory
- DSP HLE fix examples and testing
- Development
- Upstream shortlist
- Wiki maintenance
- Research / retired work
- Optimization catalog
- Hot-path shortcuts
- Researched experiments
- Unproven proposal directory
- PR lessons
- September26 snapshot
Repository · PRs · Issues