fix(agc): sample cube descriptors with fewer than six slices as six faces #11507
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11507"
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-26T17:37:50Z.
What
A cube texture descriptor whose
BASE_ARRAYtoDEPTHrange holds two to five slices threw (guest cube texture descriptor holds fewer than 6 array slices). When every access the shader makes to it takes a sampler, it now exposes six faces fromBASE_ARRAY, which is what RDNA2 samples. A shader that loads, stores or queries dimensions through such a descriptor is rejected instead, because on the hardware those stop atDEPTHand a six-face view cannot reproduce that.GuestTextureResource.cpp): a cube range of fewer than six slices exposes facesBASE_ARRAYtoBASE_ARRAY + 5. The equalBASE_ARRAYandDEPTHcase from #1308 becomes one case of that rule.sampledOnlywhen every access to it takes a sampler (ImageOpcodeInfo::needsSampler: samples, gathers and LOD queries). It is part of the shader info, so the disk cache encodes it.mainalready moved the format to 48 with #8077, which also addedoptionalDescriptor, so this PR takes format 49 and counts 45ImageResourcefields in the encoder check.sampledOnly("a cube descriptor with fewer than six slices is implemented only for sampling; loads, stores and dimension queries through it stop at its last slice").Hardware
tools/hw-oracleon the RDNA2 integrated GPU of a Ryzen 7 9800X3D (gfx1036, ROCm 7.2.4 HSA runtime, Arch Linux), wave32,ieee 0,dx10_clamp 1,denorm32 3,denorm16 3,round32 0,round16 0,fp16_overflow 0. A cube T# over 24 slices of 64x64 R32_UINT, slicesfilled with its own value, read at the face centres:BASE_ARRAY,DEPTHimage_sample_lzfaces 0 to 5image_loadfaces 0 to 5image_get_resinfodepthSW_256B_S, withRESOURCE_LEVEL0 and 1.SW_64KB_R_XwithBASE_ARRAY0 andDEPTH4: samples of faces 0 to 5 read slices 0 to 5, and the load of face 5 returns 0.image_sample_lza quarter texel inside the +X face's -Z edge returns 0.75 × face 0 + 0.25 × face 5 for every range above, so the seamless filter also takes face 5 from the slice pastDEPTH.Title
Skyrim (PPSA03747 01.001.010) stops on this descriptor once the MayDecide fix in #11506 lets it past the New Game load:
The only shader of its 3586 that addresses a cube is pixel shader
0x121ddc3d00. It samples it once (image_sample,dim:SQ_RSRC_IMG_CUBE, dmask 7), with the face fromv_cubeidand no array index, and does not load or query it.Runs on
main88795ed448, this branch's base, Cross pressed every 30 s:The same pair on the previous base,
main5bdda3661e: 156 s with the refusal, and the opening until the limit with this PR, where the cube is created as a 512x512 view of six slices at0x11fb630000.Tested
main951e5963a4and this headb9f4f65904(mainmerged in, then the format and field-count update), same machine and GPU: Linux (Arch, kernel 7.2.11), AMD Radeon RX 9070 XT (gfx1201) with RADV, Mesa 26.2.5, GCC 16.2.1, Release.ctest -VwithVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(Khronos validation layer 1.4.363; the loader logsInsert instance layer "VK_LAYER_KHRONOS_validation"),ANYPS5_NO_SHADER_CACHE=1andANYPS5_REQUIRE_VULKAN=1, on the cube tests and the ones this change touches:agc_recorder_cube,agc_driver_graphics,agc_shader_memory,agc_shader_disk_cache,agc_shader_disk_cache_large_file,agc_driver_depth_plane_sampling,agc_driver_image_plane_address_on_cube,agc_driver_image_resinfo_dimension,agc_driver_image_sample_cube_derivatives,agc_driver_image_store_face_on_cube,agc_driver_vop3_cube_clampand the newagc_driver_image_sample_short_cube.main: 11 of 11 pass. This head: 12 of 12 pass.was not found but was requested by env var VK_INSTANCE_LAYERS, and neither has aVUID-line.main88795ed448and head787b6a6720gave 10 of 10 and 11 of 11, also withoutVUID-lines.main5bdda3661e: the 1497 teststools/select_tests.pyselects for this change,ANYPS5_REQUIRE_VULKAN=1: 1496 pass.agc_driver_tessellationsegfaults the same way onmain(#5444).agc_driver_image_sample_short_cube: a compute shader samples a cube of 64x64 R32_FLOAT slices at each face centre throughimage_sample_lzfor sevenBASE_ARRAY/DEPTHpairs and checks the measured slices; animage_loadthroughBASE_ARRAY0,DEPTH4 must be rejected. It passes 3 of 3. Withmain's production files it fails with the refusal above; with only the decode change it fails because the load is accepted. The bilinear edge rows are not in it: onmaina whole cube does not filter across faces either, since each face is sampled as a layer of a 2D array.agc_driver_graphicsdecodes ranges (0, 4), (0, 1), (2, 5) and (6, 10) to six faces fromBASE_ARRAY;agc_recorder_cubesamples the snapshot and storage views of (0, 4) and (2, 5) cubes at every face;agc_shader_memorychecks the runtime mode accepts a sampled five-slice cube and rejects a loaded one, a loaded six-face cube and a seven-slice cube stay accepted, and a stored three-slice cube is rejected;agc_shader_disk_cacheround-trips the new flag.tools/check_conventions.pypasses.tools/pr_overlap.pylists only neighbouring lines: the disk cache format version inShaderDiskCache.hpp, which 14 open PRs also raise;ResourceMaterializer.cppbeside #7085 and #9889; andResourceTracker.cppbeside #10867. None of them changes cube ranges.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)tools/hw-oracleImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T17:46:02Z.
Review: CHANGES_REQUESTED
The branch is 150 commits behind current
main(5bdda3661emerge base; currentmainis88795ed448). Please rebase or otherwise sync it before merge and rerun the required AGC comparison on currentmainand the updated change, on the same machine/GPU with the specified Vulkan validation settings. The report’s title and test runs use the older base, and hosted product/relinker jobs are skipped, so they do not establish behavior against currentmainor replace the paired run required byCONTRIBUTING.md.My changed-path comparison found only
docs/dev/debt/libSceAgcDriver.mdshared with the intervening commits; I have not found a specific implementation defect in this review. Localtools/check_conventions.pyandgit show --checkpass. Please update the evidence and request another review after syncing; changes requested for branch freshness and required validation, not for a demonstrated runtime defect.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T19:13:44Z.
Review: DISMISSED
The branch freshness and paired Vulkan validation requested in my previous review are now addressed: this head is based on main
88795ed448, and the same-machine RX 9070 XT/RADV/Mesa 26.2.5 run reports 10/10 on main and 11/11 on this head, with the validation layer loaded and no missing-layer message or VUID lines. The applicable hosted checks pass; product and relinker jobs are skipped.One separate merge-order issue remains. This PR changes ShaderDiskCache format 47 to 48 for the new serialized image field. Still-open #11551 also changes the same format from 47 to 48 for depth-bounds metadata, and its review already requests coordination and a declared dependency. If both changes land, the second must advance the format again to 49 (and retain both serialization changes). Please coordinate with #11551’s author, record the agreed order in Depends on, and update the follow-up format-bump plan before approval. The checklist currently says Depends on: none, so the ordering is not declared yet. I found no implementation defect in the cube-range handling; this request is limited to the conflicting cache-format merge plan.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-27T04:44:24Z.
Review: COMMENTED
Head
787b6a6720merged onto currentmainb986c11a34merges without a text conflict, but the result does not compile on any host. #8077 (merged intomaintoday) also added a field toImageResource(optionalDescriptor) and also moved the shader cache format from 47 to 48, so the two bumps land on the same numbers:The CI product jobs (
linux,windows) are skipped on this PR, so nothing reports it.Fix, on top of the merge:
ShaderDiskCache.cpp:fieldCount<ImageResource>() == 45.ShaderDiskCache.hpp:FormatVersion = 49.mainis already 48 withoptionalDescriptorand withoutsampledOnly, and the merge keeps 48 silently because both sides made the same edit.The auto-merged encoder and decoder already write and read both
sampledOnlyandoptionalDescriptor. The Linux-onlysizeof(ImageResource) == 96check still holds, because the newboolfits in padding.With those two lines changed locally (Ubuntu 26.04, GCC 15.2, Release, full build),
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1,-j1:agc_driver_image_sample_short_cubeagc_shader_disk_cache,agc_shader_disk_cache_large_fileagc_shader_memory,agc_recorder_cubeagc_driver_image_plane_address_on_cube,_sample_cube_derivatives,_store_face_on_cube,agc_driver_vop3_cube_clampagc_driver_graphics(decoder cases) also passes.GPUs tested: NVIDIA GeForce RTX 3070 (proprietary 595.99.02, Linux), lavapipe (Mesa 26.0.3, LLVM 21).
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-27T10:27:58Z.
Review: COMMENTED
Follow-up on head
b9f4f65904: thefieldCount/format issue from my previous review is fixed, and the merge withmainnow builds and passes on Linux.Machine: Ubuntu 26.04, GCC 15.2, Release,
ninjaofallplus every*_teststarget. Head merged onto currentmain801d5b9bcwith no conflicts.fieldCount<ImageResource>() == 45holds withoptionalDescriptorfrom #8077 and the newsampledOnly, andFormatVersionis 49. The Linux-onlysizeofchecks inShaderDiskCache.cppandPipelineJournal.cppare unchanged and hold (ImageResourcestays 96 bytes).public_headerspasses 65 of 65.ANYPS5_REQUIRE_VULKAN=1andANYPS5_NO_SHADER_CACHE=1. These are the 12 tests from your paired run.VUID-lines.VUID-lines.ImageSampleShortCube.cppalone onmain801d5b9bcfails on both devices withguest cube texture descriptor holds fewer than 6 array slices (format 22, 64x64x5, type 11, tile 0, mips 0..0 of 1) (base array 0).^agcon lavapipe (without display, flip andlds_atomics64): 1054 of 1055 pass. The one failure,agc_driver_multisample_retirement, also fails onmainon this machine.GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02), lavapipe (Mesa 26.0.3), Ubuntu 26.04
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.