vault backup: 2025-10-27 15:39:38
This commit is contained in:
@@ -1,30 +1,43 @@
|
||||
---
|
||||
title: PSO Precache机制笔记
|
||||
date: 2025-02-08 20:42:16
|
||||
excerpt:
|
||||
tags:
|
||||
excerpt:
|
||||
tags:
|
||||
- Precache
|
||||
- BundledPSO
|
||||
- PSO
|
||||
rating: ⭐
|
||||
---
|
||||
# 前言
|
||||
- 官方文档
|
||||
- [Creating a Bundled PSO Cache](https://dev.epicgames.com/documentation/zh-cn/unreal-engine/manually-creating-bundled-pso-caches-in-unreal-engine)
|
||||
- 视频
|
||||
- [Unreal Engine 5: Setup Precompiling Shaders (Bundled PSO's)](https://www.youtube.com/watch?v=NVoXDgXKS5k)
|
||||
- [Unreal Engine 5 fixing shader stuttering](https://youtu.be/ibIFKEYyBYo?si=OfM_2QSHxtE6oqsf)
|
||||
- [Unreal Engine 5: Show Number Of Compiling Shaders](https://www.youtube.com/watch?v=8h1k2ViADgU)
|
||||
- 文章
|
||||
- [UE5.3] PSO Cache&PreCache 源码阅读:https://zhuanlan.zhihu.com/p/679832250
|
||||
- [UE5.3] PSO Cache&PreCache 源码阅读(二):https://zhuanlan.zhihu.com/p/681803986
|
||||
- Unreal Engine 5.2 MeshPass拓展:https://zhuanlan.zhihu.com/p/671423486
|
||||
- 渲染管线相关
|
||||
- [UE5.3] PSO Cache&PreCache 源码阅读:https://zhuanlan.zhihu.com/p/679832250
|
||||
- [UE5.3] PSO Cache&PreCache 源码阅读(二):https://zhuanlan.zhihu.com/p/681803986
|
||||
- Unreal Engine 5.2 MeshPass拓展:https://zhuanlan.zhihu.com/p/671423486
|
||||
- 优化UE5的PSO卡顿:FileCache,PreCache和异步PSO https://zhuanlan.zhihu.com/p/1898646962561094034
|
||||
- 移动端BundledPSO
|
||||
- [***UE PSO Cache机制、使用与优化***](https://zhuanlan.zhihu.com/p/681319390)
|
||||
- [***Unity6 + UE5.4 PSO缓存实践记录***](https://zhuanlan.zhihu.com/p/714231961)
|
||||
- 这些数据终究还是表明Precache系统做不到100%的PSO覆盖率,实际我们还是要结合Bundle PSO来使用,在接下来的古代山谷项目里,我们会尝试使用二者结合的工作流
|
||||
- [UE4.27 PSO Caching](https://zhuanlan.zhihu.com/p/700765767)
|
||||
|
||||
|
||||
# BundledPSO
|
||||
- 相关启动参数
|
||||
- -logPSO
|
||||
- -clearPSODriverCache
|
||||
- 需要添加的配置
|
||||
- 需要添加的配置(可加子啊`DefaultEngine.ini`或者`(Platform)Engine.ini`中,推荐后者,不同平台需要不同的收集)
|
||||
- RendererSettings
|
||||
- r.ShaderPipelineCache.Enable=1
|
||||
- r.ShaderPipelineCache.ExcludePrecachePSO=1:用于确保Bundle PSO不会收集PreCache已经收集过的PSO。
|
||||
- DevOptions.Shaders
|
||||
- NeedsSHaderStableKeys=true
|
||||
- NeedsShaderStableKeys=true
|
||||
- /Script/UnrealEd.ProjectPackagingSettings
|
||||
- bShareMaterialShaderCode=True
|
||||
- bSharedMaterialNativeLibraries=True
|
||||
@@ -33,7 +46,7 @@ PS.
|
||||
1. 可以使用UnitGraph查看CPU来判断是否有PSO正在编译。
|
||||
2. 理论上需要对所有伸缩性进行跑测来收集PSO。
|
||||
## 大致步骤
|
||||
1. 可选:使用快捷方式 -clearPSODriverCache,清空PSO。
|
||||
1. 可选:使用快捷方式 -clearPSODriverCache,清空PSO。确保`(Project)/Build/(Platform)/PipelineCaches`文件夹是空的或根本不存在
|
||||
2. 添加上述配置。
|
||||
3. 执行Launch打包并且启动项目。
|
||||
4. 收集打包PSO:完成后可以在Saved/Metadata/PipelineCaches/找到打包的PSO文件,将其复制出来。
|
||||
@@ -55,7 +68,11 @@ cmd /k #保证CMD开启
|
||||
```bash
|
||||
"D:\UnrealEngine\UE_5.6\Engine\Binaries\Win64\UnrealEditor-Cmd.exe" -run=ShaderPipelineCacheTools expand "D:\Project\Demo\PSOCollection\*.rec.upipelinecache" "D:\Project\Demo\PSOCollection\*.shk" "D:\Project\Demo\PSOCollection\PSO_Demo_PCD3D_SM6.spc"
|
||||
```
|
||||
# 执行链
|
||||
|
||||
# 计算Shader编译进度
|
||||
UE5.6之后提供了UKismetRenderingLibrary::NumPrecompilingPSOsRemaining(),使用计时器来获取进度。
|
||||
|
||||
# PSO执行链
|
||||
- FGraphEventArray UPrimitiveComponent::PrecachePSOs()
|
||||
- void UMaterialInterface::InitDefaultMaterials()
|
||||
- UMaterial::PrecachePSOs
|
||||
Reference in New Issue
Block a user