perf(shader): hash only the recompiler's inputs into the shader cache version #457
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/457"
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 oneandonlydean on 2026-10-03T13:52:04Z.
What
The shader disk cache version (
SourceVersion) hashes everylibSceAgcDriversource as well as the recompiler, so any driver-only change makes every cached shader stale and the next run recompiles all of them. Of the last 200 merges onmain, 88 changed that version; with the inputs below, 51 would have.The version now covers what can change a recompile result:
core/shader/recompiler/**(sources, headers, CMake files), as before;prx/libc/include/HostThreadLocal.hpp, the one header the recompiler includes from outside its directory (checked against the ninja dependency files);ANYPS5_ENABLE_SPIRV_TOOLSis on. The submodules' git HEAD files are dependencies of the version step, so moving a submodule regenerates the version;Everything else the driver hands to the recompiler arrives in the
RecompileRequest, which the per-entry key already covers. Two build-time checks keep it that way and fail the version step with a message naming the file and what to do:ShaderRecompilername that is not on the reviewed list (the 16 names the driver uses today), brings the whole namespace in, or sets an environment variable (which could flip a recompilerAPS5_*switch behind the key).APS5_*switches are collected from every hashed source, as before. The version script now starts withcmake_minimum_required: without it, CMake 3.x runs it with CMP0054 OLD and reads the quoted section names in itsif()tests as variables, so the version silently missed the recompiler sources.Tested
BUILD_TESTING=ONandctestpass (145/145), includingagc_shader_disk_cache.ShaderRecompiler::SomethingNew(...)inDraw.cpp, and an include ofGraphics/include/Draw.hppfromRecompiler.cpp, each fail the build with their message.ShaderRecompilercall, asetenvin the driver or a recompiler include from outside its tree. With #316 (adriadam10, subgroup size) merged in, the version step passes: its device-dependent subgroup size reaches the recompiler throughRecompileRequest::target, which the key covers.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)