AGC: draws with different front and back depth bias are rejected #1923
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 fisherjoey on 2026-10-09T00:07:06Z.
Summary
decodeDepthBias(core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp:250onmainf1451396) throwsdepth bias differing between front and back faceswhen a draw rasterizes both faces (no culling in PA_SU_SC_MODE_CNTL) and the front and back bias differ: the enable bits 11/12, or PA_SU_POLY_OFFSET_FRONT_SCALE/OFFSET (0x2e0/0x2e1) against BACK_SCALE/OFFSET (0x2e2/0x2e3). The draw is skipped, and after the first time it is skipped at precheck.Vulkan has one depth bias per draw, and the pipeline (
Pipeline.cpp:215) bakes in the cull mode. When one face is culled, the decoder already takes the other face's values, so only the no-culling case is missing.Impact on Demon's Souls (PPSA01341 v1.07)
The tutorial level's shadow casters use this state:
PA_SU_SC_MODE_CNTL0x01001a48 (no culling, both offsets enabled), front slope -17.6 against back slope -480000, constant -30000 on both. Depth only (CB0 = COLOR_INVALID), into the shadow depth at 0x2a4700000. About 4.3k draws per 10 s are skipped ([gpu] skipped draw again: ... depth bias differing between front and back faces). #1086 (0x2df) and #1346 (format-0 colour slots) took care of the other rejections of these shadow draws, so this is the one left.Fix
Branch: https://github.com/fisherjoey/AnyPS5/tree/fix/depth-bias-per-face
DecodeStatekeeps the front values indepthBias*and puts the back values in the newbackDepthBias*withdepthBiasPerFaceset. A face that has its enable bit clear gets bias 0.Pipelinebuilds a secondVkPipelinefor such a state. The first culls back faces and the second culls front faces.Drawrecords the draw once with each, setting the matching bias through the dynamic depth bias state. Descriptor sets and push constants stay bound, because both pipelines share one layout.APS5_REJECT_PER_FACE_DEPTH_BIAS=1brings back the old rejection.Tests:
agc_driver_graphicsdecodes the per-face cases (fails onmain, where the decode throws), and the new GPU testagc_driver_depth_bias_per_facedraws a front-facing and a back-facing triangle with opposite biases against a depth test, and only one of them may pass. A build that draws both faces with the front bias fails it.Found on Linux 7.2 (Nobara 44), GCC 16, RTX 5070 Ti (595.91.07).
AI-assisted: yes.