fix(shader): ignore unused descriptor fields for scalar buffer loads #5049
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5049"
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 eljackjoestar-cmd on 2026-10-13T09:40:39Z.
What
A scalar-only
s_buffer_load_*resource can carry non-buffer fields in its descriptor. The recompiler previously rejected word 3's TYPE; this PR normalizes word 3 only for scalar-only resources. Review also found that Kena reachedShaderResources::addGuestBufferand stopped on reserved bit 30 of word 1. The same scalar-only normalization now clears that bit before building the driver-visible descriptor, preserving base address, stride and record count.Vector, mixed scalar/vector, formatted, writable, atomic and image-alias resources retain their validation. No driver-wide acceptance of reserved bits is added.
Semantics source: AMD RDNA2 ISA §7.2.1, printed page 52 (PDF page 60), describes the scalar buffer fields as base address, stride and record count, with other fields ignored: https://gpuopen.com/download/rdna2-shader-instruction-set-architecture.pdf . Native console/ISA comparison of the ignored reserved bit is not claimed.
Lost Soul Aside (PPSA26358), captured shader
0x12c2298400, previously stopped on unsupported descriptor TYPE. A Kena run reported in review exposed the later reserved-bit rejection. This addresses those validation rules; no new Kena game run or completed gameplay is claimed.Tested
Rebased onto current main
f87799aa3, Windows 11 Pro, GCC 15.2, Release, SPIRV-Tools OFF. Full Windows build passed.The new native regression failed before the reserved-bit normalization with
AGC graphics: buffer descriptor has reserved bits set. With the fix, every lane receives the expected scalar value across both reserved-bit states and four word-3 patterns (including image-shaped TYPE and all bits set). Vector-only and mixed scalar/vector resources still reject non-buffer TYPE during recompilation and reserved word-1 bits during driver dispatch.agc_driver_buffer_descriptor_runtime,agc_shader_memory,agc_driver_buffer_load_store,agc_driver_scalar_wide_loads.Checklist
main; no equivalent open PR foundImported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-13T17:08:00Z.
Tested on Kena: Bridge of Spirits (PPSA01802), Linux/RADV (RX 9070 XT), on main
0214069e3with this PR merged.Kena has the same pattern: a pixel shader binds a T# in buffer slot 1 and reads it only with scalar loads. The read extent is 108 to 112 bytes, first used at pc 0x94. One example of the words is
20f56700 caa00000 03ffc3ff 909c0fac.buffer descriptor uses an unsupported type(about 7.1k skips in a 5 minute run).ShaderResources::addGuestBufferchecks word 1 bit 30 before anything else and refuses withbuffer descriptor has reserved bits set(1,353 skips in the same window). The T#'s word 1 (0xcaa00000) has that bit set, and this PR only normalizes word 3.0x20f56700(T# word 0 plus the low 16 bits of word 1). That address isn't registered guest memory here (RegisteredReadableEndreturns 0). Stride × NUM_RECORDS from the T# words also comes out at several GB, overmaxStorageBufferRange.So for this title the scalar-only case also needs the driver path to stop validating fields that
s_buffer_loaddoesn't use, and to decide what an unmapped base reads. As a local test only, I bound it as an empty buffer, and Kena then reaches its combat tutorial with the arena lit. I'm not claiming that is the right upstream behaviour.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T05:10:41Z.
The conventions check fails because the body lost the template sections (What, Tested, Checklist); please put them back.
alfalfa-star's Kena run shows the same scalar-only T# now stops in the driver instead:
ShaderResources::addGuestBufferrefuses word 1 withbuffer descriptor has reserved bits set. Ifs_buffer_loadignores those fields, the driver check needs the same rule for scalar-only buffers, otherwise the titles still stop. Can you cover that here?Imported from boykopovar/AnyPS5. Originally posted by eljackjoestar-cmd on 2026-10-14T07:51:46Z.
Restored the
What,TestedandChecklistsections and rebased ontof87799aa3. The scalar-only snapshot normalization now also clears reserved bit 30 of word 1 before the driver-visible binding is built, while preserving the base, stride and record count. The general driver check remains strict for vector/mixed and other non-scalar-only uses.The new native case failed before the change with
AGC graphics: buffer descriptor has reserved bits set. Withafd9b92b0, all scalar readbacks pass across both word-1 states and four word-3 patterns; vector-only and mixed uses still reject reserved bits during dispatch and non-buffer TYPE during recompilation. Full Windows Release build, four focused NVIDIA checks and three AMD Vulkan checks pass without skips; conventions pass. I have not rerun Kena itself, so this is an end-to-end driver regression result, not a new Kena gameplay claim.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T09:43:19Z.
Rebased onto main: kept both debt entries in
docs/dev/debt/shader.md; build and shader tests pass.Imported from boykopovar/AnyPS5. Originally posted by p3n1cillin on 2026-10-14T14:33:08Z.
Heads-up @eljackjoestar-cmd: a first-parent bisect points at this merge for a regression in Surround Sound Studio (PPSA99051). It exits about 3 s in with
[ps5-agc] submission retirement failedon Windows/NVIDIA, and is fine oneecf90953. Details and the bisect table are in #5876.