fix(agc): cover the final stride in vertex bindings #26706
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/26706"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by malekaifa on 2026-11-24T16:24:30Z.
What
Fixes #26623.
A strided vertex fetch can end at the last element rather than at the end of its final stride. The reproducer has 3 vertices, a 32-byte stride and a 16-byte element, so the guest bytes actually fetched end at byte 80. AMD's Windows Vega driver 23.19 returns zero for the last vertex with that binding, while the same case passes when the Vulkan-visible buffer covers the complete 96-byte final record.
This keeps the semantic guest read at 80 bytes and separates it from the Vulkan binding capacity:
VertexBindingBytesrounds a nonzero-stride binding up to a whole final stride.DrawInputCopy::guestByteskeeps snapshot/owned-input generations tied to the bytes actually copied from guest memory, so zero padding is never treated as guest content.The descriptor's semantic end remains unchanged; this is only host binding capacity, so callers that reason about guest bytes keep the current behavior.
Tested
main45fc4e23bbcwith no overlap in the five changed files.git diff --check upstream/main...HEAD— pass.python tools/check_conventions.py --base upstream/main— pass (All conventions checks passed.).Graphics/src/Draw.cpp,tests/Graphics.cpp, andtests/Recorder.cpp. Recorder's shader headers were regenerated from the current sources with Vulkan SDK glslang before that check.release-implibs.txtgeneration and, with Ninja, on the ASMMSVC_RUNTIME_LIBRARYsetting. A WSL configure independently stops in the existing SDL PulseAudio patch step before AnyPS5 targets are generated. Hosted CI is the full build/test gate for this head.1002:1638, proprietary driver 23.19.10.08 —agc_driver_zero_vertex_fetch_rangesand_verify_planfail 3/3 on current main; the reporter's experiment extending the range from 80 to the complete 96-byte stride passes 3/3. NVIDIA RTX 3050 Ti on the same laptop passes both before and after that experiment. Intel ANV UHD 630 and llvmpipe also pass the unmodified test 3/3.Checklist
main; no other open PR implements the same fixNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Summary by CodeRabbit
Bug Fixes
Tests
Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-24T16:24:49Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-24T17:29:05Z.
Review: COMMENTED
Intel negative-control / regression run on exact head
2c9ba0be65, merged into maind1d700affa(merge tree a1af27508dcf0e8e29d402fa520a79d6528ee026). The current maina0445a3335still produces the same blobs for all five changed files and ZeroStrideVertexFetch.cpp, and the head remains mergeable.Setup: Windows build 26300; physical Intel RaptorLake-S Mobile Graphics Controller (8086:a78b), driver 101.6127; Intel ICD pinned; WinLibs GCC 15.2.0 r7; Khronos validation 1.4.369 enabled at instance and device level with synchronization validation; robustBufferAccess2=true. Three independent repetitions per arm used fresh test processes (36 physical-Vulkan processes total).
Results:
agc_driver_recorder and agc_draw_input_reuse still fail later with “an unchanged draw input was copied again” 3/3 on both main and the merge. The new growingVertexCopyTests checks completed before that bilateral failure; this is the separate known #20831 behavior, so I am not claiming the whole recorder target passes.
Limit: this Intel adapter already passes the original vertex-fetch case on main, so this run does not reproduce the Vega failure or independently confirm the fix on that AMD driver. It adds a physical Intel no-regression control to the Vega A/B in #26623.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-24T18:24:38Z.
Review: CHANGES_REQUESTED
Requesting changes for an independently reproduced recorder regression on exact head
2c9ba0be65805d1557557763ed72c5e84034e350.On Windows with the NVIDIA GeForce RTX 4070 Laptop GPU (driver 621.01),
agc_driver_recorderfailed in 3/3 fresh processes with the default input-mirror path:The identical binary and fixture passed 3/3 when run with
APS5_NO_INPUT_MIRRORS=1. This was run with the NVIDIA Vulkan ICD pinned,ANYPS5_REQUIRE_VULKAN=1, a cold shader cache, and Khronos validation plus synchronization validation enabled; no VUID or synchronization-validation messages were emitted. The five topic files were applied tod1d700affa94d499003c1fec960e745dca2e23d5; those files remain unchanged on currentmaind855484eab65d43d9e52b641e319fe58aa9e14c4.The failure matches the code path:
ReusableDrawSnapshot(..., !hostOnly)may return the device-local mirror created byBuffer::WithinDeviceLocalHeadroom, and the new capacity check then callscopy.buffer->Bytes().size().Bytes()requires a host mapping, while that mirror requests onlyVK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT.Please make the capacity check use the buffer's logical/allocated size without mapping it, and cover the device-local mirror case in the regression test. This also independently corroborates the Quadro P3200 main-pass/head-fail report above.
Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-24T20:48:44Z.
Review: CHANGES_REQUESTED
The logical-size change fixes the original production path at exact head
f6978a0cfd5d89d2687305c93e0d3079df2e8a4f, and the new unmapped-mirror assertion runs successfully. One existing test assertion still needs to be made mirror-aware before this head can pass the real recorder target.Fresh physical RTX 4070 Laptop (
10de:2860) results, with this head cleanly merged ontomain61cce6e86b, NVIDIA 621.01 / Vulkan 1.4.357, Khronos validation 1.4.369 plus synchronization validation, shader cache disabled:agc_draw_input_mirrors: 3/3 passed. The new device-local/unmapped mirror assertion executed; the olddevice-local buffer has no host mappingfailure is gone.agc_draw_input_reuse: 3/3 passed.agc_driver_recorder, mirrors enabled: 0/3. All three runs now reach the later assertion and fail withAGC graphics: a padded vertex copy was not reused for the same guest range.All 15 CTest processes selected the RTX through the pinned NVIDIA ICD and inserted the Khronos instance/device layer. There were no skips, fallbacks,
VUID-messages, orSYNC-HAZARDs.The remaining failure is in
growingVertexCopyTests, not the production fix.paddedAgainleaveshostOnly=false, so with mirrors enabledReusableDrawSnapshotmay legitimately return a new device-local mirror for the same guest range. Such a mirror has no stable host pointer to compare withpadded.buffer; the pointer-identity assertion only passes in the mirrors-off path. That is why it becomes visible only after the logical-size fix lets the test proceed.Please either make both padded requests
hostOnly=trueif this subcase is specifically intended to verify host-backed padding reuse, or make the assertion mirror-agnostic (logical binding size/contents anddrawInputHolds, rather than host-pointer identity). The new unmapped device-local assertion should remain; it correctly covers the production change.AI-assisted: yes (OpenAI Codex); exact merge/head, device/layer selection, all process logs, and the Recorder-specific failure were checked directly.
Imported from boykopovar/AnyPS5. Originally posted by mihiii1337 on 2026-11-24T21:56:50Z.
Review: APPROVED
The test correction resolves my remaining review blocker at exact head
c4be5e429bf08d2b487cc66f4bc75c5d0840aa29.I rebuilt the changed recorder fixture on the same pinned base and reran the affected Windows/Vulkan matrix in fresh processes on the physical NVIDIA RTX 4070 Laptop (
10de:2860, driver 621.01), with the NVIDIA ICD pinned, shader cache disabled, and Khronos validation 1.4.369 plus synchronization validation:agc_driver_recorder: 3/3 passed with mirrors enabled. This was the only 0/3 failure at the previous head.agc_draw_input_mirrors: 3/3 passed.agc_draw_input_reuse: 3/3 passed.All nine runs selected the intended device and layer and exited normally, with no skip, fallback,
VUID-,SYNC-HAZARD, host-mapping, padding, or tail failure. The PR delta since the reviewed head is only the corrected recorder assertion; its blob matched the fetched head and tested merge.No PS5/title run was performed.
AI-assisted: yes (OpenAI Codex); exact heads, merge tree, changed blob, executable, device/layer selection, raw logs, JUnit results, and validation output were checked directly.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T00:12:01Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change based on the source inspected; the described binding capacity stays separate from guest-read length, and the available tests cover padding, reuse, and import-span checks.
What I ran
Reviewed head
c4be5e429bf08d2b487cc66f4bc75c5d0840aa29usingrepo_read.pyto inspect the prepared diff and changed source/test ranges. No build or tests were run.Results
Negative control
Not run in this review. The description reports hardware comparisons, but these were not independently verified.
Findings
Blocking
None found in the code inspected.
Non-blocking
None.
Not verified
The full contents of
tests/Graphics.cppandtests/Recorder.cppwere not read; only the changed test ranges were read. No build, test suite, hardware run, or CI result was independently verified. The changed files excluded from the review bundle were read at the pinned head throughrepo_read.py. No file was excluded by rule.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-26T16:29:15Z.
Review: COMMENTED
Actionable comments posted: 3
df53e574-9e8c-41e0-8727-5811b863a2ebReviewing files that changed from the base of the PR and between
45fc4e23bbandc195fe43d7.core/libs/prx/libSceAgcDriver/Graphics/include/Draw.hppcore/libs/prx/libSceAgcDriver/Graphics/include/Resources.hppcore/libs/prx/libSceAgcDriver/Graphics/include/VertexPlanScratch.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-26T16:32:03Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the optional points below are for follow-up.
What I ran
Reviewed head
c195fe43d7814709cf8678d2231abb0008d5a091using the prepared diff and the pinned-head repository readerrepo_read.py. No build or tests were run. The author reports syntax compilation and other checks in the PR description; those were not run as part of this review.Files read:
description.md,commits.md,manifest.json,diff.patch,Graphics/include/Draw.hpp,Graphics/include/Resources.hpp,Graphics/include/VertexPlanScratch.hpp,Graphics/src/Draw.cpp,Graphics/include/VertexInput.hpp,Graphics/src/Recorder.cpp,tests/Graphics.cpp, and the changed sections oftests/Recorder.cpp.files.jsonwas not present in the reader listing; the manifest and listing show both test files were excluded from the review folder, so their changed sections were read from the pinned head.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No build or tests were run. The reported GCC syntax compilation, conventions check, hardware A/B results, and full CI gate remain author or CI evidence, not checks performed here. The full text of the two changed test files was not read; only their changed sections and relevant surrounding lines were inspected. No machine- or hardware-specific behavior was confirmed.
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-27T13:49:15Z.
Review: COMMENTED
Actionable comments posted: 2
8d483e33-b3e0-46a8-8406-507a4ae07778Reviewing files that changed from the base of the PR and between
c195fe43d7and4b42e09578.core/libs/prx/libSceAgcDriver/Graphics/include/VertexInput.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/VertexInput.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T13:56:07Z.
Review: APPROVED
Reviewed — looks good
The inspected code supports the stated goal of sizing vertex bindings to whole strides while keeping guest reads and cached snapshot coverage bounded to actual guest bytes.
What I ran
4b42e095780cf412cf98a6bb0d3fca2761e70897from the prepared diff; did not run commands or tests.Graphics.cppandRecorder.cppwas excluded from the review folder; I read the changed ranges in both throughrepo_read.py.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T07:53:55Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; the implementation separates fetched guest bytes from Vulkan binding capacity and zero-pads the final stride in copied inputs.
What I ran
Reviewed head
4c6fcdfa1fe3ef3b7a10924f5fc96b23c0757400. No build or tests were run; repository source was inspected throughrepo_read.py.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The added test lines in
core/libs/prx/libSceAgcDriver/tests/Graphics.cppandcore/libs/prx/libSceAgcDriver/tests/Recorder.cppwere excluded from the review folder and were not read. I reviewed all other changed files and their added lines, includingVertexInput.cppandtests/execution/DrawOffsetIndices.cpp. Builds, test execution, CI, and console/GPU behavior were not independently verified. The description's reported test results are author-reported.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-30T08:02:02Z.
Review: COMMENTED
Actionable comments posted: 1
Architecture findings (1)
Advisory architecture findings (1)
3c534285-618f-467f-a3b7-6a195c6ae7a0Reviewing files that changed from the base of the PR and between
4b42e09578and4c6fcdfa1f.core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/IndirectDraw.cppcore/libs/prx/libSceAgcDriver/Graphics/include/Draw.hppcore/libs/prx/libSceAgcDriver/Graphics/include/Resources.hppcore/libs/prx/libSceAgcDriver/Graphics/include/VertexInput.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/Recorder.cppcore/libs/prx/libSceAgcDriver/tests/VertexInput.cppcore/libs/prx/libSceAgcDriver/tests/execution/DrawOffsetIndices.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.