build(recompiler): generate the shader cache version as a source file #4732
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4732"
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 fdfawef324 on 2026-10-12T19:59:42Z.
What
core/shader/recompiler/ShaderCacheVersion.cmakewrote the shader disk cache source version and theAPS5_*switch list into a generatedShaderCacheVersion.hppthatShaderDiskCache.cppincluded. The version hashes every recompiler source, so any content change undercore/shader/recompilerrewrote the header and recompiledShaderDiskCache.cppon top of the file actually edited.The script now generates
ShaderCacheVersion.cpp, which definesShaderDiskCache::Generated::SourceVersionandGenerated::RecompilerSwitches(astd::spanover the same sorted switch list), bothconstinit. They are declared in the newcore/shader/recompiler/ShaderCacheSourceVersion.hpp, whichShaderDiskCache.cppincludes. The generated directory is no longer an include directory. The new header has a different name from the old generated header, so in an existing build directory the staleShaderCacheVersion.hppsitting next to the generated.cppis never included.The hashed inputs are unchanged: the same manifest (recompiler sources,
HostThreadLocal.hpp, submodule commits, compiler, build type, architecture, flags), the same include and guard checks, and the same step that skips the write when the content is unchanged (with Ninja'srestat). So the version still changes exactly when it changed before.Tested
Windows Server 2025, RTX 3060, GCC 15.2 (winlibs), Ninja Release -O3. Branch rebased on
main682ef0c17.mainShaderCacheVersion.cmakeand this branch's script with the same arguments (taken frombuild.ninja) over this branch's tree. Both give0x7907101dc4d8c62eand the same 26 switches. A secondninjarun after the build has no work to do, so the value is stable on an unchanged tree.mainitself generates0xdce3a0ce03bf030a; the value differs only because this change edits hashed files, as any recompiler change does.core/shader/recompiler/IntermediateRepresentation/src/IrType.cpp, then ranninja -d explain -j 4 shader_recompiler_agc_driverwithCCACHE_DISABLE=1. Three runs onmain682ef0c17, then three runs on this branch, back to back. The machine was at 100% CPU from other builds during all six runs, so the absolute times are high; both sides saw the same load.main: the explain output marksShaderCacheVersion.hppandShaderDiskCache.cpp.objdirty, and both are rebuilt. Wall time 22.0 / 23.9 / 22.2 s.ShaderCacheVersion.cpp.objandIrType.cpp.objare compiled, andShaderDiskCache.cppdoes not appear in the explain output. Wall time 12.2 / 14.7 / 15.0 s.ctest -R "shader|recompiler" -j 4: all 26 tests pass, includingagc_shader_disk_cache,shader_cache_file_readand theagc_driver_prepared_shaders*tests. No test was added: this is a build-graph change, and the red-on-main evidence is theninja -d explainoutput above.extern constdeclarations with theirconstinitdefinitions.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T17:05:17Z.
Checked the generated
ShaderCacheVersion.cpp(version and the 26 switches are emitted,ShaderDiskCache.cpponly includes the static header), local build and the agc ctest scope pass on Linux GCC; merging once the full Build is green.