CryEngine3 可以使用GPA RenderDoc NSight等工具进行Shader调试,前提是要开启CryEngine的Shader调试模式具体方法如下:
1. 开启Shader编辑模式:
在System.cfg 或Editor.cfg 添加如下变量参数:
sys_PakPriority = 0
r_reloadshaders = 1
r_ShadersEditing = 1
此时,可以加载Shader源码,而不是加载shadercache.pak,加载源码还需要将Shader.pak解压缩到同级目录。【ref】
2. 删除缓存目录
删除shader中的缓存目录CryEngine3 和shaders原目录在一块,CryEngineV之后默认在:C:\Users\Administrator\Saved Games\gamezero\shaders\cache
3. 配置shader编译服务器 :【ref】
r_ShadersRemoteCompiler=1
r_ShaderCompilerServer=127.0.0.1
r_ShaderCompilerPort=61453
4. 设置shader调试模式 :
r_ShadersDebug = 3
r_ShadersDebug
DUMPTODISK
Enable special logging when shaders become compiled
Usage: r_ShadersDebug [0/1/2/3]
1 = assembly into directory Main/{Game}/shaders/cache/d3d9
2 = compiler input into directory Main/{Game}/testcg
3 = compiler input with debug information (useful for PIX etc./{Game}/testcg_1pass
Default is 0 (off)