fix(agc): import a native multisample D32S8 target without HTILE whose planes each hold one value #14005
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14005"
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 hugodearaujo on 2026-10-31T15:28:18Z.
What
A native multisample depth target is imported for sampling only when its HTILE proves the initial clear. A D32S8 target with a separate stencil plane and no HTILE at all is refused at creation, and the title stops at the first sample of its depth. Before #9533/#9717 the message was the first one below; on current
mainit is the second:Without HTILE the DB reads and writes both planes uncompressed, so their guest bytes are the initial contents. When every 32-bit word of the sample-aware depth plane (
MultisampledDepthBytes_nid_no_patch(extent, 4, samples)) is the same float in [0, 1] and every byte of the stencil plane (MultisampledDepthBytes_nid_no_patch(extent, 1, samples)) is the same value, every sample holds those values whatever the Z_X sample order. This PR imports such a target:prepareDepthSamplingsends a D32S8 target with a separate stencil plane and no HTILE toprepareUniformPlaneSampling. It keeps the Z_X / single slice / XOR / alignment checks of the HTILE path, syncs and flushes both plane ranges, takes their write generations, reads both planes (64 KiB at a time) and checks again that nothing wrote them meanwhile. The two plane ranges then play the part the depth and HTILE ranges play for an HTILE target: guards, the guest-write check at each sample, retirement.DB_DEPTH_CLEAR/DB_STENCIL_CLEAR.CheckResource: for a target without HTILE the sampled descriptor must name no metadata (dccAddress0); its pipe-aligned and ITERATE_256 bits are not compared, since they only describe metadata.maina4eca2a056, both come frommain's stencil model (#9717):CheckResource's stencil identity, the stencil sample-count check inSampled, andsampleShadowStencil. This path uses them unchanged.main's HTILE path, the import is refused (attachment rendering kept) when a multisampled colour target covers either plane.Still refused, each with its own message: a depth plane with more than one word or a float outside [0, 1] (
native multisample depth plane without HTILE does not hold one depth value in [0, 1]), a stencil plane with more than one byte value, overlapping planes, HTILE stencil, and guest writes racing the import. D16/D32 without HTILE keep their refusal, and D32S8 with HTILE takesmain's path (#9533). Publication of a written surface is still not implemented.A new debt entry, next to the one for native multisampled depth sampling, says that the single-value rule is inferred from the layout, not measured on the console.
Why: Assassin's Creed Mirage (PPSA13960 01.007.000)
On
main+ #13963 (which contains #13248), in the first real-time scene after New Game (Basim in the dark), the title binds a 4x D32S8 1920x1080 target with a separate stencil plane and no HTILE, and a compute shader samples its depth. A diagnostic build (local only:main+ #13963 + logging, and a hack that let this target through) printed, when the 1920x1080 target was created and on its first draw:and, from an earlier run of the same scene, the refusal's target fields:
Both planes are all zero (depth 0.0, stencil 0), not
DB_DEPTH_CLEAR(1.0). The title's 960x540 4x D32S8 targets on the title screen hold several values (first=0x01010101 same=1778688of 2211840 words) and stay refused as before. Letting those through too (the hack, first version) stopped the title at 75 s on the title screen withsample-preserving guest publication of native multisample depth is not implemented, so a rule that took any plane would be a regression there.Same route in both builds (title, Menu Narration skipped, cursor to New Game, Assassin, Full Synchronization Off), one 1300 s run each,
main73f4f7e06e+ #1396337417cec46as the base:compute shader 0x10b4c8ad00: AGC graphics: native multisample stencil or depth format import is not implementedcompute shader 0x10b4c89700: AGC graphics: sample-preserving guest publication of native multisample depth is not implementedWith the change the target is imported and the title moves to the next refusal in the same frame: an access over the planes after the host has drawn into them. That is the publication direction (host to guest), which this PR does not implement. #13021 publishes written D32S8 surfaces but is stacked on #9533 and #6300; #9950 publishes written D32 surfaces only (
target.format == VK_FORMAT_D32_SFLOAT), so a D32S8 surface keeps a refusal there. #9950 also takessampling.initial[1]as the HTILE range; for a target imported here that entry is the stencil plane, so a later extension of #9950 to D32S8 would have to tell the two apart.Tested
On the merge with
maina4eca2a056(d2399ff2cd), same machine, withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1(VK_LOADER_DEBUG=layershows the layer inserted): the 14agc_driver_native_depth_*,agc_driver_native_multisample_depthandagc_driver_cached_image_multisample_guardtests pass onmainand on the merge, andagc_driver_native_depth_uniform_planespasses on the merge (15/15), with noVUID-line. With the dispatch toprepareUniformPlaneSamplingremoved,--uniform-planesfails withnative multisample stencil import requires HTILE stencil metadata. Withmain's stencil clear value, it fails witha uniform stencil plane without HTILE was not imported into every sample: sample 0 holds 0, the plane 195. Without the no-HTILE branch inCheckResource, it fails withnative multisample depth sampled metadata or XOR mismatch. The results below are from the heads before that merge.Linux 7.2.11, RADV (Mesa 26.2.6), AMD Radeon RX 9070 XT, Release,
BUILD_TESTING=ON, onmain73f4f7e06e.agc_driver_native_depth_uniform_planes(agc_driver_native_multisample_depth_tests --uniform-planes), 2, 4 and 8 samples, 129x67 D32S8 with a separate stencil plane and no HTILE:R8_UINTview atstencilAddressreturns the plane's stencil byte;guest writes.main'sDepthSurface.cppfails with the title's message:refusal did not match does not hold one depth value: AGC graphics: native multisample stencil or depth format import is not implemented. Withthis->sampling.initialStencil.value_or(target.clearStencil)replaced bytarget.clearStencil(the host stencil starts atDB_STENCIL_CLEAR, 0), it fails witha uniform stencil plane without HTILE was not imported into every sample: sample 0 holds 0, the plane 195, and so it does whenrefreshSampleShadowcopies only the depth aspect. Withc9987271e3'sDepthSurface.cppthe stencil read fails withnative multisample depth sampled identity or format mismatch.agc_driver_native_multisample_depth,agc_driver_native_depth_retirement,_clears,_clear_refusals,_buffer_clearand 52agc_driver_(depth|native|sample_multisample|multisample)entries pass. Onf7841c78d5the 53 entries that regex selects pass under the validation layer, with noVUID-line.c9987271e3againstf7841c78d5, same machine and settings as below plusVK_LOADER_DEBUG=layer, on the six tests: 6/6 on each, the loader inserted the layer 17 times on each, noVUID-line and nowas not found but was requestedon either.ctest -V -R "native_(multisample_depth|depth)"withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1:main5/5, this change 6/6 (the five plus the new test). NoVUID-line and nowas not found but was requestedin either log. Before thecreateSampleShadowchange the new test raised 12VUID-VkImageMemoryBarrier-image-03320.tools/check_conventions.pypasses.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T16:34:41Z.
Review: APPROVED
Reviewed — looks good
I reviewed head
f7841c78d58b7ec1e6c498157b6e4238bb882fc5; the uniform-plane depth/stencil import, stencil sampling path, and focused regression coverage are consistent with the documented limits.What I ran
The PR head was
f7841c78d58b7ec1e6c498157b6e4238bb882fc5and the base was474030e58424fefdb65e5df9f3820810fbb4553c. The merge preview against that base was clean. Environment: Linux 6.1 x86_64, Python 3.11.2, Git 2.39.5; I did not configure, build, or compile AnyPS5.The precheck and audit scripts are local review-workspace helpers, not files from this PR. The PR source used for the test-quality inspection was extracted from the exact head SHA.
Results
tests/execution/*.cppCMake glob, and the new--uniform-planesCTest entry is present. The warning is a heuristic false positive.474030e58424fefdb65e5df9f3820810fbb4553c.mainat73f4f7e06e4f210a8c6570e335fd654dc0a86134and 6/6 on this PR head, with no newVUID-messages or missing validation-layer message. It also reports negative controls that fail when the stencil clear or shadow-copy changes are removed. I did not independently run these GPU tests. The current PR base is474030e58424fefdb65e5df9f3820810fbb4553c; its merge preview is clean, but the author-reported baseline was not rerun at that newer base SHA.ExecutionTestNotBuilt.cppfor that test target, and the fulllibsand CTest-selection steps were skipped. Linux and specialized jobs were skipped.Local check output
The test-quality output above is the heuristic's unedited JSON; the CMake source glob and test declaration were checked manually at this head.
git diff --checkproduced no output and exited successfully. The precheck's overall status was affected by its isolated archive lacking the local ABI and test-quality helper scripts; I reran those checks against the exact-head source as shown above.Sources
Not verified
agc_driver_native_depth_uniform_planesand the existingagc_driver_native_multisample_depthwere skipped, and the productlibsbuild/full CTest steps were skipped. Linux and specialized CI jobs were skipped.474030e58424fefdb65e5df9f3820810fbb4553c; the PR reports its baseline at73f4f7e06e4f210a8c6570e335fd654dc0a86134.