AGC driver: PPSA99005 (ps5-opengl, Mesa shaders) aborts in DecodeVertexStageInfo: header pointer outside the registered shader header #2026
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Recapi on 2026-10-09T05:18:47Z.
PPSA99005 (blackbearreloaded/ps5-opengl showcase v1.0.1, an OpenGL showcase whose shaders come from the bundled Mesa/opengnm, not Sony's compiler) gets past every import once the open PRs for its absent imports are merged, and then aborts in the AGC driver while preparing a vertex-stage shader:
The throw is
_readHeaderPodinGraphics/src/ShaderInputState.cpp: a pointer read from the shader header lands at or past the end of the header bytes the driver registered. Return addresses on the stack at the abort (symbolized withaddr2lineon the built.prx):so it is the
DecodeVertexStageInfo(snapshot.header, snapshot.headerAddress, userData, nullptr, true)call inShaderRegistry.cpp. I haven't checked which header field points outside: either the header registered for these shaders is shorter than what opengnm emits, or opengnm's header layout differs from whatDecodeVertexStageInfoexpects.Reproduce
Linux (Ubuntu, GCC 15.2.0, full build),
mainf1451396with these open PRs merged locally, all without conflicts:pthread_sigmask, which has no PR yet: a local export that only throws (NotImplemented_nid_no_patch); it is not called before the abortlibc.prxshim, #1497)Then
eboot.binandsce_module/libc.prxfromps5-opengl-showcase-1.0.1-PPSA99005.zipunwrapped from their SELF containers, relinked withrelinker --registry(tools/import_audit.py: 0 absent, 2 stubs:_umtx_op,pthread_sigmask), and run in abwrapsandbox with/dev/dri(RTX 2080 SUPER, driver 595.91.07). The title prints nothing before the abort (exit 134); the message above was read from the thrown exception ingdb.Not tried on Windows.
AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T05:21:47Z.
I traced the throw in
DecodeVertexStageInfo: after copying the fixedShaderheader, it bounds-checks three header-relative pointers:shader.user_data,userDataHeader.direct_resource_offset(fordirect_resource_countentries), andshader.input_semantics(fornum_input_semanticsentries).Could you identify which of those reads throws and report the
headerAddress, registered header byte count, pointer value/offset, and required byte count? That will distinguish an invalid pointer from a count/layout mismatch. If convenient, also include the decoded pointer/count fields from the fixed header andShaderUserData; no full game dump is needed. I don't see enough evidence to change the accepted layout yet.Imported from boykopovar/AnyPS5. Originally posted by Recapi on 2026-10-09T05:51:16Z.
It's the first one,
shader.user_data: the message is_readHeaderPod's, and inDecodeVertexStageInfoonly theShaderUserDataread goes through_readHeaderPod(the other two use_readHeaderArray, whose message says "header array"). It fails by two bytes of tail padding:headerAddress=0x7ffff72f2000, registered header = 342 bytes, the fixed header'sheader_size=0x156(342) tooshader.user_data=0x7ffff72f2120, offset0x120(288)sizeof(ShaderUserData)= 56, so 288 + 56 = 344 > 342ShaderUserDataend at byte 54 (sharp_resource_count[4]at 46..54); the last 2 bytes of the 56 are the padding that aligns the struct to 8. The header ends exactly at 288 + 54 = 342.So the pointer is valid and the layout matches; the bound is
sizeof(T), which includes padding the title's header doesn't carry.This is the first
DecodeVertexStageInfocall (staticAbi= true fromPrepareRegistered,userData.size()= 4,reads= null). Fixed header, read fromheader.data():file_header/version0x34333231/0x18typeuser_data0x120code0x1000sh_registers/num_sh_registers0x60/ 6cx_registers/num_cx_registers0x90/ 11specials/special_sizes_bytes0xe8/ 0output_semantics/num_output_semantics0x118/ 1input_semantics/num_input_semanticsheader_size/shader_size0x156/0xa8embedded_constant_buffer_size_dqw,target,scratch_size_dw_per_threadShaderUserData(the 54 bytes at +0x120):direct_resource_offsetand all foursharp_resource_offsetnull,eud_size_dw0,srt_size_dw0,direct_resource_count0,sharp_resource_count{0, 0, 0, 0}. So the other two reads would not run for this shader: no direct resources, and with no vertex-attribute table it returns beforeinput_semantics.As a local test only (not a proposed patch), copying just the 54 used bytes there lets this call pass; the title then stops at the next check,
sceAgcCreatePrimState: invalid context register offsets, which I haven't looked into.Read with
gdbon the build from the issue (breakpoint onDecodeVertexStageInfo's entry and on__cxa_throw).AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by evDev69 on 2026-10-09T06:05:21Z.
Confirming the comment above independently: same values (
header_size 0x156,user_data +0x120, 2 bytes of tail padding, allShaderUserDatafields zero) on a different setup: Intel Xeon (relinked with--to-intel), lavapipe (Mesa 25.2) under Xvfb. Three additions:Why the header ends at byte 54
opengnm writes the user-data block last and sizes the header to end after its last field:
RESOURCE_LAYOUT_SIZE 54u,header_size = resource_at + RESOURCE_LAYOUT_SIZE(v1.0.1). So every opengnm shader header carries the 54 bytes and not the padding. Whether Sony's headers always leave at least 2 bytes after this block is unknown to me.The next stop:
sceAgcCreatePrimState: invalid context register offsetsThe
vgt_gs_out_prim_typeslot atspecials +0x20is empty (offset 0, value 0).ge_cntl(0x25b),vgt_shader_stages_en(0x2d5) andge_user_vgpr_en(0x262) are present. opengnm writes that slot only forlinkage_primitive_override. HereVGT_SHADER_STAGES_ENis0x2012010, soVGT_SHADER_STAGES_GS_BIT(0x20) is clear. With the bit clear,sceAgcCreatePrimStatereplacescontextValues[1]with the value derived from the primitive type and never uses the slot, but itsvalidcheck rejects the slot's offset first.The stop after that
Skipping that offset check when the GS bit is clear (local test only), the title reaches drawing and terminates in
VideoOutDriver::presentLoopon the check inGraphics/src/State.cpp:PA_SU_SC_MODE_CNTL(0x205) =0x00080244. After the driver's masks the only remaining bit is0x80000(bit 19), the provoking-vertex bit, which an OpenGL title sets for GL's last-vertex convention. That looks like a missing feature rather than a header difference.Neither local change is a proposed patch; they only show what each stop depends on. AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by evDev69 on 2026-10-09T06:08:27Z.
Two clarifications to my comment above, after checking the code paths:
PA_SU_SC_MODE_CNTLis confirmed asPROVOKING_VTX_LAST: opengnm sets it wheneverflatshade_firstis false, GL's default last-vertex convention.sceAgcCreatePrimStatedoes not use the emptyvgt_gs_out_prim_typeslot when GS is off, but the driver does read it:DecodeRegisteredStateinShaderRegistry.cppcopies it into the context registers (state.context[special.vgt_gs_out_prim_type.offset] = special.vgt_gs_out_prim_type.value), so with opengnm's empty slot it writes 0 to context register 0. Relaxing only thePrimStatecheck would leave that write in place. AI-assisten: yes.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T06:24:21Z.
Thanks for the field and header-size measurements. I opened #2063 for this bounds failure. It reads through the end of
sharp_resource_countand leaves the C++ tail padding zero-initialized; the regression test builds a header ending at that field. On Debian 12/GCC 12.2,agc_driver_graphicspasses in 8.82 s, and the conventions check passes.This fixes the reported
DecodeVertexStageInforejection. The latersceAgcCreatePrimStateand provoking-vertex failures you observed remain separate follow-up behavior; I have not changed those paths here.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T06:31:59Z.
Follow-up: I opened #2066 for the next failure in the reproduction.
sceAgcCreatePrimStatenow validatesVGT_GS_OUT_PRIM_TYPEonly when it consumes the supplied special register; with GS disabled and no HS, it emits the value derived from the primitive type. The registered-state decode also skips the absent offset-zero slot.agc_shader_helpersandagc_driverpass locally on Debian 12/GCC 12.2. This doesn't address the laterPA_SU_SC_MODE_CNTL.PROVOKING_VTX_LASTcheck, which needs its own semantics review.Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-10T05:34:05Z.
The ps5-opengl family on Windows (not tried there yet, per the report): Windows 11 (10.0.26200), WinLibs GCC 15.2.0 r7, NVIDIA RTX 5070 Laptop (616.92),
mainc9da0f93with the titles' import PRs (see #1578), #1911 and #1944, then the PRs and branches below merged locally in this order. Each row is where the titles stop after that step:AGC header pointer is outside the registered shader headerdisables seamless cube filteringunsupported SPI_PS_INPUT_ENA/ADDR bit combination (ena 0x80 addr 0x80)unsupported color depth, dimension, resource level or metadata modecolor samples, fragments or destination alpha override(0x31d = 0x00012000)shader metadata is outside the registered headerprepared shader artifact is missing for the requested static ABI ... stage=5(#1901)ready GL=4.6 (Core Profile) Mesa 26.2.0 ... 3840x2160, thenguest sampler descriptor uses an anisotropy overridelast provoking vertex with explicit per-vertex flat interpolation is unsupportedlast provoking vertex with explicit per-vertex flat interpolation is unsupportedSo on Windows #2063, #2066 and #2322 together get all four past the header check (#2063 and #2066 are merged now), #1819 moves three of them past
SPI_PS_INPUT_ENA, and #1902 gets VITA5 and the showcase past the null pixel program. The rest are branches I can't open upstream while intake is paused. Each passes the project's full CI on my fork, merged intomainc72d5ce1(Linux, macOS and Windows builds and tests; linked as CI):AlxcBTW:fix/agc-non-seamless-cube(CI): samplers withDISABLE_CUBE_WRAP(GL's default is non-seamless cube maps) are created withVK_SAMPLER_CREATE_NON_SEAMLESS_CUBE_MAP_BIT_EXT, the flag RADV maps to that bit; without the extension only a cube texture sampled through such a sampler throws.AlxcBTW:fix/agc-array-color-target(CI): 2D color targets with a nonzeroMIP0_DEPTH(CB_COLOR_ATTRIB3 = 0x4dc6c001; radeonsi writes the last layer there) are accepted, and the view slice is checked against it. The slice offset was already there.AlxcBTW:fix/windows-immediate-exit(CI): after its retirement fail-stop ps5-homebrew-ui calls_Exit, which on Windows still runs module detach routines;FlipQueue's destructor then joins its terminated thread forever._Exit/_exitnow end the process withTerminateProcess.AlxcBTW:fix/agc-compute-without-specials(CI): opengnm registers compute headers without specials and passes the wave size in the dispatch initiator, so registration read a null specials pointer. Such shaders are now prepared at dispatch with the initiator's wave size. It touches the same lines as #1902; I have the combination resolved.AlxcBTW:fix/agc-aniso-override(CI):ANISO_OVERRIDE(S# word 2 bit 29) disables anisotropy for single-level images (Mesa sets it from!aniso_single_level). The bit is now accepted. Only a single-level texture sampled through an anisotropic sampler with it still throws. Edit: this duplicates TheAggie's #1415, which I missed. #1415 is the more complete change, because it tracks which images each sampler is paired with, so please use that one.UI Lab's retirement timeout and VITA5's 20 s are the driver compiling one pixel shader. Its 21,652 bytes of RDNA code become 2.8 MB of SPIR-V, most of it the float-mode emulation around its 3,712 float operations. The showcase's last stop comes from flat inputs 1 and 2, which it reads with
v_interp_mov_f32P10 in last-provoking mode. That read is #1413's open question, so I left it alone. Both runs withoutAPS5_TRACE_GPUended with the title's ownsubmission retirement failedinstead, because the failed submission never retires. PPSA99006 renders into a 4-sample, 4-fragment color target (CB_COLOR0_ATTRIB0x12000), which is #419's area.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T06:25:00Z.
Closing: #2063 reads the user-data header without its tail padding, so
DecodeVertexStageInfono longer stops on this header, and #2066 accepts the unused geometry output register. The later stops in the table above are separate issues.