fix(agc): preserve descriptor array ranges in draw snapshots #1831
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1831"
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 yabanana on 2026-10-08T20:49:24Z.
What
A draw snapshot can corrupt storage-buffer array bounds on MoltenVK 1.4.2. Updating a short buffer at array element 1 also changes the shader-visible length of element 0: MoltenVK's auxiliary-size update uses the element index without the write's destination offset (source). In a native macOS integration test, a 128-byte constant buffer replaced an 864-byte vertex buffer's reported length.
Cache each original buffer descriptor when constructing the set. Draw snapshots now rewrite each affected array from element zero, substituting snapshot descriptors and retaining the original handle, offset and range for untouched elements. Unaffected bindings still use the descriptor-set copy. This adds one descriptor-info entry per allocation and writes complete affected arrays.
The regression covers changes to element 0, element 1 and both, with distinct data and ranges. It checks untouched descriptors, unrelated binding copies and resource lifetime through
PrepareDrawBindings.This is independent of the ARM64 compiler work. #1580 changes descriptor limits/layout allocation in the same files; it is not a dependency and does not address these partial-write bounds.
Tested
Current head
a2fe737eis rebased ontomainat745b775e, which includes #2099 and resolves the previous missing SPIRV-Headers failure.git range-diffconfirms this PR's fix and regression patch are unchanged. Conventions and whitespace checks pass.Earlier focused native ARM64 validation of the descriptor-only test failed on its unmodified base and passed with this patch. Previous head
ae1699acalso passed full upstream Linux/Windows CI, including all 488 Linux tests andagc_driver_graphics.On this new base, the production source and regression compile in the focused native harness, but that harness's older native-runtime support archive no longer provides a coherent runtime for changed upstream texture/guest-memory interfaces. Its current-head execution attempt failed before the descriptor assertion. This is not a passing current-head runtime check; full validation is still required.
Earlier integration-only MoltenVK 1.4.2 GPU tests passed after the full-array fix. That branch has macOS/shader changes outside this PR and does not substitute for current-head validation.
Upstream now runs full Linux/Windows PR builds only through maintainer-authorized
workflow_dispatchwith a PR number. Please dispatch Build withpr=1831for this head and run the full graphics regression suite. Skipped full-build jobs do not count as passes.#2151 is also included in this base: the optional hardware-oracle assembler case checks for an AMDGPU-capable Clang before running. The previous Windows relinker failure on
amdgcn-amd-amdhsais therefore addressed by upstream, without a duplicate patch in this PR.Checklist
main; no other open PR implements this fixImported from boykopovar/AnyPS5. Originally posted by yabanana on 2026-10-09T08:22:14Z.
@adriadam10 This fix is now ready for review at
769ce0b4, rebased onto6cc0503d. The rebase only resolved an appended TechnicalDebt note; the production fix and regression are unchanged. The focused test passes on this head and fails against the unmodified new base. Previous upstream Linux/Windows validation passed, including all 488 Linux tests; fresh validation is running here: https://github.com/boykopovar/AnyPS5/actions/runs/37903648617. Could you review the descriptor-array update and regression?Imported from boykopovar/AnyPS5. Originally posted by yabanana on 2026-10-09T08:53:45Z.
The current Windows failure is the upstream missing SPIRV-Headers include path, not the descriptor snapshot change: failed job,
VulkanTestDevice.hpp:5:10: fatal error: spirv/unified1/spirv.hpp: No such file or directorywhile compilingagc_shader_fusion_tests.I independently reproduced this on both direct consumers (
ShaderFusion.cppandSubmit.cpp): the pinned sources fail without the SPIRV header path and pass AppleClang syntax checking with it. #2099 and #2093 contain the same two-target correction. I have documented #2099 as the build prerequisite; once either equivalent fix lands on main, this PR needs a rebase and fresh full CI. No descriptor-code change or duplicate build-fix commit was added.Imported from boykopovar/AnyPS5. Originally posted by yabanana on 2026-10-09T10:16:37Z.
@adriadam10 Current head
a2fe737eis rebased onto main745b775e, including merged #2099 and #2151. Both previous upstream CI blockers (SPIRV headers and Windows Clang without AMDGPU support) are addressed in this base. The descriptor fix/regression patch is unchanged; the current-head full graphics suite remains unverified by the older native harness. Under the new policy, could you dispatch Build on main with inputpr=1831for full Linux/Windows validation, and review the current head? Skipped full-build jobs are not counted as passes.Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T15:23:04Z.
Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head
a2fe737e, merged ontomaind70b8998in one build with 33 other AGC/shader PRs that had no Windows run.agc_driver_graphics. None of them reported skipping a case.PATHsetup.No title was run.
🤖 Addressed by Claude Code
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T06:03:18Z.
Checked the array rewrite in
PrepareDrawBindings(untouched elements keep their original handle/offset/range, snapshots substitute only the selected ones) and the new regression:agc_driver_graphicspasses on the PR rebased onto main, and the new case fails without the change. Not verified here: the MoltenVK behaviour itself (no macOS).Added one commit on your branch: rebased onto current
mainand moved theTechnicalDebt.mdline away from the end of its section (it conflicted with the line appended there; end-of-section lines collide with every other PR). Merging once CI is green.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T07:15:28Z.
Rebased again onto current
main:docs/dev/TechnicalDebt.mdconflicted once more with a line added next to ours; both lines are kept. The fix and regression are unchanged,agc_driver_graphicsandagc_driver_prepared_graphicspass on the rebased tree. Merging once CI is green. Not verified here: the MoltenVK behaviour itself (no macOS).