fix(agc): back 1D depth comparison textures with 2D images #7966
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7966"
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 KarthikeyaAnna on 2026-10-19T16:23:16Z.
What
Back 1D and 1D-array depth comparison textures with 2D Vulkan images and views of height 1. Vulkan drivers such as AMD RADV reject 1D depth images (
VK_ERROR_FORMAT_NOT_SUPPORTED/VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251). The shader recompiler maps 1D depth comparison samplers to 2D image descriptors, pins the normalized vertical coordinate to 0.5 to sample the center of row 0 without hitting borders, zeroes vertical offsets for 1D comparison sample offsets, gates cube map candidate modes strictly on!image.remappedDepth1D, and explicitly rejects unsupported 1D depth gather variants keyed onaccess.image.remappedDepth1D. Adds focused execution tests covering 1D/1D-array comparison sampling (image_sample_c_lz,image_sample_c,image_sample_c_l), 1D/1D-array offsets (image_sample_c_lz_o), and rejection of 1D/1D-array depth gather variants.Tested
Arch Linux x86_64, NVIDIA GeForce RTX 2050 (driver 610.57.04).
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R "^(agc_driver_image_one_dimensional_compare|agc_driver_depth_compare_copy|agc_driver_image_plane_compare_on_line|agc_driver_emulated_color_compare|agc_driver_image_gather_one_dimensional|agc_driver_image_gather_one_dimensional_array|agc_shader_disk_cache)$" -Vpasses with 0 validation errors.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 https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-19T16:32:01Z.
Review: COMMENTED
One test-coverage gap: this diff changes descriptor dimension handling, emitted coordinates, image creation, and image views for both 1D and 1D-array comparison textures, but adds no regression test. The issue report notes that the existing
agc_driver_image_plane_compare_on_linepath appears to work on RADV even though the driver reports the 1D depth image format as unsupported, so that test may not catch a regression in the new remapping. Could you add a focused check for both 1D and 1D-array comparison sampling, or report a validation-layer run showing the old path emits the unsupported-image VUID and the new path does not?Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T16:36:22Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/shader/recompiler/ShaderDiskCache.hppL16core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppL348-349core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppL4638-4639core/shader/recompiler/ShaderDiskCache.hppL16Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppcore/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/Optimization/src/ResourceTracker.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/Optimization/src/ResourceTracker.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/shader/recompiler/ShaderDiskCache.hppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/shader/recompiler/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/shader/recompiler/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/Optimization/src/ResourceTracker.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/Optimization/src/ResourceTracker.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/shader/recompiler/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/Optimization/src/ResourceTracker.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/Optimization/src/ResourceTracker.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/shader/recompiler/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/Optimization/src/ResourceTracker.cppcore/shader/recompiler/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/shader/recompiler/Optimization/src/ResourceTracker.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cppcore/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/Resources.hppcore/shader/recompiler/Optimization/src/ResourceMaterializer.cppcore/shader/recompiler/ShaderDiskCache.cppcore/shader/recompiler/ShaderDiskCache.hppcore/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-19T16:37:31Z.
Review: COMMENTED
Manual overlap check on the bot warning:
resolveImageBinding, adding afirstSampleexception for a 2D view of a 2D MSAA T#. This head exemptsfirstLayeranddepth1D, but notfirstSample. If both changes are still needed, the merged guard needs to preserve all three cases; otherwise one PR's behavior will be lost when the other is rebased/merged.depth1Dexception in that path.I haven't run a combined build; this is a source-level overlap check.
Imported from boykopovar/AnyPS5. Originally posted by KarthikeyaAnna on 2026-10-19T16:59:49Z.
Added a focused execution test in ImageOneDimensionalCompare.cpp (
agc_driver_image_one_dimensional_compare_tests) verifying both 1D and 1D-array comparison sampling (image_sample_c_lzandimage_sample_c).Also updated
ResourceMaterializer::RuntimeImageModesto guard against adding candidate cube map permutations for 2D-array depth comparisons (which have 2 coordinate components and cannot sample a cube).Tested on Arch Linux x86_64, NVIDIA GeForce RTX 2050 (driver 610.57.04):
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ctest --test-dir build -R "agc_driver_image_(plane_compare_on_line|one_dimensional_compare)" -Vpasses.Imported from boykopovar/AnyPS5. Originally posted by KarthikeyaAnna on 2026-10-19T17:05:18Z.
Thanks for the overlap check @MarcZX10. Acknowledged: if #7803 lands first, I will ensure the rebase preserves both
firstSampleanddepth1DinresolveImageBinding(and vice versa if this merges first).Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T03:21:59Z.
Thanks, backing 1D compare textures with height-1 2D images looks like the right way to get RADV working. One problem: two of the
RuntimeImageModeschanges apply to every 2D-array comparison image, not only the remapped 1D ones.&& !image.depthCompareon the cube mode and&& image.cubeFaceCompatibleon the emulated-compare plain/cube modes (which is never true for a compare sample) remove the cube mode that cube shadow maps need, since DIM_CUBE decodes as Dim2DArray. With this PR on main,agc_driver_emulated_color_comparefails its first case ("point cube, clamp to edge": "image descriptor is incompatible with the static runtime image interface ... cube 1 ... modes ... cube 0"). Could you gate those two changes on images that were actually rewritten from 1D (a flag set where ResourceTracker remaps the dimension) and check that the test passes?Imported from boykopovar/AnyPS5. Originally posted by KarthikeyaAnna on 2026-10-20T04:59:50Z.
Thanks @oneandonlydean, great catch!
I added
remappedDepth1DtoImageResource(set inResourceTracker::ImageKeyspecifically when 1D or 1D-array comparison textures are remapped to 2D / 2D-array), and gated both cube modes inRuntimeImageModeson!image.remappedDepth1D. This preserves the cube mode for actual 2D-array and cube comparison textures (including cube shadow maps and emulated color compare).Also plumbed
remappedDepth1DthroughShaderDiskCache(updatingfieldCount<ImageResource>()to 40 and adding test coverage intests/ShaderDiskCache.cpp).Tested on Arch Linux x86_64, NVIDIA GeForce RTX 2050 with
VK_LAYER_KHRONOS_validationandANYPS5_NO_SHADER_CACHE=1:agc_driver_emulated_color_comparepassesagc_driver_emulated_color_compare_srgb_decodepassesagc_driver_image_one_dimensional_comparepassesagc_driver_image_plane_compare_on_linepassesagc_shader_disk_cachepassesImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T05:09:16Z.
Thanks,
remappedDepth1Danswers the cube question: with it, the cube and 2D-array comparison modes are the same as main's for every image that wasn't rewritten from 1D.One thing before this can merge: main's
1ed8eb6d8balready added a field toImageResource(volumeArraySampleCompatible) and moved thefieldCount<ImageResource>()assert inShaderDiskCache.cppfrom 39 to 40. Your branch makes the same 39 → 40 edit, so git merges it without a conflict, but the merged struct has 41 fields andShaderDiskCache.cppfails its static assert ("ImageResource changed: update the info encoder"). Could you rebase on current main and set it to 41? Main has also been bumpingFormatVersionwith these field additions (it's 41 now), so you may want 42 for consistency, though the source hash already invalidates old entries.Imported from boykopovar/AnyPS5. Originally posted by KarthikeyaAnna on 2026-10-20T06:14:55Z.
Rebased onto latest main (
1ed63f6), updated theImageResourcefieldCount static assert to 41, and bumpedFormatVersionto 42 inShaderDiskCache.hpp.All tests pass cleanly:
agc_shader_disk_cacheagc_driver_emulated_color_compareagc_driver_emulated_color_compare_srgb_decodeagc_driver_image_one_dimensional_compareagc_driver_image_plane_compare_on_lineImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T07:07:44Z.
Thanks for the rebase. Full CI fails one test on Linux, deterministically (the rerun fails the same way, and the test passes on main):
The cause is the new line in
CoordF32(SpirvImageEmitter.cpp):flatLineCompatibleisn't specific to 1D images. It defaults totrue(Resources.hpp), and the tracker keeps it for any 2Dimage_samplewith no flags or LZ, becauselineSampleFlagsmasks out the compare bit (ResourceTracker.cpp,lineSampleFlags = memory.imageSampleFlags & ~RdnaImageSampleFlagCompare). So every plain 2D depth-comparison sample now has its y replaced by 0.5 and reads the centre row of the texture. This test samples row 0 of a 512x512 surface, so it reads row 256's older data, but the same thing would happen to any 2D shadow map.Could you pin y only for images that were actually rewritten from 1D (
remappedDepth1D, or a 1D / 1D-array instruction dimension) and dropflatLineCompatiblefrom that condition?agc_driver_depth_compare_copyalready covers the 2D case. A 2D comparison case in your test that samples a row other than the centre would keep this from coming back.Imported from boykopovar/AnyPS5. Originally posted by KarthikeyaAnna on 2026-10-20T07:25:49Z.
Dropped
flatLineCompatiblefrom theCoordF32condition soyis only pinned for images rewritten from 1D (remappedDepth1Dor 1D/1D-array instruction dimensions) and guarded it against gradient coordinate emission.Also added 2D depth comparison test cases (
image_sample_c_lzandimage_sample_c) toImageOneDimensionalCompare.cppsampling row 2 of a 16x16 depth surface (off-centre) to guard against any regression for 2D comparisons.Both
agc_driver_depth_compare_copyandagc_driver_image_one_dimensional_compare(along withagc_driver_image_plane_compare_on_lineandagc_driver_emulated_color_compare) now pass with 0 Vulkan validation errors.Imported from boykopovar/AnyPS5. Originally posted by KarthikeyaAnna on 2026-10-20T07:46:40Z.
Also completed a comprehensive edge-case audit across coordinate generation, descriptors, bindings, views, offsets, and layers, adding the following fixes:
SpirvImageEmitter.cpp): Zeroed out the vertical offset component (values[1] = ConstantI32(state, 0)) in bothPackedOffsetand the constant offset path inEmitSampleOp. Because 1D instruction encodings only supply an X offset, this prevents upper bits from shifting vertical sampling off row 0.SpirvImageEmitter.cpp): InEmitGatherOp, addedaccess.mem.imageDimensionchecks alongsidedimensionto ensure unsupported 1D gather variants cannot bypass the 1D check due to dimension remapping.ShaderResources.cpp): AllowedfirstLayerfordepthCompare && resource.dimension == TextureDimension::k1DArrayin both direct bindings and image table lookups. This selectsFirstLayerView()(layer 0) asVK_IMAGE_VIEW_TYPE_2Dto match the recompiledImage2Dinterface.Texture.cpp): Permitted 1D-array depth textures to prepare base-level views inprepareBaseLevelViewwithout early-returning, and ensuredviewRangeis recorded in the depth copy constructor.ImageOneDimensionalCompare.cpp): Added test cases for sampling layer 0 of a 1D-array depth comparison texture using 1D comparison samplers (image_sample_c_lzandimage_sample_c).All tests pass cleanly with Vulkan validation enabled (0 VUID errors).
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T08:03:27Z.
Thanks, the shadow-compare fix in f010833a69 works.
agc_driver_depth_compare_copyandagc_driver_image_one_dimensional_compare, including the new 2D cases, pass locally on an RTX 4090 and on llvmpipe (Mesa 25.2.8, as on Linux CI). WithflatLineCompatibleput back into theCoordF32condition, the new 2D case fails, so it guards the bug.One of the new edge-case changes breaks an existing test, though. With the extra condition in
EmitGatherOp:agc_driver_image_gather_one_dimensionalfails SPIR-V validation on both devices:It passes on main and on your earlier heads. It also passes on f010833a69 with only that condition reverted (both devices, and
agc_driver_image_gather_one_dimensional_arraypasses on both arms). The guest instruction dimension is 1D there while the image the shader binds is 2D, so the 1D branch queries a 2D image as 1D.If the goal is to apply the 1D gather rules to depth images you now back with 2D images, keying it on the remap instead should keep the existing case working:
That leaves every non-remapped gather exactly as on main. If that branch can't handle a remapped image's 2D query either, refusing the remapped 1D gather explicitly (as the dref case already does) would be the safe option. A test for a remapped 1D depth gather would show which.
Imported from boykopovar/AnyPS5. Originally posted by KarthikeyaAnna on 2026-10-20T08:20:36Z.
Follow-up audit on edge cases:
Texel Offsets (
image_sample_c_lz_o):Added execution tests for 1D and 1D-array comparison samples with texel offsets (
image_sample_c_lz_o), including cases with non-zero Y offset values in the RDNA instruction dwords. Verified that the recompiler correctly zeroes the vertical offset for 2D height-1 sampling while preserving horizontal offsets.Explicit LOD (
image_sample_c_l):Added execution test coverage for 1D depth comparison sampling with explicit LOD (
image_sample_c_l), confirming correct compilation and sampling at LOD 0.Storage View Sub-ranges (
ArrayLayersServeView):Updated
ArrayLayersServeViewto support 1D array textures serving 1D (first slice) and smaller 1D array views, matching 2D array behavior.Depth Copy Base-Level Views:
Ensured
prepareBaseLevelViewis invoked for depth-copy texture instances inTexture(DepthCopyTag)to prepare single-level views when mipmapped.All focused tests (
agc_driver_image_one_dimensional_compare,agc_driver_depth_compare_copy,agc_driver_emulated_color_compare,agc_driver_image_plane_compare_on_line,agc_shader_disk_cache) pass with Vulkan validation layers enabled and 0 VUID errors. Conventions and PR overlap checks pass cleanly.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T08:39:46Z.
Thanks for the extra cases; the new
image_sample_c_lz_oandimage_sample_c_lchecks pass locally on an RTX 4090 and on llvmpipe (Mesa 25.2.8).The gather condition from the earlier comment is still in this head, though, at
SpirvImageEmitter.cpp:1206:agc_driver_image_gather_one_dimensionalstill fails SPIR-V validation on bdacbe03ba on both devices (OpImageQuerySizeLod: "Result Type has 1 components, but 2 expected"), and passes with only that condition put back to main's form (the other gather, compare and depth-copy tests pass either way). It's not in the focused test list you ran, so it's easy to miss. Could you key it onaccess.image.remappedDepth1Das suggested, or drop it?One question on the new
ArrayLayersServeViewchange: letting 1D-array surfaces serve 1D and smaller 1D-array views applies to every 1D-array texture, colour ones included, not only the depth images this PR remaps. If it's needed for this fix, could you say which case needs it and add cases for it next to the 2D-array ones intests/GuestTextureResource.cpp? Otherwise it would be easier to review as its own PR.Imported from boykopovar/AnyPS5. Originally posted by KarthikeyaAnna on 2026-10-20T08:53:25Z.
Keyed the 1D gather condition strictly on
access.image.remappedDepth1DinSpirvImageEmitter.cppand explicitly refuse remapped 1D depth gathers (ctx.Fail(access.inst, "has an unsupported 1D gather variant")). Non-remapped gathers are left untouched, andagc_driver_image_gather_one_dimensionalandagc_driver_image_gather_one_dimensional_arraycompile and pass without SPIR-V validation errors.Also added tests in
ImageOneDimensionalCompare.cpp(Code1D_Gather_C_LzandCode1DArray_Gather_C_Lz) verifying that 1D and 1D-array depth gathers are cleanly rejected with"has an unsupported 1D gather variant".Dropped the
ArrayLayersServeViewchange fromGuestTextureResource.cppso it can be reviewed independently in a separate PR, keeping this PR strictly focused on 1D depth comparison textures.Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-20T09:12:56Z.
A first AMD run, on a discrete RDNA 2 card: RX 6700 XT (gfx1031), AMD's Windows driver 32.0.21045.5002, Windows 11 26200, MinGW GCC Release. It compares
maine9a5a0c84plus only this PR's newImageOneDimensionalCompare.cppwithmainmerged with this head,c97e5e033(the merge is clean).There are 17 tests:
agc_driver_image_one_dimensional_compareagc_driver_image_gather_one_dimensionaland_array, andagc_driver_image_one_dimensional_arrayagc_driver_depth_compare_copyagc_driver_emulated_color_compareand_srgb_decodeagc_driver_image_plane_compare_on_line, andagc_driver_image_plane_address_on_linewith_implicit_lodagc_driver_image_address_dimension,agc_driver_image_sample_derivativesandagc_driver_image_sample_lod_clampagc_driver_depth_plane_sampling,agc_driver_native_multisample_depthandagc_driver_image_array_sample_on_volumeagc_shader_disk_cachemain+ new test--repeat until-fail:3agc_driver_image_one_dimensional_comparefails-VVUID-linesVUID-linesThe layer loaded in all 17 test processes on both sides.
VK_LOADER_DEBUG=layerprintedInsert instance layer "VK_LAYER_KHRONOS_validation"17 times per side, and no "was not found but was requested" line appeared.This driver is unlike RADV: on
mainit creates the test's 1D D16_UNORM image with no validation error, and the four 1D and three 1D-array comparison cases pass.mainfails at the next case,1D image_sample_c_lz on 1D array first layer, with:Shape 0 is
Image1Dand dimension 5 isk1DArray. So on AMD's Windows driver, the failure onmainis the 1D read of a 1D-array T#'s first layer, which this PR'sfirstLayerchange inShaderResources.cppaccepts. It is not the creation of the 1D depth image.Not tested: RADV, the driver that rejects 1D depth images, and the full CTest suite.
Imported from boykopovar/AnyPS5. Originally posted by KarthikeyaAnna on 2026-10-20T13:59:39Z.
@oneandonlydean what do you think?
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T14:24:07Z.
Thanks. Nothing is needed from you right now. Full CI is green on
c97e5e033(Linux and Windows), and the AMD results above line up with that. Because this changes how depth comparison textures are backed, it also gets a GPU test run against main on real titles. That run is queued behind the current test queue, and a final review follows it. If the run turns up a problem, we'll post the details here.Imported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-20T20:59:33Z.
RADV run, the driver #7923 was reported on. Head
c97e5e033merged ontomainc6145997e(clean merge), built in full and compared with the samemain, on the same machine.AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release.
With the Khronos validation layer (
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1) overagc_driver_image_one_dimensional_compare,agc_driver_image_plane_compare_on_line,agc_driver_depth_compare_copy,agc_driver_image_gather_one_dimensional,agc_driver_image_gather_one_dimensional_arrayandagc_shader_disk_cache:mainmain+ this PRVUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251(the 1DD16_UNORMimage from #7923)main)So on RADV the 1D depth comparison texture is no longer created as an image the device rejects. The only other message is
VkDeviceCreateInfo-pNext-pNext, which my older 1.3.275 layer prints for every device because it doesn't knowmaintenance8.Full suite (
ANYPS5_REQUIRE_VULKAN=1 ctest -j8) atd13e1a29a: 1736/1737 with this PR, against 1735/1736 onmain. The one failure is the same on both, so this PR adds none:agc_driver_guest_memory_lifetime(#7784). Comparing the JUnit output withmain, the only difference is the newagc_driver_image_one_dimensional_compare, which runs and passes; nothing is skipped or removed.GPUs tested: AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8, Linux Mint 22.3 / kernel 7.0.0-38
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by janzezno on 2026-10-20T23:04:26Z.
Run on RADV, where #7923 reproduces.
Host: Arch Linux, kernel 7.2.11, AMD Radeon RX 7900 GRE (RADV NAVI31), Mesa 26.2.5, GCC 16.2.1, Release,
BUILD_TESTING=ON.maine25333e39; PR headc97e5e0338merged on top (clean merge).ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -R 'compare|denorm|f32|f16|f64|agc_shader_memory|agc_shader_disk_cache|request_serializer|dcc|storage|pm4|indirect' -Vmain: 137 of 137 pass;agc_driver_image_plane_compare_on_linelogsVUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251(D16_UNORM,VK_IMAGE_TYPE_1D,VK_ERROR_FORMAT_NOT_SUPPORTED).agc_driver_image_one_dimensional_compare; the02251errors are gone and noVUID-is new.was not found but was requested).