feat(agc): vertex clip and cull distances #423
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/423"
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-10-02T23:31:00Z.
What
Draws whose vertex stage exports clip or cull distances (PA_CL_VS_OUT_CNTL clip/cull enables and VS_OUT_CCDIST) were refused with
clip distances, layer, viewport or auxiliary vertex exports. The recompiler already turns the misc and clip/cull position exports intoClipDistance/CullDistanceoutputs fromShaderVertexStageInfo::paClVsOutCntl, but the driver never passed the register, so the field was always 0.decodeVertexInfopasses PA_CL_VS_OUT_CNTL's clip/cull enables and VS_OUT_MISC/CCDIST bits. They are part of the draw lookup key and the vertex-info comparison, the recompile cache key, and the serialized request (version 18; main is at 17).pos1..pos3export gets no bits at all (PositionExportLayout, cached per snapshot), so its artifact does not depend on PA_CL_VS_OUT_CNTL. That also covers johnmaia's0x01240000case, where only the misc-vector bit was set.State::paClVsOutCntlkeeps the value for the validator's messages and its cache key.ClipDistanceoutputs off32[1..8](they share one array with main's all-zero clip position distance from9db923e90, which takes the index after the guest's) and vertexCullDistanceoutputs off32[1..8], at most eight together. A clip or cull capability on a device withoutshaderClipDistance/shaderCullDistanceis refused with the PA_CL_VS_OUT_CNTL value in the message.shaderCullDistanceis enabled when available, next to main'sshaderClipDistance, andCullDistancejoins the device capabilities.In GTA V the reflections in glass and some glass textures were missing: their draws clip against a plane. tibzejoker's Story mode stop (
register 0x207 = 0x00400001, one clip distance) is this path.Tested
Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB DDR5-5600, MinGW-w64 GCC 15.2.0.
agc_driver_vertex_clip_cull_distances: device draws for each enable pattern (no bits, clip planes 0, 1 and 0x5, cull plane 0 with every vertex negative and with one not, sparse cull plane 0x4), checking which pixels are written.agc_driver_vertex_clip_cull_drawand..._no_key: the position export layout of a pos0-only program (no bits), a pos1 program (only the layout bits), cached and at a code offset; then the same draws through PM4 submission, with the draw key on and off (the cache then keys on the decoded vertex stage, which must include PA_CL_VS_OUT_CNTL). Both shut the driver down at exit (thanks @Scramblrrrr for the teardown crash).agc_driver_zero_position_vertexandagc_position_invariancestill pass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-03T06:28:33Z.
Heads-up on the request serialization: #303 (mine) also moves it from version 5 to 6, for
nonConstantImageOffsets. Git merges the two cleanly because the version lines are identical, but then a version 6 request written by a build with only one of them is misread by a build with both. Whichever of the two lands second should move to version 7. #426 currently has both fields under version 6.Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-03T08:35:26Z.
Thanks, good catch. #303 landed first, so this one moved to version 7: it writes 7, reads
paClVsOutCntlonly from version 7, and still reads #303's field from version 6. Rebased ontomainwith a round-trip test for the field.Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-06T15:39:16Z.
Rebased onto current
mainand the rebased #375 (now 7aa98bf2). One more fix on top: #752 took recompile request version 7 for the conservative Z export, which is the version this PR used forPA_CL_VS_OUT_CNTL. A version 7 request written bymainwould have been misread, so this PR now writes version 8 and readspaClVsOutCntlonly from version 8. The round-trip test still covers the field. Builds; the driver tests pass apart fromagc_driver_scalar_sop1, which fails without this PR too.Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-07T08:41:32Z.
Rebased onto current
main(now e6210b87).maintook request version 8 for the target export mapping in the meantime, which is the version this PR used forPA_CL_VS_OUT_CNTL. It merged without a textual conflict, but a version 8 request written bymainwould have been read as having the field, so this PR now writes version 9 and readspaClVsOutCntlonly from version 9; the serializer test checks the version 9 prefix and refuses 10. #375 and #295's commits are still included below it. Builds; the driver tests pass apart fromagc_driver_scalar_sop1(fixed by #928).Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-07T17:31:05Z.
Rebased onto current
mainand the rebased #375 (now 5c5b106d).mainnow uses request version 9 for the sRGB decode formats, which is the version this PR used forPA_CL_VS_OUT_CNTL. A new commit moves it to version 10, and the serialization test expects 10 for new requests and refuses 11. Note: #1182 (compute scratch) also takes version 10; whichever lands second moves to 11. Build and ctest pass.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T20:14:58Z.
Review: DISMISSED
Built this merged onto current
main: ctest passes (400/400). I also reverted each source file by itself to see which ones the new tests cover. The validator, state, serializer and cache-key changes are covered. The path that makes the feature work isn't: revertingDraw.cpp:139,DrawLookup.cpp:51,DrawRegisterKey.cpp:43,ShaderInputInfoBuilder.cpp:160orVulkanDevice.cpp:930still passes every test.ClipDistance/CullDistance(DecodePositionExportComponent) has never run in a test onmain, and this PR is what turns it on. Could you add an execution test along the lines oftests/execution/PixelHelperLanes.cpp? A vertex shader that exportspos0pluspos1, withVS_OUT_CCDIST0_VEC_ENAset and some clip and cull enables, would do. Use a triangle whose distances go negative across it, and check which pixels get written: one row for clip, one for cull, and one with a sparse mask likeCLIP_DIST_ENA = 0x5, so the compacted indexing is pinned too. Lavapipe supportsshaderClipDistance/shaderCullDistance, so this runs on Linux CI. Right now the GTA V result is the only evidence for the main change, and we can't reproduce it.ShaderValidation.cpp:222accepts theClipDistance/CullDistancecapabilities unconditionally.VulkanDevice.cpp:929-930only enables the features when they're available. On a device without them, the draw would build an invalid pipeline instead of being refused. Gate them the waygeometryShader/sampleRateShadingare gated for fragment stages, or push the capabilities intostate->capabilitieswhen they're enabled.paClVsOutCntlfrom version 9 (RequestSerializer.cpp:401,>= 9u) still passes the tests, so the version gate isn't pinned. A case that deserializes a version 9 vertex request (the field stays 0 and the fields after it are intact) would cover it.Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-08T16:13:29Z.
Thanks. Rebased onto main (the vertex field now reads from request version 13, since main is at 12) and addressed the points:
agc_driver_vertex_clip_cull_distanceshand-encodes a vertex shader that exports pos0 and pos1 withVS_OUT_CCDIST0_VEC_ENAand drives the device directly: no enables, clip plane 0, clip plane 1 alone,CLIP_DIST_ENA = 0x5(the compacted indexing), and two cull cases, checking which pixels are written.agc_driver_vertex_clip_cull_draw(and_no_key, withAPS5_NO_DRAW_KEY=1) submit the same through PM4, changing onlyPA_CL_VS_OUT_CNTLand the distances, so the draw decode and the draw cache are covered. I reverted each line you listed in turn:Draw.cpp,ShaderInputInfoBuilder.cppand the cull enable inVulkanDevice.cppfail the tests;DrawLookup.cppfails the_no_keyrun (the register key already covers it otherwise). ThesameVertexInfocomparison inDrawRegisterKey.cppis not reachable by a test, since the register key already includesPA_CL_VS_OUT_CNTL; I kept it as a guard, but can drop it if you prefer.ShaderValidationaccepts theClipDistance/CullDistancecapabilities only when the device enabled the features, and the refusal namesPA_CL_VS_OUT_CNTLwith its value.The bit-to-component mapping (enable bit s selects component s, the Vulkan index counted by the enabled bits below) follows the recompiler's existing position-export mapping, not hardware or documentation; it is listed under Unknown function info in TechnicalDebt.md.
Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-08T17:51:40Z.
@MichonGoddijn231849 The Windows job times out in
agc_driver_vertex_clip_cull_drawandagc_driver_vertex_clip_cull_draw_no_key(120 s each). Windows CI has no Vulkan device, so the other execution tests skip there in about 0.05 s. This one submits through the driver without checking for a device. WithVK_ICD_FILENAMES=/nonexistent.jsonon Linux it fails instead of skipping ("pixel (0, 0) is clear, expected written"), and on Windows it hangs.Probing the device the way the other execution tests do fixes both cases:
Locally, with no device both variants exit 77 (skipped). On RADV (RX 9070 XT) both still pass. #1077 is stacked on this PR and fails Windows for the same reason.
Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-08T18:44:29Z.
@MichonGoddijn231849 I rebased this PR onto
main6b56175alocally (as the base for #1077). The conflicts with #639 are small, but on Linux (RADV) both clip/cull draw tests fail in two separate ways. This comes on top of the missing device check I posted above.1. Registration: easy to fix in the test. Since #639,
AgcDriverRegisterShaderprepares the shader from the static registers in its header, so the test fails withmissing static shader ABI register 201(0xc9, the vertex program address). With the program, resource and stage registers in the header, astests/Submit.cppdoes now, registration succeeds:2. Draw: the prepared artifact misses. This one is a design question, not a test fix. With registration fixed, the first draw fails with:
The layout matches, so the miss comes from the static key. The driver sets
paClVsOutCntlfrom0x207at draw time (Execution/src/Driver/Draw/Draw.cpp).RecompileCacheKey::BuildInterfaceincludes it (CacheKey.hpp,append(key, value.paClVsOutCntl)), andBuildPreparedShaderKeybuilds on that. Registration never sets it, so its artifact is keyed with 0, and every draw that sets the clip/cull bits misses. Even the test's first step hasDistanceVector(bit 22) set. Also, one registered shader is drawn with four differentPA_CL_VS_OUT_CNTLvalues, so a single value read at registration wouldn't cover it either.#639 had the same problem with export component order, and moved it to runtime (
2a117a6e,fix(shader): apply fragment export mappings at runtime). The clip/cull enables probably need the same treatment, as a runtime input or a prepared variant per value, but that's your design call (and perhaps the maintainers'). #1077 adds the layer export to the same field, so it has the same problem and will follow whatever you choose here.Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-09T08:33:39Z.
@alfalfa-star thanks for both, and sorry #1077 is waiting on this. I'll take the device check and the static-ABI registers for the test as you posted them. On the design question: since #639 the clip/cull enables in
PA_CL_VS_OUT_CNTLend up in the prepared key, so every draw that sets them misses. I'll move them to runtime the way2a117a6edid for the export mappings: the vertex stage always declares the distance arrays and reads the enables from the shader data block, and a disabled distance writes a value that never clips or culls. Parked as a draft until that rework is in; I'll ping you when it's ready so #1077 can follow.Imported from boykopovar/AnyPS5. Originally posted by NahuelGenchi on 2026-10-09T16:39:02Z.
Tested merged onto the testing branch from #2021, which is current
mainplus open PRs:CMakeLists.txt,VulkanDevice.cpp,Context.hppandShaderValidation.cpp. Each was an addition next to one frommain, and I kept both.Sonic Origins (PPSA05324) issues 8 draws with
PA_CL_VS_OUT_CNTL= 0x00400001 (clip distance 0 through the CCDIST0 export) while it loads its title screen.prepared shader artifact is missing for the requested static ABI: ... stage=1 wave=64 pushOffset=0 pushCapacity=128 preparedLayouts= [0,128].f524bbedseparated artifact preparation from draws, so the vertex artifacts are probably prepared without thePA_CL_VS_OUT_CNTLbits, and the draw's key no longer finds one.On that base,
agc_driver_vertex_clip_cull_drawandagc_driver_vertex_clip_cull_draw_no_keyfail withAGC driver: missing static shader ABI register 201. The test writes 0x0c9 withSET_SH_REG, but the shader registry now reads it from the registered shader header.Imported from boykopovar/AnyPS5. Originally posted by johnmaia on 2026-10-09T17:49:40Z.
Tested this on top of current
mainwith Disney Epic Mickey: Rebrushed (PPSA15657, UE4) on Linux / RX 7600 (RADV). Without it, the game stops right after New Game withclip distances, layer, viewport or auxiliary vertex exports is unsupported (register 0x207 = 0x00400001). With it, the game gets past that draw. It needed two changes on top of the PR, though:1. Ahead-of-time preparation doesn't set
paClVsOutCntl. The draw path puts the masked 0x207 intoShaderVertexStageInfo::paClVsOutCntl, which is part of the prepared-shader key.PrepareRegisteredandPrepareGraphicsStages(Execution/src/Driver/Shaders/ShaderRegistry.cpp) decode the vertex info without it, so it stays 0. Every draw with any of those bits set then fails with:(Same layout, different key.) Here this happened before the title screen, on a draw with
PA_CL_VS_OUT_CNTL=0x01240000. Only the misc-vector bit survives the mask, and there are no clip distances at all. I fixed it by moving the mask to a shared constant inState.hpp(PositionExportLayoutBits) and setting it in both preparation paths: fromstate.context0x207 inPrepareRegistered, and fromdecoded.state.paClVsOutCntlinPrepareGraphicsStages. Commit: johnmaia/AnyPS5@b599cfc12. That still wasn't enough for this game. The failing program here seems to be one the driver builds itself; its code address is a host address, not a guest one. Nothing prepares it with the right register value. As a stopgap I let
PreparedAtUseprepare at draw whenrequest.context.vertex->paClVsOutCntl != 0, which is what it already does for unregistered compute shaders. With both changes the game goes title → menu → New Game → past the clip-distance draw, and on to the next unsupported feature (UINT16_ABGR color export, #1073). The stopgap is probably not the shape you'd want upstream. A cleaner option may be to leave these bits out of the key whenever the program doesn't write position exports beyondpos0, or to prepare that internal program with the draw's 0x207.The merge with current
mainconflicts inlibSceAgcDriver/CMakeLists.txt,VulkanDevice.cpp,Context.hppandShaderValidation.cpp. In all four, both sides add lines, so keeping both resolves it.Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-09T22:14:20Z.
Thanks @NahuelGenchi and @johnmaia, both reports point at the same gap, and it's the reason this PR is a draft. Since the prepared shaders (
f524bbed), vertex artifacts are prepared withoutPA_CL_VS_OUT_CNTL. A draw with any of those bits then misses its prepared artifact, and the clip/cull enables have to become an input to the preparation.@johnmaia your b599cfc1 is the right first half: a shared
PositionExportLayoutBitsmask, set in bothPrepareRegisteredandPrepareGraphicsStages. I'd like to take it into this PR with you as co-author when I bring the PR out of draft, if that's fine with you.For the driver-built program, I'd rather not prepare at draw time. Leaving the bits out of the key when the program writes no position export beyond
pos0looks cleaner, and it would also cover your0x01240000case.@NahuelGenchi the
missing static shader ABI register 201failures in the two clip/cull tests come from the same change: the registry now reads 0x0c9 from the registered header, not fromSET_SH_REG. The tests need to register it in the header.Imported from boykopovar/AnyPS5. Originally posted by TheAggie on 2026-10-10T17:25:24Z.
Tested with RetroArch's Dolphin core (homebrew RetroArch, PPSA99169) running the GameCube 240p Test Suite. On Windows 11, NVIDIA RTX 5070 Ti, MinGW-w64 GCC 15.2. Without this PR it stops as soon as the ISO boots:
With it, that draw goes through. Here it needed one more piece, which may be worth knowing about before the PR comes out of draft.
Mesh path. Dolphin's draws here run on the NGG path that becomes a mesh shader. With the PR, the next stop is in the recompiler:
DefineMeshOutputsonly takesPosition,ParameterandLayer. I added clip and cull distances there:f32[N]ClipDistance/CullDistanceoutput array with a private per-lane copy;EmitAuxPositionExportwrites the copy when the stage is mesh;EmitMeshEntryPointcopies each array out once;ShaderValidationaccepts the capabilities and thef32[1..8]built-in for mesh outputs.With that, the 240p Suite reaches its menu and renders it. It's slow (under 1 FPS); I haven't looked into why yet. If you'd like it, I can open it as a follow-up once this PR lands, or you can take it into this one. Either is fine with me.
Two smaller things from the merge:
agc_driver_vertex_clip_cull_draw(and_no_key) print their pass line and then crash at exit (0xC0000005). The device is destroyed during static destruction, and the NVIDIA driver jumps to a null pointer fromVulkanDevice::State::~State(). CallingLibcRunShutdown_nid_postfix()before returning, asPm4.cppdoes (and in thecatch), fixes it here. Lavapipe probably doesn't show it.mainalready writes serialization version 15 (14 and 15 added pixel fields), sopaClVsOutCntlneeds version 16 now. The serializer test that rewrites a request as the previous version then needs 15, not 12.Caveats:
main: this is my integration branch, amainfrom 2026-10-07 plus my open PRs and a few local spikes. The PR's five commits were cherry-picked onto it.prepared shader artifact is missingerror that @NahuelGenchi and @johnmaia hit. My branch carries #1732, which prepares programs at first use when they couldn't be prepared at registration. That probably covers the same gap, so this run doesn't say anything about that part.missing static shader ABI register 201test failure. My base predates that registry change.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-10T22:17:28Z.
@TheAggie thanks, that's very useful. The mesh-path clip and cull distances (outputs in
DefineMeshOutputs, the aux export for mesh stages, the entry-point copy and the validation) are best as your own follow-up PR on top of this one once it's out of draft and merged; it keeps this one small and credits you.Noted for when I take this out of draft:
LibcRunShutdown_nid_postfix()before returning (and in thecatch) in both clip/cull draw tests, and the request version moves to 16 (the previous-version serializer test to 15). It stays a draft for now: the clip/cull enables still have to become a runtime input on the prepared vertex artifacts (with @johnmaia's b599cfc1), as discussed above.Imported from boykopovar/AnyPS5. Originally posted by johnmaia on 2026-10-10T22:50:48Z.
@MichonGoddijn231849 Yes, please take b599cfc1 into this PR. Co-author credit is fine with me.
Agreed on not preparing at draw time. My 51734288 (
PreparedAtUsereturning true for a vertex program withpaClVsOutCntl != 0) was only a stopgap on my testing branch to get past the draw. Leaving the bits out of the key when the program has no position export beyondpos0is cleaner.Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T07:17:52Z.
Another title that needs this: Kena: Bridge of Spirits (PPSA01746, Unreal Engine) on Windows. With my current stack (current
main06da1176plus several fix branches, no audit gaps) it runs until the first draw that uses clip distances and then stops with:In
PA_CL_VS_OUT_CNTL(the field order from shadPS4'sVsOutputControl,regs_primitive.h) bit 0 is the first clip-distance enable and bit 22 isvs_out_ccdist0_enable. I tried to merge this PR into my test branch, but it has conflicts in ten files against currentmain, so I could not test it on Kena; it would need a rebase first. If a rebased version exists I can run Kena on it.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-11T07:59:37Z.
@johnmaia thanks, I'll take b599cfc1 in with you as co-author when this comes out of draft, keeping the bits out of the key when there is no position export beyond
pos0.@xXPBSXx thanks for the Kena data point (
0x00400001: clip distance 0 plusvs_out_ccdist0_enable). It is a draft until the clip/cull enables are a runtime input of the prepared vertex artifacts; I'll post here when a rebased, testable head is up.Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T15:45:20Z.
Decoding the Kena (PPSA01746) stop
clip distances, layer, viewport or auxiliary vertex exports is unsupported (register 0x207 = 0x00400001): register0x207isPA_CL_VS_OUT_CNTL(Linuxgc_10_1_0_offset.h,mmPA_CL_VS_OUT_CNTL 0x0207).0x00400001isCLIP_DIST_ENA_0(bit 0) plusVS_OUT_CCDIST0_VEC_ENA(bit 22) fromgc_10_1_0_sh_mask.h, so the title enables exactly one clip plane and the first clip/cull-distance vec4 export, nothing else. That is the case this PR implements, so I did not build a reduced copy of it onmain: a "bit 0 plus CCDIST0" subset would still need the VulkanshaderClipDistancefeature, a pipeline key, the SPIR-VClipDistanceoutput and the validation change, which is this PR's change. I merge-tested the PR againsta11c8f7f7: 10 files conflict (libSceAgcDriver/CMakeLists.txt,VulkanDevice.cpp,Context.hpp,Pipeline.hpp,Draw.cpp,ShaderValidation.cpp,tests/Graphics.cpp,tests/ShaderMemory.cpp,RequestSerializer.cpp,TechnicalDebt.md), so it needs a rebase by its author before Kena can be tried with it.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T18:28:44Z.
@MichonGoddijn231849 I merged this PR by hand onto
maina11c8f7f7(10 conflicting files) to test it on Kena and to show what a rebase needs. The result is on my fork as branchtest/pr423-on-main-a11c8f7f7(the merge commit plus one fix-up commit). It is a test merge, not a proposal to replace your branch.What the rebase needs (all four are in that branch):
RequestSerializer.cpp:mainalready uses serialization versions 13 to 16 for other fields, so thePA_CL_VS_OUT_CNTLword has to be version 17 (WriteU32(17u),version > 17u,if (version >= 17u) info.paClVsOutCntl = ...).ShaderMemory.cppfollows: new requests start withNVNQQREAAAA=, the unsupported pair becomes version 0 and 18 (NVNQQRIAAAA=), and the "legacy vertex info" test must strip the word from a version-16 request (legacy[4] = 16u), not 12.ValidateShaders/Inspect:mainappendedbufferInt64AtomicsaftersampleRateShading, soclipDistance,cullDistancecome after it; the PR'sGraphics.cpptest calls (6 of them) then need an extrafalseforbufferInt64Atomicsbefore the two distance flags.ShaderValidation.cpp: keepisDistanceCapability ||inisFeatureCapabilitynext to main's two new multisample capabilities (ImageMSArray,StorageImageMultisample). Without it every vertex shader with a ClipDistance capability fails withSPIR-V requires unsupported device capability 32.Context.hpp,VulkanDevice.cpp,libSceAgcDriver/CMakeLists.txt(keep both test blocks),TechnicalDebt.md: plain "keep both" resolutions.Tested (Windows, RTX 4080 SUPER driver, main
a11c8f7f7+ this PR):agc_shader_memory,agc_driver_graphics,agc_driver_vertex_clip_cull_distancespass.agc_driver_vertex_clip_cull_drawand..._no_keycrash with an access violation atrip 0insidelibSceAgcDriver.prx; I have not found why, and I do not know whether it also happens on your branch before the merge (I did not build that), so please check that one first.Kena (PPSA01746), 90 s: the title does not reach the clip-distance stop. It crashes with
0xc0000005(a write to address 0 atapp.exe+0x1c7a46b) right after asceSaveDataDirNameSearchcall that returned no hits. The same crash happens without this PR (it also occurred onmain+ #419 + #425), so I can not say anything about the clip-distance change on this title yet. I make no claim about that crash's cause.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T21:35:02Z.
Kena (PPSA01746) again, now with this PR merged onto current
mainc5da8233a(my fork's branchtest/pr423-on-c5da: the earlier hand merge plus a clean merge ofmain, no new conflicts),relinkerandlibsrebuilt, 120 s: no clip-distance stop. The title still ends with0xc0000005(write of address 0 atapp.exe+0x1c7a46b), the same crash as before, so this PR's clip-distance path is not reached. Whether that crash is something inmainor a missing piece I have not determined.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T22:09:19Z.
Kena (PPSA01746) on this PR merged onto
maina672688e9(plus #4021, which fixes the Windows build ofSocket.cppthat is broken onmainat the moment:HostPollis used on Windows but only defined under#ifndef _WIN32), 120 s: still no clip-distance stop. This run ends with0xc0000005too, but at a different place than before: a read of address 0 atapp.exe+0x57378d7onTaskGraphThreadHP 12. In both crashes (this one and the earlier write atapp.exe+0x1c7a46b) the last title-visible log line before the fault is a[SAVEDATA:native] dirNameSearch ... hit=0 set=0 -> 0x00000000; I only note the coincidence and do not claim it is the cause. The clip-distance path of this PR is not reached by this title in my runs.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-11T22:15:22Z.
@xXPBSXx thanks for the hand merge and the notes (serialization version 17, the
bufferInt64Atomicsargument order,isDistanceCapabilitynext to the multisample capabilities). They will save time when this comes out of draft. It stays parked for now: the clip and cull enables still have to become a runtime input instead of part of the request. Kena's0xc0000005atapp.exe+0x1c7a46bhappens before any clip-distance draw, so it is a separate stop.Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T23:00:47Z.
For the record, so this PR is not blamed for it: the Kena crash at
app.exe+0x1c7a46balso happens onmaina672688e9+ #4021 alone, without this PR; it is tracked in #4073.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-11T23:55:32Z.
GTA V (PPSA04264) reaches this path, unlike Kena. Windows 11, RTX 4090, MinGW GCC 15.2, Release.
On
main325e0a8bdplus #425, #290, #637, #4021 and a port of #448, Story mode stops about 30 s in with:With @xXPBSXx's hand merge of this PR (
test/pr423-on-c5da) merged on top, that stop is gone and the game runs on to the next, unrelated one (a depth array sampled from base slice 1, which is #1186). The only extra conflicts against my tree were argument lists shared with #448 (demoteToHelperInvocationnext toclipDistance, cullDistance) and both PRs taking request version 17 for their new field.So
0x00400001(one clip distance, bit 22 set) is a real case this PR covers. I did not compare the rendered output against hardware.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-12T05:09:53Z.
Preparing the existing #423 implementation for the Windows 007 stack after the post-licence register-0x207 stop. Public integration head a921b0c1d360a3c14e25ff0a7c3d23fcd7304b9b: https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-clip-cull-cross-test . Author-preserved carries of
52a1b69f3and the latest577b8d570device/driver tests, with runtime-table capability flags retained during conflict resolution.Our integration already uses serialized request version 16, including pixel alpha-to-coverage and float64 controls. A separate integration commit reserves version 17 for PA_CL_VS_OUT_CNTL and updates the legacy-vertex regression to version 16. This is a fork integration adaptation, not a proposed change to your upstream PR. Not tested/staged yet; build and native clip/cull, request-compatibility, graphics and BDA checks next.
The existing #4248 region-index sort is also in this prepared integration and its five selected native checks passed separately; no isolated title FPS claim for it.
AI-assisted: Codex. No title data uploaded.
Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-12T05:16:02Z.
Windows integration 188d80147ebb66f02fab8c18bcfb2cc2e296e513 passed 9/9 selected tests in 7.38 s, no skips: vertex_clip_cull_distances, vertex_clip_cull_draw (key on/off), shader_memory, graphics, bda_device, draw_cache_reuse (GPL on/off), gpu_buffer_format.
Both PM4 clip/cull modes initially passed their pixel assertions, then crashed during process teardown with a null Vulkan callback. Adding AgcDriverShutdown_nid_postfix on success and exception, as nearby driver fixtures do, makes both exit cleanly. The small fixture adaptation is in 188d80147. Request compatibility checks now cover our integration's version-16 vertex data without the new field and the version-17 format; versions 0 and 18 remain refused.
Staged only the graphics module (SHA256 82C5F896AF4DEB329A6937760AF5C8AAAED7C57726A98F576DA9C474D549E707) and started 007 on a new validated shader cache. Other staged libraries unchanged. Map on / draw cache off / quiet settings retained. The #4248 sorting change is also included, so this is an integration run, not an isolated FPS measurement. No claim of passing the game stop yet.
AI-assisted: Codex. No title data uploaded.
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T05:38:08Z.
Two connections that may be new for the author, from the thread: (1) @Scramblrrrr's note that both
vertex_clip_cull_drawmodes crashed at process teardown with a null Vulkan callback untilAgcDriverShutdown_nid_postfixis called matches the access violation atrip 0insidelibSceAgcDriver.prxthat I saw inagc_driver_vertex_clip_cull_drawand..._no_keywhen I merged this PR by hand ontoa11c8f7f7(my earlier comment): I did not check whether my crash happened before or after the pixel assertions, so I can not confirm it is the same one, but it is probably worth trying the shutdown call there too. (2) The review's remaining points are the ones listed in the review above (an execution test that draws with clip and cull distances and pins which pixels are written, gating theClipDistance/CullDistancecapabilities on the device features, and the serializer version forpaClVsOutCntl); on currentmainthe PR isCONFLICTING, and my hand merge (test/pr423-on-c5daon my fork) shows the serializer version has to move past the versionsmainalready uses.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-12T16:48:24Z.
Out of draft, rebuilt on main
82b1b2e7a. @tibzejoker's0x00400001stop in GTA V Story mode is the reason; thanks for checking it.What changed against main:
shaderClipDistanceand writes its own clip distance for an all-zero position (9db923e90). The guest clip distances share that array; the zero-position distance takes the index after them. The validator acceptsf32[1..8]for clip and cull, at most eight together, so this PR only addsshaderCullDistancenext to main's flag.agc_driver_vertex_clip_cull_drawand..._no_keycallAgcDriverShutdown_nid_postfixon success and on failure, as @Scramblrrrr found.@johnmaia: b599cfc1 is in, with you as co-author. Registration and draw-time preparation now set the same bits. On top of it, a program with no
pos1..pos3export in its code gets no bits at all, so its artifact no longer depends on PA_CL_VS_OUT_CNTL. That covers your0x01240000case. The enables stay part of the request for programs that do export distances: the recompiler sizes the output arrays from them. A main change since then also matters: a missing artifact is now prepared at use instead of failing.