feat(agc): accept conservative Z export in DB_SHADER_CONTROL #752
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/752"
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 Celegans12 on 2026-10-05T20:40:03Z.
What
A nonzero DB_SHADER_CONTROL.CONSERVATIVE_Z_EXPORT (bits 13-14) was rejected by
DecodeStateand the draw precheck (depth export, shader coverage or ordered fragment execution) and byDecodePixelStageInfo(AGC graphics: DB_SHADER_CONTROL.CONSERVATIVE_Z_EXPORT is unsupported).DecodeState/precheck mask and become the pixel stage fieldConservativeZExport: 0EXPORT_ANY_Z, 1EXPORT_LESS_THAN_Z, 2EXPORT_GREATER_THAN_Z, as in Mesa's GFX10.3 register database (enum, field). The reserved value 3 still throws.FragDepthdeclaresDepthLess(1) orDepthGreater(2) next toDepthReplacing, the inverse of RADV's mapping (radv_shader.c, spirv_to_nir.c). Without a Z export the depth is the interpolated Z, which keeps either promise, so nothing is declared.ValidateShadersaccepts both modes. Drawing a depth-exporting pixel shader still needs #375 (Z_EXPORT_ENABLE,SPI_SHADER_Z_FORMAT,FragDepth,DepthReplacing).37a91497897c68dd(all_shaders.xpps, 2 instances) hasDB_SHADER_CONTROL = 0x2021and ends withv_sub_f32 v0, v2, v0(0x08000102, v2 = POS_Z) andexp mrtz v0 done vm(0xf8001881 0x00000000).ValidateShadersline. #448 also adds a pixel field at the same places inCacheKey.hpp,ShaderStageInputInfo.hppandShaderInputInfoBuilder.cppand bumps the same serializer version lines. TheirState.cppandShaderInputState.cppedits merge cleanly.Tested
main681f83e5: configure-DBUILD_TESTING=ON, full build,--target libs,ctest:ctest --output-on-failure)conservativeZExportTestsinagc_driver_graphics: with a shader that exports POS_Z as MRTZ, DB_SHADER_CONTROL 0x21, 0x2021, 0x4021 and 0x2020 giveDepthReplacing, plusDepthLess, plusDepthGreater, and no depth mode, also after a serializer round trip, with distinct cache keys;DecodeStateand the precheck accept 0x2020 and 0x4020; 0x6021 throws;ValidateShadersacceptsDepthLessandDepthGreaterand still rejectsDepthUnchanged. Onmainit fails with theDecodePixelStageInfomessage above.DecodePixelStageInfo: only37a91497897c68ddchanges. It now decodes, and its SPIR-V gainsOpExecutionMode DepthLessand passesspirv-val. The other 10,503 give the same result and SPIR-V size. Not yet run in game.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-05T21:03:54Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cppL371core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cppL371core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cppL371core/shader/recompiler/CacheKey.hppL142core/shader/recompiler/ControlFlow/src/RequestSerializer.cppL680, L704core/shader/recompiler/Optimization/include/Optimization/ShaderStageInputInfo.hppL185core/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cppL139