fix(agc): accept PA_CL_CLIP_CNTL UCP_CULL_ONLY_ENA without active clip planes #26578
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/26578"
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 birdmarty on 2026-11-24T05:54:12Z.
What
PA_CL_CLIP_CNTL(0x204/ MMIO0x28810) bit 17 isUCP_CULL_ONLY_ENA(cull primitives against enabled user clip planes without clipping them, per AMD PALgfx9_plus_merged_registers.hand Mesagfx103.json).DecodeStateandDrawRejectionpreviously rejected bit 17 unconditionally throughClipControlMask, even when no user clip plane (UCP_ENA_0..5, bits 0..5, still rejected) and no vertex clip distance (PA_CL_VS_OUT_CNTLCLIP_DIST_ENA_0..7, bits 0..7) is enabled.When neither
UCP_ENA_0..5norPA_CL_VS_OUT_CNTLCLIP_DIST_ENA_0..7is set, there are no active clip planes forUCP_CULL_ONLY_ENAto act on, so it leaves pipeline state unchanged. Draws that setUCP_CULL_ONLY_ENAalongside anyUCP_ENA_0..5bit or anyPA_CL_VS_OUT_CNTLCLIP_DIST_ENA_0..7bit still throw, since whether bit 17 also affects shader clip distances on the console is unverified.Changes
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp: addclipControlMask(const Registers& cx)that clearsUCP_CULL_ONLY_ENA(bit 17) fromClipControlMaskwhenPA_CL_VS_OUT_CNTL(0x207) hasCLIP_DIST_ENA_0..7(bits 0..7) clear, and use it in bothDecodeStateandDrawRejection.core/libs/prx/libSceAgcDriver/tests/Graphics.cpp: verify bit 17 decodes cleanly without altering clip space, depth clamping or depth range when no clip distances are enabled (including with cull distances only), and still fails bothDecodeStateandDrawRejectionwhen anyCLIP_DIST_ENA_0..7orUCP_ENA_0..5bit is set.docs/dev/debt/changes/fix-agc-ucp-cull-only-without-clip-planes.md: update thePA_CL_CLIP_CNTLdebt entry indocs/dev/debt/libSceAgcDriver.mdto recordUCP_CULL_ONLY_ENAand the unverified interaction with shader clip distances.Tested
Windows 11 Pro (build 26300), Intel Core i9-9900K, AMD Radeon RX 6800 (AMD driver 26.10.1, Windows driver 32.0.21045.16010, Vulkan 1.4.315), MinGW-w64 GCC 15.3.0, Release,
main441fa65119.Focused set (
agc_driver_graphics,agc_driver_unused_viewport_depth,agc_driver_depth_range_remap_draw,agc_driver_vertex_clip_cull_distances,agc_driver_vertex_clip_cull_draw,agc_driver_vertex_clip_cull_draw_no_key,agc_driver_viewport_index,agc_depth_range_remap,agc_driver_tessellation_depth_range_remap,agc_mesh_cull_store) withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(1.4.363.0) andVK_LOADER_DEBUG=layer:main441fa65119VUID-linesWithout the fix (
origin/main'sState.cppwith this branch'sGraphics.cpp),agc_driver_graphicsfails witha PA_CL_CLIP_CNTL flag is unsupported (register 0x204 = 0x000a0000).Kingdom Come: Deliverance II (
PPSA21704,01.052.000):PA_CL_CLIP_CNTL = 0x000a0000(DX_CLIP_SPACE_DEF | UCP_CULL_ONLY_ENA),PA_CL_VS_OUT_CNTL = 0x00000000, and allPA_CL_UCP_0..5zero.e60b2f74adwitha PA_CL_CLIP_CNTL flag is unsupported (register 0x204 = 0x000a0000)(reproduced twice).e60b2f74ad(bb0acb0514, no diagnostics) passes the stop cleanly in 5 consecutive runs with 0 errors: boots through the CryEngine/Bink/FMOD splash, EULA, Graphics Mode selection (Performance 2560x1440), Main Menu (~44–60 FPS), New Game (Standard Mode), and into the real-time 3D opening Siege of Suchdol cutscene (~6–11 FPS, verified by GPU frame dumps).py -3 tools/check_conventions.py --base origin/mainandpy -3 tools/debt_fold.py --checkpass.py -3 tools/pr_overlap.py --branch fix/agc-ucp-cull-only-without-clip-planes(2,595 open PRs): all 53 mergeable PRs that share files merge cleanly with no overlap; all 13 conflicting PRs touchingState.cpp(#1395, #6188, #6235, #7256, #9895, #11551, #11825, #20845, #23252, #23258, #23281, #24049, #26046) were searched by hand and none touchesClipControlMaskorUCP_CULL_ONLY_ENA.Not tested: whether
UCP_CULL_ONLY_ENAaffectsPA_CL_VS_OUT_CNTLCLIP_DIST_ENA_0..7on console hardware (those draws still throw), other GPUs, Linux.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)mainand this change, 0 VUIDs