agc: agc_driver_front_face_all_bits writes a float fragment output to an R32_UINT color attachment (undefined in Vulkan; MoltenVK rejects the pipeline) #7703
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 jotitadev on 2026-10-19T01:29:06Z.
What happens
core/libs/prx/libSceAgcDriver/tests/execution/FrontFaceAllBits.cpp(added in8dbf06798) binds aVK_FORMAT_R32_UINTcolor target:The recompiler declares
out_mrt_0asuint4only for export mode 7 (SpirvEmitterHelpers.cpp,uintOutput); for mode 1 it isfloat4.ShaderValidation.cppaccepts that because the target'suintExportis false. The pipeline therefore writes a float output to an unsigned-integer attachment.The Khronos validation layer flags it on any driver:
On desktop drivers the raw bits usually land in the attachment, so the test passes there. On MoltenVK the Metal compiler rejects the pipeline:
Repro
Any host with the Vulkan SDK validation layer:
Possible fix
Make the test's state self-consistent, for example by exporting through mode 7 with
uintExportset (the path the packed and unsigned-integer targets already use), or by using anR32_SFLOATtarget and comparing bits. I did not check whether a real title can reach export mode 1 with an unsigned-integer target throughState.cpp(which maps a 32-bit UINT color buffer toR32_UINT); if it can, the same mismatch would apply to the driver, not only to the test.Environment
Apple M2 Max, macOS 27.2, x86-64 build under Rosetta 2, MoltenVK 1.4.2 (Vulkan SDK 1.4.363.0) and MoltenVK main with SPIRV-Cross #2704: same result with both. Tree: main
a373e85e5+ mugurcci/macos-series-2(91e4eccaf) + #6667 #6668 #6969 #7524 (needed to build on macOS; none touch this test or the recompiler output types).Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-19T01:52:56Z.
Follow-up: this is reachable from the driver, not only from the test. On
main(324e0e48e),State.cpponly checks export mode 7 against the target type and setsuintExport = slotExport == 7, so a title can export mode 1 to a 32-bit uint color buffer, which becomesR32_UINT.SpirvEmitterHelpers.cppdeclares an integer output only for mode 7, andShaderValidation.cppaccepts the float output becauseuintExportis false.#6235 (firesand) fixes exactly this: raw32 exports (modes 1/2/3/9) to UINT/SINT attachments get an integer output of the attachment's type, and it updates
FrontFaceAllBits.cppaccordingly. It currently conflicts withmain; once rebased I can run it on MoltenVK, where Metal rejects the pipeline today.Written with AI assistance (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T07:49:29Z.
The test-side mismatch described here is already corrected on current
mainbyca76e540db(test(agc): export the front-face bits through a uint target as uint):FrontFaceAllBits.cppnow uses export mode 7 and setsuintExport = truefor itsR32_UINTtarget.The broader production case—raw32 fragment exports targeting UINT/SINT attachments—is covered by the open PR #6235. I found no distinct remaining change to submit for this report, so I have not opened a duplicate PR. Leaving the issue open pending the production fix.