RenderDoc Integration RenderDoc 集成 性能系列7

RenderDoc Integration RenderDoc 集成

本文档主要是对Unity官方手册的个人理解与总结(其实以翻译记录为主:>)
仅作为个人学习使用,不得作为商业用途,欢迎转载,并请注明出处。
文章中涉及到的操作都是基于Unity2018.3版本
参考链接:https://docs.unity3d.com/Manual/RenderDocIntegration.html

The Editor supports integrated launching and capture of the RenderDoc graphics debugger, for detailed frame introspection and debugging.
编辑器支持RenderDoc图形调试器的集成启动和捕获,用于详细的帧分析和调试。

The integration is only supported for RenderDoc versions 0.26 or later, so if an earlier version is currently installed it is required that you update to at least version 0.26.
该集成仅支持RenderDoc版本0.26或更高版本,因此如果当前安装了较早的版本,则需要更新到至少0.26版本。

Note: While the integration is only available in the Editor, it is quite possible to use RenderDoc as normal with no extra setup in standalone player builds.
注意:虽然这个集成只在编辑器中可用,但是在独立播放器构建中完全可以正常使用RenderDoc,而不需要额外的设置。

Note: Frames can only be captured if Unity is running on a platform and API that RenderDoc supports - at time of writing that means Windows only, and either DirectX 11 or OpenGL Core profile. If another API is in use, the RenderDoc integration will be temporarily disabled until a supported API is enabled.
注意:只有在Unity运行在RenderDoc支持的平台和API上时,框架才能被捕获——在编写的时候(2019.3.4时,GLES也可以使用),这意味着只有Windows,或者DirectX 11或者OpenGL Core profile。如果使用其他API, RenderDoc集成将暂时禁用,直到启用受支持的API。

Loading RenderDoc 加载

If a RenderDoc installation is detected, then at any time after loading the Editor you can right click on the tab for the Game View or Scene View and click the ‘Load RenderDoc’ option. This will reload the graphics device so you must save any changes, but afterwards RenderDoc will be ready to capture without having to restart the editor or build a standalone player.
如果检测到RenderDoc已安装,那么在加载编辑器之后的任何时候,您都可以右键单击游戏视图或场景视图的选项卡,并单击“加载RenderDoc”选项。这将重新加载图形设备,因此您必须保存任何更改,但之后RenderDoc将准备捕获,而无需重新启动编辑器或构建独立的播放器。
RenderDoc Integration RenderDoc 集成 性能系列7_第1张图片
Loading RenderDoc at runtime

Note: You can also launch the Editor via RenderDoc as normal, or pass the -load-renderdoc command line option to load RenderDoc from startup.
注意:您也可以通过RenderDoc正常启动编辑器,或者通过-load-renderdoc命令行选项从启动加载RenderDoc。

Capturing a frame with RenderDoc 捕捉帧

When a compatible version of RenderDoc is detected as loaded into the Editor, a new button will appear on the right side of the toolbar on the Game and Scene Views.
当一个兼容的RenderDoc版本被加载到编辑器中,一个新的按钮将出现在游戏和场景视图中工具栏的右侧的。
RenderDoc Integration RenderDoc 集成 性能系列7_第2张图片
Capturing a frame with RenderDoc

Pressing this button will trigger a capture of the next frame of rendering for the view. If the RenderDoc tool UI has not been opened, a new instance will be launched to show the capture, and if it is already running the newest capture will automatically appear there. From there you can open the capture and debug using the tool.
按下此按钮将触发视图渲染的下一帧的捕获。如果尚未打开RenderDoc工具UI,将启动一个新实例来显示捕获,如果它已经在运行,则会自动出现最新的捕获。在那里,您可以使用该工具打开捕获和调试。
RenderDoc Integration RenderDoc 集成 性能系列7_第3张图片
List of frame captures in RenderDoc

Including shader debug information 包含shader调试信息

By default to optimise the size of DirectX11 shaders, debugging information is stripped out. This means that constants and resources will have no names, and the shader source will not be available. To include this debugging information in your shader, include #pragma enable_d3d11_debug_symbols in your shader’s CGPROGRAM block.
默认情况下,为了优化DirectX11着色器的大小,调试信息被删除。这意味着常量和资源将没有名称,着色器源码将不可用。要在着色器中包含此调试信息,请在着色器的CGPROGRAM块中包含#pragma enable_d3d11_debug_symbols

Alternative graphics debugging techniques 可选图形调试技术

If you build a standalone player using D3D11, you can capture a frame and debug using the Visual Studio graphics debugger.
如果您使用D3D11构建一个独立的播放器,您可以捕获一帧并使用Visual Studio图形调试器进行调试。

你可能感兴趣的:(Performance)