Repository navigation
Conversation
…nt through the GCN decode PresentDisplayBuffer presents a tiled display buffer from its resident image when a draw rendered it. Otherwise it uploaded the buffer with GpuColorTransfer in the PS5 render-target layout, which needs 64 KiB alignment and does not know GCN tiling. A PS4 title that flips a buffer before drawing into it, with its buffers 32 KiB aligned, failed with "null or misaligned address". A GCN-tiled buffer without a resident image is now read through ReadDisplayBuffer, which decodes the GCN layout and checks the buffer's own 4 KiB alignment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In a GCN T#, word 0 and bits 0-5 of word 1 hold the 256-byte base address; bits 6-7 of word 1 are MTYPE_L2 (shadPS4's resource.h: base_address : 38, mtype_l2 : 2). The decode read 40 bits, so a T# with MTYPE_L2 set addressed bit 46 (0x4002_xxxx_xxxx), which no guest page backs: "storage texture has no committed guest pages". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GCN MTBUF has the RDNA layout except that word 0 bits 19-25 hold DFMT (4 bits) and NFMT (3 bits) where RDNA has one 7-bit unified format. Opcodes 0-7 (tbuffer_load/store_format_x to xyzw) are the same, word 1 bit 21 (RDNA's opcode bit 3) is reserved on GCN, and bit 15 (ADDR64) has no RDNA counterpart and still throws. The format is mapped with GcnBufferFormats(), the table the V# decode already uses; a DFMT/NFMT pair without an RDNA format throws. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…GCN pitch alignment A PS4 color target with tile mode index 8 (ARRAY_LINEAR_ALIGNED) used the PS5 linear layout, which pads the pitch to 256 bytes. GCN aligns a linear-aligned pitch to max(8, 64 / bytes per element) elements, as AddrLib's SiLib::HwlGetPitchAlignmentLinear does for a surface that is not interleaved and as this driver's PS4 texture layout already does. A 320-element 16-bit target failed "PS4 color target pitch or slice is not padded the way its tile mode pads them", and its rows would have been addressed 384 elements apart. ColorTileMode::GcnLinear has that pitch alignment and is linear and GCN everywhere else. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VOP1 0x2c (VOP3 0x1ac) has no RDNA opcode. It is decoded as V_RSQ_F32 and tagged VRsqClampF32, whose translation is the V_RSQ_F32 one with an infinite result replaced by the largest finite float of the same sign, as GCN defines the instruction (D = 1 / sqrt(S0), clamped to +-max_float). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SOPK 0x03 to 0x0e (s_cmpk_*) and 0x0f (s_addk_i32) have the same opcodes and fields on RDNA, which the RDNA decoder already handles, so the GCN table now maps them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
agc_gcn_decode checks the new GCN translations through DecodeGcnInstruction: - tbuffer_store_format_xyzw keeps its opcode, offset and flags, and its DFMT/NFMT become the unified format of GcnBufferFormats(); - ADDR64 and DFMT INVALID still throw; - v_rsq_clamp_f32 decodes as VRsqClampF32 in VOP1 and VOP3 while v_rsq_f32 keeps its opcode; - s_addk_i32 and s_cmpk_* decode as their RDNA opcodes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With IMM 0 and OFFSET 255 a GCN SMRD reads a 32-bit literal that counts dwords. It becomes the byte offset of the RDNA SMEM encoding with a null SOFFSET; a literal past the 20-bit positive offset range throws. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A thin-tiled PS4 volume is stored like a layered surface whose level n holds max(1, depth >> n) slices, padded to a power of two with POW2_PAD. It becomes one 3D image of its depth; thick modes still throw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GCN MIMG has no DIM field: the T# type decides how many address VGPRs the hardware reads. The materializer now takes the dimension from the T# instead of refusing one that differs from the inferred 2D or 2D array, the translation reads up to three more address VGPRs, and the emitter counts the coordinates and gradients for the T#'s dimension. An image selected at run time offers every T# dimension SPIR-V can express for its accesses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The SOPK branch of the GCN decoder never set the literal for s_setreg_imm32_b32, so the eight-byte instruction was re-encoded as one word and its decode threw "literal operand word is out of the code span bounds". The decoder now copies the literal for that opcode. Co-authored-by: javierUDP <35921725+javierUDP@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @savvaniss. boykopovar#6977 is now a draft integration branch, and its own work is split into boykopovar#9429 to boykopovar#9433 (details). The maintainers asked that the branch not land anything without its own review, so could you open this upstream against AI-assisted: yes (Claude Code) 🤖 Generated with Claude Code |
|
Moved upstream as two pull requests: the shader half is boykopovar#9889, straight on |
What
Ten fixes to this PR's PS4 path, found while bringing up Risk and Monopoly Plus from CUSA03312 (Hasbro Family Fun Pack, my own dump) on top of boykopovar#6977. With them, the converted Risk executable plays a local match against the AI, and Monopoly Plus reaches its loading screen. This targets boykopovar#6977's branch so you can take any of them into your PR; each commit stands alone.
PresentDisplayBufferuploaded a tiled display buffer with no resident image throughGpuColorTransfer, in the PS5 render-target layout. That layout needs 64 KiB alignment and doesn't know GCN tiling. Risk flips its 32 KiB-aligned 1920x1080 buffers before drawing into them and failed with "null or misaligned address". A GCN-tiled buffer without a resident image now goes throughReadDisplayBuffer, which decodes the GCN layout and checks the buffer's own 4 KiB alignment.MTYPE_L2, so the base is 38 bits (shadPS4'sresource.h:base_address : 38; mtype_l2 : 2).DecodeTextureResourceread 40 bits, soMTYPE_L2 = 1set address bit 46, and a storage texture failed with "storage texture has no committed guest pages".GcnBufferFormats().max(8, 64 / bytes per element)elements, as AddrLib'sSiLib::HwlGetPitchAlignmentLineardoes and as this PR's PS4 texture layout already does.ColorTileMode::GcnLinearcarries that alignment.V_RSQ_CLAMP_F32(VOP1 0x2c, VOP3 0x1ac) has no RDNA opcode. It decodes asV_RSQ_F32taggedVRsqClampF32, and an infinite result becomes the largest finite float of the same sign.s_cmpk_*,s_addk_i32) have the same opcodes on RDNA and are now in the GCN table.ImageResource::gatheredflag records). Risk samples a cube T# and a 2D T# under DA samples; Monopoly Plus samples a 3D T# under a 2D-inferred sample.s_buffer_load_dwordx4with a literal.POW2_PAD. That is how ac_surface and AddrLib's PostComputeMipLevel count them. It becomes one 3D image of its depth; thick modes still throw.s_setreg_imm32_b32keeps its literal (new; @javierUDP's suggestion on feat: run PS4 games on the AGC driver — Limbo (CUSA01664) in game (integration branch) boykopovar/AnyPS5#6977). The SOPK branch of the decoder never copied the literal of this eight-byte instruction, so it was re-encoded as one word and its decode threw "literal operand word is out of the code span bounds". The commit credits @javierUDP as co-author.Tests:
agc_gcn_decodecovers 3, 5, 6, 8 and 10.agc_driver_graphicscovers 9, throughTextureTiling.cpp.agc_shader_memorycovers 7. It checks the run-time modes on a 2D-inferred image, and the dimension each T# selects. It also checks that gathers and comparisons refuse the dimensions SPIR-V lacks. And it recompiles a GCN compute shader (s_load,image_sample_lz,buffer_store) whose T# is 3D, and checks that the sample reads a 3D image with three coordinates. Both new checks fail without the change.Not in this PR:
ADD_TIDand a type of 2. That V# is really the first half of the pixel shader's BC3 T#, read from the vertex-buffer-table slot of that draw, and two runs failed on different draws. WithAPS5_SYNC_DRAWS=1andAPS5_SYNC_FLIP=1the menus and the game work. Trivial Pursuit Live! and Boggle hit the same kind of stop. There the cause was an extra end-of-pipe event on every flip, which let the title run up to 16 frames ahead and rewrite tables still in use. With fix(agc): stop flips raising the end-of-pipe event on queues with release interrupts (#7137 on the PS4 branch) #5 (fix(agc): suppress the flip end-of-pipe event on queues that raise release interrupts boykopovar/AnyPS5#7137's latch on this branch) both run without the sync switches. I have not rerun Risk without them yet.sceGnmDrawInitDefaultHardwareState200emits your 1.75 sequence; the 2.00 one is not known to me.sceGnmUpdate{Ps,Vs,Gs,Hs}Shaderemit thesceGnmSet*Shaderpackets.sceNpTrophyGetGameInforeturnedTITLE_CONF_NOT_INSTALLEDhere; feat(np): answer and declare the PS4 NP, trophy and GNM imports of CUSA03312 #2 now implements it from the trophy package.main: quad lists (feat(libSceAgcDriver): support quad-list primitive type boykopovar/AnyPS5#6529, merged), the LoadExec fix (5b072bc) and the SSL validity queries (feat(libSceSsl): implement certificate validity period and fingerprint queries boykopovar/AnyPS5#5969). A rebase picks them all up; Risk draws quad lists once a match starts.plgoPlayGo headers) and fix(agc): accept a draw without a pixel program while CB_COLOR_CONTROL disables color boykopovar/AnyPS5#8078 (depth-decompress draws withCB_COLOR_CONTROLdisabled).main, and in feat(np): answer and declare the PS4 NP, trophy and GNM imports of CUSA03312 #2 for the libraries only feat: run PS4 games on the AGC driver — Limbo (CUSA01664) in game (integration branch) boykopovar/AnyPS5#6977 adds.Tested
Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, on boykopovar#6977's head
93eeee014.VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_REQUIRE_VULKAN=1andANYPS5_NO_SHADER_CACHE=1. Ranctest -R <tests> -Von your head and on this branch. The tests:agc_display_buffer_dcc,agc_driver_graphics,agc_driver_gcn_detileandlinear_display_buffer;packed_unorm,srgb8,uint8x4anduint8x4_no_resident;agc_shader_memory,agc_shader_disk_cacheandagc_shader_type_zero_image_materialization;agc_gcn_decode, on this branch only.93eeee014f9b38d16dNeither log reports
was not found but was requested by env var VK_INSTANCE_LAYERS. Both sides log the same threeVUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605errors on both GPUs, all fromagc_driver_srgb8_color_target, so this branch adds noVUID-.root=/app0/risk sku=eu) on the RX 9070 XT, withAPS5_SYNC_DRAWS=1andAPS5_SYNC_FLIP=1. The rest of the stack: the PRs above, quad lists, and the local stand-ins above. It plays its intro, reaches the title, Uplay and main menus, and plays a three-player match against the AI: draft, attack and fortify turns. The menus run at 18-20 fps and the board at 6-8 fps with the sync switches.root=/app0/monopoly). With fixes 7 to 9 it gets past its 3D colour texture and literal SMRD loads and shows its loading animation at 60 fps.agc_gcn_decodecase decodes{0xba80f801, 0x12345678, 0xbf810000}. Onf9b38d16d7it fails with "literal operand word is out of the code span bounds". With0dd1e4b384it decodes asSSetregImm32B32, two words, with the literal insource0. Fix 10 changes only the GCN decoder, andagc_gcn_decodeopens no Vulkan device, so it adds nothing to the validation logs above.tools/check_conventions.py --base 93eeee014passes.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