fix(agc): refuse buffer aliases of native MSAA targets #6498
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6498"
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 Amoenus on 2026-10-15T17:35:12Z.
What
Fixes #6480. A buffer descriptor overlapping resident native MSAA storage bypasses the existing unsupported guest-access refusal. In the test-only main control, a typed buffer load reads zero guest DWORDs while MIMG reads the resident image's half-float ones.
Check logical guest-buffer ranges before preparation, final upload and binding, including warmed/deferred/recipe reuse and the actual moved ranges during draw-binding preparation. Adjacent logical ranges remain usable even when their allocation also contains a native target. Unresolved accesses throw through the existing guard; no readback approximation, retry, environment switch or silent success.
Four files: 15 added production
.cpplines, a private declaration, an extension of the existing execution fixture and a debt update. This does not implement native MSAA buffer publication or change instruction semantics. Dynamically addressed BDA heaps remain outside this check; main's separate vertex/index coverage is retained.Published history is preserved: this refresh merges main into the existing PR head rather than replacing its reviewed implementation. The experimental integration's native-publication work remains separate.
Tested
28October current-main refresh:
b2aad7239cb4ce282d1df7ebf154db01d66fa5d3on tested maind4cb89300fe54cce0ad74edf67803086e302b819,including merged #11369. Normal merge/fast-forward preserves published494b and original authorship,with identical own topic lines and no force-push.Why retest: #11369 changes the GPU buffer-write/depth boundary in GuestBufferMemory::UploadFinish. The refreshed main/control/fix matrix verifies that its depth retirement coexists with this separate color-buffer guard. Main-production plus the identical alias fixture still misses all six guard refusals3/3 per vendor;candidate catches all six and retains adjacent/native-sample controls.
Exact pins,portable control patch,full native builds,real-fixture proofs,verbose logs and artifact manifests: 60positive processes(56physicalGPU/4CPU),six intended color-guard control failures. Main and candidate each30/30. Both execute merged native-depth buffer-write cases3/vendor,all D16/D32 x2/4/8 cases verified,plus depth retirement/clear controls. Ordinary/pipelined relocation,deferred/recipe reuse,native vertex and linear-target binding/dispatch checks retained. Longest CTest6.450s;zero validation warnings/errors/VUIDs,skips,timeouts. Full native libraries/relinker/real selected fixtures,conventions and whitespace pass;stable per-phase manifests.
Actual RTX5080/621.01 and Radeon Graphics1002:13c0/26.10.1,Windows11 Enterprise26200,WinLibsGCC15.2r7/UCRT Release;required Vulkan,app cache/journal off,loaded Khronos1.4.363,serial verbose CTest/30s. Driver caches/implicit layers left as found. Cppcheck/clang-tidy:47.021analyzer-seconds,4unchanged-context notices,no parser/configuration errors/timeouts;no static-clean claim.
Overlap order: #6498→#8963 is agreed,merge order only;#6498→#9508 remains proposed. Preserve this guard before fault-slot/descriptor work and early returns,using moved logical ranges. No combined heap/fault-arena runtime claim.
#11369 is merged. Fresh matched main/change checks below execute its native-depth buffer-write regression alongside this color-buffer guard;no dependency remains on an open11369. This guard covers known logical buffer bindings;GPU-discovered BDA addresses remain outside its scope.
No fresh title,FPS,full default suite,Linux,dynamic-BDA or console-equivalence result. Historical controls and other-platform results retain their original pins in the same Gist. Maintainer full Build/title gates remain separate.
Checklist
main; no other open PR implements the same functionsNotImplemented_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)Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-15T21:27:29Z.
Review: COMMENTED
Linux + NVIDIA run, since the PR and #6480 have Windows results only (RTX 5080 and Radeon).
Machine: NVIDIA GeForce RTX 3070, driver 595.99.02, Vulkan 1.4.329, Ubuntu 26.04 (kernel 7.0.0-38), i7-8700. GCC 15.2, Release,
BUILD_TESTING=ON. Headf9feba0b2merged ontomain44df21632, no conflicts.ANYPS5_GPU="NVIDIA GeForce RTX 3070".GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02), Linux
SampleMultisampleTarget.cpp,ShaderResources.{hpp,cpp}frommain):agc_driver_sample_multisample_targetfails. All six paths bypass the guard (fresh read,edge read,write,warmed dispatch,deferred dispatch,recipe dispatch), and the controls printadjacent=passed deferred=1 recipe=1. So #6480 reproduces on Linux + NVIDIA too.ctest -R "^agc|shader|recompiler|image" -E "agc_display_buffer_dcc|agc_driver_flip|agc_driver_lds_atomics64|display|flip" -j1 --timeout 60: 600/602 pass.agc_driver_store_over_untrackedfails atthe result did not reach a block the CPU left alone, as on unchangedmainhere (64/70 idle runs, #6347).agc_frame_dump_iofailed once withclosed pipe pixel write was accepted. It ran once in this suite; on unchangedmainit then passed 30/30. It does not touchShaderResources, and I did not rerun it with the PR.Written with AI assistance (Claude Code). I ran the tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-17T07:44:52Z.
Runtime datapoint on NVIDIA hardware (RTX 3070, Ampere, driver 617.42, Windows 11 26200, WinLibs GCC 15.2.0, Release, ANYPS5_NO_SHADER_CACHE=1).
Head beee99c33 on base
7dcfff559. ctest -R over the multisample/MSAA-adjacent set, fresh serial processes:7/7 pass including the new buffer-alias refusal cases.
One adjacent flake to flag: agc_driver_multisample_fill_host_only is intermittent on this machine independently of this PR — 4/10 pass on the PR head vs 3/10 on base
7dcfff559(same build dir, rebuilt each way). Failure signature is "the sentinel fill did not land" with no crash, so it reads like a timing/ordering flake on this driver, not something the guard introduced.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T12:10:55Z.
@Amoenus this now conflicts with main after today's AGC merges (GitHub reports it as DIRTY at beee99c33). Could you rebase it? It's queued for our game tests together with #6445, so once there's a clean head we'll run CI and the gates on that.
Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-17T13:16:03Z.
@oneandonlydean rebased and pushed:
dd44829aa3a3239570c6a414b191dbea0baaa9dd, based on mainc9e6c45de9and clean against the newer3a26ce271d.Kept the new upstream vertex/index coverage and corrected the fixture's cleanup order so prepared buffer plans/recipes release before the Vulkan device. The production buffer guard is unchanged.
Validation on this exact head: Windows/Linux relinker and library builds; sample-target and native-vertex tests each pass 3 fresh processes on RTX 5080, AMD Radeon Graphics and llvmpipe (18 GPU test passes total); CPU graphics 3/3 on each OS. Windows Khronos 1.4.363 reports no validation errors/warnings. Conventions and registration pass. Full details, including the four existing analyzer advisories, are updated in the description.
Ready for your CI and game gates with #6445. No new title-unblock claim from these focused tests.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T23:09:31Z.
This PR no longer merges cleanly into current main. Could you rebase onto current main? It is stacked with #6445 for our game gate, so we will run full CI and the gate on the new head from there.