fix(shader): cull rect-list patches with NaN positions during PPSA38500 loading #28070
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/28070"
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 lgqdaxia on 2026-11-28T11:21:08Z.
What
During PPSA38500 scene loading on Windows, eleven rectangle-list draws in one GPU submission reported invalid positions. Their vertex programs can export NaN in a clip-space position. Reporting a fault for the draw also loses valid rectangles in a mixed draw.
The generated tessellation control shader now discards a source rectangle containing a NaN in X, Y, Z or W by setting its tessellation levels to zero. Other rectangles in the draw still render. The draw snapshots the guest NaN conversion and retention settings before deferred work starts. A guest override keeps the finite-position diagnostic, as do infinite inputs and overflow in the reconstructed corner. AMD vertex shader guidance · Vulkan patch discard
Tested
Windows 11, NVIDIA GeForce RTX 3080 Laptop GPU, driver 621.14. The focused Vulkan test sends one ordinary rectangle and four rectangles marked on different position components in the same draw. It checks each corner, pixel coverage and whether any marked rectangle wrote color. Separate draws exercise infinity and the guest override.
With the upstream production code at
9f028066, the mixed draw failed the finite-position check. At45811190, the SPIR-V 1.3 and 1.4 cases each covered all 4096 expected pixels, and the four marked patches wrote no color. Infinity and a nondefault NaN mode retained their expected diagnostics. The Khronos validation layer was active in both runs and emitted no Vulkan validation or synchronization errors.In an offline Windows integration run on the same GPU, all eleven previously failing vertex/fragment shader combinations ran again on the same HDR target with default NaN settings. None reported the rectangle fault. The run reached an outdoor frame with dark foreground geometry and later stopped in guest CPU code. Gameplay remains unverified.
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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T11:38:39Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
458111908e6c537af99e04ba3360515d0d48d552using the prepared review artifacts and pinnedrepo_read.pyreader. No commands or tests were run; the Windows and Vulkan results in the description are author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The reported Windows 11 / RTX 3080 focused Vulkan test and integration run were not run during this review. All changed files listed in
manifest.jsonwere read:Draw.cpp,RectListCorner.cpp,PipelineSpecialization.hpp,RectListShaders.cpp, andrect-list-position-nan.md. No changed files were excluded by the manifest;files.jsonwas not available in the review folder.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-03T06:04:14Z.
Review: APPROVED
I read the diff at
458111908e. Windows 11, GCC 15.2, merged intomainatcf556db18c3together with other open PRs (so not an isolated build), withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1andVK_LAYER_KHRONOS_validationon an RTX 5080 (621.24) and a Radeon iGPU (26.11.2).agc_driver_rect_list_corner: pass on both GPUs. The loader log shows the layer inserted and no "was not found" line, and neither run has aVUID-orSYNC-HAZARDline.main's): fails on both GPUs: "rect-list requires finite nondegenerate axis-aligned positions with equal positive W".The macOS relinker job is red (2026-11-29). This PR doesn't touch the relinker and that job failed the same way on other such PRs around then, but I didn't read its log.
Not checked: PPSA38500 itself.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T20:37:57Z.
Review: COMMENTED
RectListCornerchecks NaN culling and the disabled specialization by editing the generated shader directly. Could a case also go through the driver draw path and change the guest NaN control register between two draws with the same shaders? That would verify that the draw captures the register, uses the right specialization when recorded later, and preserves the fault on the override path.Source review at
458111908e. The head trial-merges onto700fae9438. Paired Vulkan execution is pending.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T21:50:51Z.
Review: COMMENTED
The new driver-level test covers the register-capture gap from my earlier review. Both draws reuse the same shader and change the NaN override in the same PM4 submission. The test checks a culled first draw, a finite second draw and the required fault for the reversed override. The current head merges cleanly with
main9896c0a605. The paired rect-list tests and new queued-draw case are scheduled on lavapipe.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-03T22:18:08Z.
Review: APPROVED
Reviewed — looks good
The reviewed changes correctly cull NaN-position rect-list patches while retaining diagnostics for configured NaN handling and other invalid positions.
What I ran
Reviewed head
f41bf93c0cfda257f04eb02614dac6b15a38898cusingrepo_read.py catandrepo_read.py search; no compiler or tests were run. The shader cull and fallback diagnostic are visible in RectListShaders.cpp and the draw-time register snapshot in Draw.cpp.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not independently run the GPU tests or Windows integration scenario.
files.jsonlists no excluded files.To get this to a good state
Nothing is required.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.