fix(agc): refuse depth targets with a sample count the device cannot hold #23386
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/23386"
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 GiannisG1 on 2026-11-18T23:44:25Z.
What
DepthSurfacecreates a multisample depth target in the host format without asking whether that format supports the target's sample count. Its sampling paths do check (supportsfor the sample shadow and the directly sampled image), but the attachment itself does not. lavapipe and llvmpipe offer only 1, 4 and 8 samples forD32_SFLOAT_S8_UINT. The two-sample stencil plane ofagc_driver_stencil_copy_drawis therefore created invalid on them, and the validation layer reports it:Since #21093 the test then skips, because these devices also lack 2x custom sample locations, so the invalid image only shows with the validation layer on. #20289's author noted the remaining VUID when closing it. Any title with a two-sample depth/stencil target on such a device gets the same invalid image.
Right before the image is created,
DepthSurfacenow queriesvkGetPhysicalDeviceImageFormatPropertieswith the image's own usage and flags. If the sample count is not insampleCounts, it refuses the target withdepth/stencil format N cannot hold S samples on this device, as it already refuses a format that cannot be an attachment. Devices that support the sample count create the same image as before.agc_driver_stencil_copy_drawchecks up front whether the device can hold a two-sampleD32_SFLOAT_S8_UINTplane. Where it cannot, the test requires that refusal and skips with a device reason; the sample-locations skip stays for devices that hold the plane but lack the locations. Intests/DepthSurfaceReuse.cpp, the attachment-only mock now answers the attachment query (1 to 8 samples) and refuses only sampled usage, which is what it stands for; it used to refuse every query. A new mock holding only one or two samples checks the refusal on any machine.Tested
All runs below are mine, on one machine: Linux Mint 22.3, GCC 13.3.0, Release, head on
main866864a5bc.agc_driver_stencil_copy_draw, 3 runs on each device. Without theDepthSurfacechange, llvmpipe and lavapipe fail witha two-sample stencil plane the device cannot hold was not refused for its sample count: AGC graphics: custom sample locations require VK_EXT_sample_locations support for the draw's sample count. With it, both skip withskipped, the device lacks two-sample D32_SFLOAT_S8_UINT depth/stencil attachments. The GTX and the HD 630 hold the two-sample plane and pass all six cases on both sides.check_skips.pyis clean.VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layer,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1,ctest -V -j2on the 63 stencil, MSAA, multisample and EQAA tests (^agc_.*(stencil|msaa|multisample|eqaa).*$),main866864a5bcand this PR, on the GTX, the HD 630, llvmpipe and lavapipe. The loader inserts the layer every time and never reports it as not found. Onmain, llvmpipe and lavapipe each reportVUID-VkImageCreateInfo-samples-02258twice, inagc_driver_stencil_copy_draw, and the GTX and the HD 630 report nothing. With this PR, no device reports anything. No test changes its result between the two sides on any device.tests/DepthSurfaceReuse.cpp(agc_driver_graphics): a four-sampleD32_SFLOATtarget on a mock device whose attachment holds 1 or 2 samples is refused withcannot hold 4 samples on this device; without theDepthSurfacechange the test fails witha four-sample depth target in a format the device holds only at one or two samples must be refused, not created. With the fix,agc_driver_graphics,agc_driver_graphics_maps_fallbackandagc_graphics_profile_drawpass 3 times on the GTX and once on the HD 630, llvmpipe and lavapipe.tools/suite.py: every test once, GPU tests on all three devices) on this PR, compared withmain866864a5bc's own run on the same machine. GTX: 6163 run, 5 failed. Two areguest_libressl3_aesandguest_libressl3_aes_wrap, which fail onmaintoo (#23208, reverted in #23365). The other three areagc_driver_graphics,agc_driver_graphics_maps_fallbackandagc_graphics_profile_draw: the run used the old attachment-only mock, they pass with the mock fixed above, and only that test file changed after the run. HD 630: 1686 run, 10 failed, all failing onmaintoo. llvmpipe: 1686 run, 9 failed:main's 8 andagc_driver_frame_replay_rewind_copy, which passes 3 of 3 alone (it also failed only under load in a validation sweep).check_conventions.py,check_test_registration.py,check_main_sync.py(merges cleanly),check_compile.pyandgit diff --checkare clean.pr_overlap.py --branchfinds no open PR that changes these lines. Of the 18 PRs it could not compare (they conflict withmain), only #7256 changes this part of theDepthSurfaceconstructor: it puts thevkCreateImage depthcall into anelsefor its layered array image, and the check here would move into that branch.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T01:30:38Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the inspected implementation and tests support the stated behavior.
What I ran
Reviewed head
88f36f27ba851fcb93a190e5009c8a2d74bf1327. Read the prepared description, commits, manifest, diff, and all three changed source files. Usedrepo_read.pysearch for relevant call sites. No build or tests were run; reported test results below are from the PR description.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Build, automated tests, and runtime behavior were not independently verified. No changed files were excluded from the review bundle.
To get this to a good state
Nothing is required.