Orion pso caching

From OrionUE/Orion_FreeEdition · View interactive version

Orion pso caching is an AI agent skill from the GitHub repository OrionUE/Orion_FreeEdition. Use when packaging, collecting, converting, validating, or troubleshooting Unreal Engine 5.8 PSO shader caches in this Orion project workflow: PSO Precaching, bundled PSO caches, ShaderPipelineCache, PSOPrecache, CollectedPSOs, PipelineCaches, ShaderStableInfo .shk files, .rec.upipelinecache recordi

How to use this skill

Skill file

Orion PSO Caching

本 Skill 用于执行 Unreal Engine 5.8 Windows PSO 全流程:确认配置、Cook 后复制 .shk、按全量/增量/指定地图范围启动打包版游戏记录 .rec.upipelinecache、转换 .spc、注入 Build/<Platform>/PipelineCaches,或在 UE 5.8 .spc 读回崩溃时生成 direct stable .stable.upipelinecache,再重新打包并验证日志。

工作流

  1. 先判断用户意图:只解释 PSO、配置 PSO、收集 PSO、转换 .spc、打包验证,还是“打包并收集着色器”全流程。
  2. 用户触发“收集 PSO / 打包并收集着色器”但没有指定范围时,先让用户选择:全量全部地图(耗时长)、增量只收集缺失/过期地图、或指定地图名称/路径。用户已经说“全部/全量”则用 -CollectionMode All;说“增量/改动/最新”则用 -CollectionMode Incremental;给出地图名或路径则用 -CollectionMode Maps -Maps <MapNameOrPath>。
  3. 修改配置或脚本前读取 ../orion-code-style/SKILL.md;需要机械 CRLF 修复时配合 ../crlf-mechanical-formatting/SKILL.md。
  4. 查当前项目真实配置:Config/<Platform>/<Platform>Engine.ini 的 NeedsShaderStableKeys、r.PSOPrecaching、r.ShaderPipelineCache.*,以及 Config/DefaultGame.ini 的 bShareMaterialShaderCode / bSharedMaterialNativeLibraries。
  5. Cook/package 后复制 Saved/Cooked/<Platform>/<ProjectName>/Metadata/PipelineCaches/ShaderStableInfo-*.shk 到 CollectedPSOs。
  6. 用 scripts/Collect-PSOs-Windows.ps1 发现 .umap、按收集范围和画质档启动 packaged game、传入 -clearPSODriverCache -logPSO -NoLoadingScreen -OrionPSOCapture,由游戏内 UOrionPSOCaptureSubsystem 生成第三视角巡航相机穿越场景;不要依赖外部 WASD、鼠标或输入法状态做正式收集。脚本只写 -abslog 文件日志,不传 -log 弹出命令窗口;每次游戏退出或超时后必须清理本次启动的进程树。
  7. 用 scripts/Cmd_ConvertPSOs_5.8.bat 或 scripts/Convert-PSOs-5.8.ps1 把 CollectedPSOs/*.rec.upipelinecache 和 CollectedPSOs/*.shk 转成 PSO_<ProjectName>_<ShaderFormat>.spc;-CopyToBuild 会先执行 ShaderPipelineCacheTools build 读回验证,通过后才移动到 Build/<Platform>/PipelineCaches。不要在 CollectedPSOs 和 Build/<Platform>/PipelineCaches 同时保留同一份 .spc。
  8. 如果 .spc 读回验证崩在 PipelineFileCache.cpp 或 PipelineCacheUtilities.cpp,不要改用 .stablepc.csv.compressed 作为正式格式;先移出 Build/<Platform>/PipelineCaches 的 .spc/.stablepc*,再用 scripts/Build-DirectStablePSO-5.8.ps1 -CleanBuildPipelineCaches 直接写 Content/PipelineCaches/<Platform>/<ProjectName>_<ShaderFormat>.stable.upipelinecache。此路径要求 r.ShaderPipelineCacheTools.IncludeComputePSODuringCook=0,避免 Cook 删除 direct stable 输出;同时要求 Config/DefaultGame.ini 显式配置 +DirectoriesToAlwaysStageAsUFS=(Path="PipelineCaches"),保证该非资产文件进入包。
  1. 用户要求“生成空 .spc 再试”时,用 scripts/New-EmptyPSOStableCache-5.8.ps1 生成 66 字节 UE 5.8 空稳定缓存并备份原 .spc。空 .spc 只用于诊断:UE 能读到 Loaded 0 stable PSOs 时说明不是 .spc 头格式本身崩溃;Cook 仍可能因 0 PSO 返回失败,不能代表 PSO 已完成打包。
  2. 重新 cook/package;.spc 正常路径检查 UAT 日志是否运行 UShaderPipelineCacheToolsCommandlet、加载 .shk / .spc、写出 stable .upipelinecache;direct stable 路径则确认日志没有再从 Build/<Platform>/PipelineCaches 读取 .spc/.stablepc*,并确认 UFS manifest 包含 Content/PipelineCaches/<Platform>/*.stable.upipelinecache,且最终 BUILD SUCCESSFUL。
  3. 用 packaged game 加 -clearPSODriverCache -trace=default 或日志关键字验证:包内 cache 已打开、新 PSO 数量显著下降、启动 shader 编译 UI 能根据 NumPrecompilesRemaining() 完成。
  4. 排查“进入关卡后异常退出、返回桌面或崩溃,下次启动又像全量编译着色器”时,先区分 LogShaderCompilers 的真正 shader 编译和 FShaderPipelineCache::NumPrecompilesRemaining() 驱动的启动 PSO UI。UE 5.8 Windows 没有内建“此 bundled PSO cache 已完成预编译”的完成标记,项目侧应把当前 stable cache 指纹写到用户配置,并在 -clearPSODriverCache、-deleteuserpsocache、-logPSO 下忽略该标记强制验证。

路由

References

Scripts

验证

完成 Skill 或脚本修改后运行:

python -X utf8 <SkillCreatorRoot>\scripts\quick_validate.py .agents\skills\orion-pso-caching
powershell -NoProfile -ExecutionPolicy Bypass -File .agents\skills\orion-framework-skill-authoring\scripts\check-skill-portability.ps1 -Path .agents\skills\orion-pso-caching -CheckCRLF -RequireRouting
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.