fix(agc): read 1D-array T#s through DIM 1D from their base slice #23688
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/23688"
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 MichonGoddijn231849 on 2026-11-19T13:10:53Z.
What
A DIM 1D
image_sample*orimage_loadthrough a 1D-array T# compiles to the plain 1D mode the recompiler already offers for 1D arrays. At binding it then failed withAGC graphics: guest texture dimension disagrees with the shader's declared image shape (shape 0, dimension 5). Only 2D reads of 2D arrays were narrowed to their base slice (the2D reads of 2D arraysdebt entry).Measured on gfx1036, a DIM 1D access through a 1D-array T# reads slice
BASE_ARRAYand ignores any further address VGPR. Such a binding is now narrowed the same way:GuestTextureResource.cpp(FirstLayerDescriptor): narrows a 1D array as well as a 2D array.ShaderResources.cpp:firstLayerWordsnarrows a 1D shape over a 1D array and a 2D shape over a 2D array, and nothing else. A 1D array read through a 2D shape keeps its existing rows binding (layerRowsBinding).Texture.cpp:createFirstLayerViewmakes a 1D view of the base slice for a 1D array, and the first-layer sRGB view does the same.1D reads of 1D arraysentry next to the 2D one.Measurement:
tools/hw-oracleon gfx1036. The source was a 64-texel 32_FLOAT 1D-array T# with six slices whose texels encode slice·100 + x, atBASE_ARRAY0, 1 and 3. There were 32 rows per case, with u in [-0.2, 1.2], second VGPRs of 0, 0.5, 1, 2, 5 and -1, and integer x and y for the loads:main, NVIDIA / AMDimage_sample_lz,image_sample,image_sample_lBASE_ARRAY, second VGPR ignoredBASE_ARRAYimage_loadBASE_ARRAY, y ignoredBASE_ARRAYDIM 1D_ARRAY through the same T# matched before and still does.
Tested
Windows 11 Pro 10.0.26200, MinGW Release build.
ctest --test-dir build -R '^agc_driver_image|^agc_shader_memory$' -VwithANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer, onmainand on this branch. The GPUs were an NVIDIA GeForce RTX 5080 (610.74) and an AMD Radeon(TM) Graphics iGPU (gfx1036, 32.0.21045.16010).mainNVIDIAmainAMDInsert instance layer "VK_LAYER_KHRONOS_validation"was not found but was requestedVUID-The three NVIDIA failures are the same on both sides:
agc_driver_image_plane_address_on_line,agc_driver_image_sample_lod_clampandagc_driver_image_sample_lod_clamp_shader_lane, known on this machine.agc_driver_graphics(which includes theFirstLayerDescriptorunit checks) passes.agc_driver_image_one_dimensional_arraycovers:BASE_ARRAY0 and 2:image_sample_lzandimage_loadmust read sliceBASE_ARRAYwhatever the layer VGPR holds;main's three driver files the test fails on both GPUs with the refusal above.agc_driver_image_array_rows_past_layer_limitandagc_driver_image_array_window_past_layer_limit(a 1D array within maxImageArrayLayers was bound as rows of a 2D image). Pairing the shape with the array dimension infirstLayerWordsfixed both, and the run above is with that fix.tools/pr_overlap.pycould not compare these files with 65 PRs that conflict withmain. Of those, only #10193, #13928 and #13929 add afirstLayerline, in new device-image-key code for 2D arrays; none changes the paths edited here. #21944 (PS4 tile modes on 1D arrays) touches 1D arrays but not their narrowing. Not tested on a PS5.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-21T07:46:54Z.
Review: APPROVED
Reviewed — looks good
The reviewed code adds first-slice handling for sampled 1D reads of 1D-array textures; the inspected paths and test changes support the stated behavior.
What I ran
No build or tests were run in this review. The author reports hardware tests on Windows 11 with NVIDIA and AMD GPUs; those results were not independently verified.
Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No commands or tests were run. The author-reported test results and hardware measurements were not independently verified. The full text of
ShaderResources.cppandTexture.cppwas excluded from the review folder; I read the changed hunks and relevant surrounding ranges through the pinned-head reader. I read the changed lines in all five files listed as reviewed in the manifest. No other files were excluded byfiles.json; that file was not available through the review reader.To get this to a good state
Nothing is required.