agc_driver_prepared_shaders fails on GPUs without VK_EXT_depth_range_unrestricted (Intel on Windows); fix branch ready #3207
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 Silverash-i8 on 2026-10-11T01:12:24Z.
agc_driver_prepared_shadersand its_indirect,_uncachedand_debugruns fail on a GPU withoutVK_EXT_depth_range_unrestricted. Intel GPUs on Windows don't have it, so all four fail here onmain06da1176with:Why.
SharedCodeHeaders(added infb45627b, "retain registered headers sharing shader code") draws on the initial context.InitialContextRegisterssets the viewport Z scale to 1.0 and offset to 0, andPA_CL_CLIP_CNTL(0x204) hasDX_CLIP_SPACE_DEFclear, soState.cpptakes the [-1, 1] clip space and asks for a viewport depth ofzo - zstozo + zs, which is [-1, 1]. I checked the values with a temporary print inValidateViewport:min=-1.000000 max=1.000000. NVIDIA has the extension, so it passes there.The draw isn't about depth at all, and the other draw tests already set the D3D clip space (for example
DrawCacheReuse.cppwrites{0x204, 0x80000}), so the fix is one register write in the test:fix/prepared-shaders-test-depth-range, commit3c3bcf8f: theSharedCodeHeaderscommand stream also writes0x204 = 0x80000, which gives the draw a [0, 1] depth range.Tested on Windows 11, WinLibs GCC 15.2.0 r7, Release, on
main06da1176: all sevenagc_driver_prepared_shaders*tests pass on the Arrow Lake iGPU (ANYPS5_GPU=Intel, 4 of them failed before) and on an RTX 5060 Laptop.tools/check_conventions.py --base upstream/mainpasses. The driver's check itself is unchanged; a title that really asks for depth outside [0, 1] still gets the error on such a device.AI-assisted (Claude Code); I ran everything above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-11T01:59:09Z.
The one-register fix looks right, and the mechanism checks out against the driver's own decode.
I can confirm the chain statically — the limits of that are at the end.
ValidateViewport,Pipeline.cpp:111—Require(context.depthRangeUnrestricted || (minDepth/maxDepth within [0, 1]), "viewport depth outside [0, 1] requires VK_EXT_depth_range_unrestricted").State.cpp:612—result.negativeOneToOne = (read(cx, 0x204) & 0x80000u) == 0;State.cpp:688—const auto minDepth = result.negativeOneToOne ? zo - zs : zo;. Bit clear givesminDepth = zo - zs, i.e. [-1, 1]; writing0x80000givesminDepth = zo, inside [0, 1]. So the assertion passes because the depth range genuinely changed, not because a check was skipped.It is also the smallest fix that could work, and it is test-only — one line in
tests/execution/PreparedShaders.cpp, no driver change, so no emulated behaviour moves.The convention is already in the tree. Apart from the initial context's default (
{0x204, 0}inInitialContextRegisters) andState.cpp's decode, no driver code writes0x204— the register keeps its zero reset for tests that never set it, so such a context decodesnegativeOneToOne = true; and the base registers intests/Graphics.cpp:57({0x206, 0x43f}, {0x204, 0x80000}, {0x205, 0x240}) are the established way a test opts into the D3D clip space. (I could not check theDrawCacheReuse.cppexample from here — that file contains no0x204in the tree I have, which is a frontier branch rather than06da1176.)One thing worth deciding before this is carried, because it changes where the line belongs: is the initial context faithful to the console? Since the initial context sets
PA_CL_CLIP_CNTLto zero ({0x204, 0},QueueState.hpp:145), every test that draws on the initial context starts in [-1, 1] and needs either the extension or a clip-control write, andPipeline.cpp:190asks forVK_EXT_depth_clip_controlon the same flag, so such a draw needs two extensions it may not have. If the console's reset value really has that bit clear, this fix is exactly right and the test was simply missing a register write. If the console resets with the bit set, one line inInitialContextRegisterswould be the faithful fix and would cover every test that draws on the initial context at once.What I could not verify here, so the runtime evidence stays yours: lavapipe on this machine exposes
VK_EXT_depth_range_unrestricted, so the failure cannot be provoked on it, and this tree predatesfb45627b— itsPreparedShaders.cpphas noSharedCodeHeadersat all — so I cannot run the test either way. Seven green on the Arrow Lake iGPU is the part only your machine shows.Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-11T02:18:09Z.
@Dextroid17 thanks for checking the chain against the decode.
On
DrawCacheReuse.cpp: it's onmainnow.tests/execution/DrawCacheReuse.cpp:61has{0x206, 0x43f}, {0x204, 0x80000}, {0x205, 0x240}on currentmain(it came in withbddcc71e, #2980), so your tree just predates it.tests/Graphics.cpphas the same convention, as you found (line 56 on currentmain).On the reset value, I looked for anything that says the console resets
PA_CL_CLIP_CNTLwithDX_CLIP_SPACE_DEFset, and found nothing:InitialContextRegistershas{0x204, 0}.ClipControl::dx_clip_space = false(hardwareContext.h), and only aPA_CL_CLIP_CNTLwrite changes it.libSceAgchere writes 0x204 as a default.So both emulators assume the bit is clear at reset, but neither is a hardware measurement, and I don't have one. Given that, I'd keep the fix in the test: it doesn't depend on the answer, and changing
InitialContextRegisterswould move every draw that never sets the register from [-1, 1] to [0, 1] on a guess. If someone measures the console's reset value and it turns out to be set, that one line would be the better fix and this test line becomes redundant.AI-assisted (Claude Code); I checked the files above on current
mainand in KytyPS5.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T04:34:15Z.
Opened PR #3269, carrying Abdulrahman Elkordy's one-line test setup correction with the original commit author preserved. It sets
PA_CL_CLIP_CNTL.DX_CLIP_SPACE_DEFfor theSharedCodeHeadersdraw, so the test uses the supported [0, 1] depth range without changing driver behavior.On current
main, Linux GCC 12.2 Release buildsagc_driver_prepared_shaders_tests, and all seven prepared-shader CTests pass on llvmpipe. The original author also reports all seven cases passing on Windows 11 with an Arrow Lake iGPU and RTX 5060; that run used the offered branch based on06da1176, and this test file has no intervening changes through currentmain. The PR states that the local llvmpipe device hasdepthRangeUnrestricted=1, so it does not reproduce the unsupported-extension failure.All applicable automatic PR checks pass, including conventions, intake, register-context, write-watch and Linux/Windows/macOS relinker checks. The full Linux and Windows build jobs are skipped under the repository's manual-run policy.
AI-assisted: yes.