AMD (Advanced Micro Devices, Inc.) and LunarG are pleased to announce DirectX®12 (D3D12) and DirectX® Raytracing (DXR) support for the GFXReconstruct capture/replay tool.
LunarG initially developed GFXReconstruct to capture/replay Vulkan® applications. This free-use, open-source tool has seen broad adoption by Vulkan developers. Through a joint venture between AMD and LunarG, GFXReconstruct has been extended to also support capture/replay of applications using the DirectX ecosystem.
D3D12 is the de facto standard for gaming on the Windows platform and has been used in the development and deployment of hundreds of titles since its release. The addition of D3D12 support to GFXReconstruct provides developers with another valuable tool to help analyze and debug D3D12 applications. Plus, since this latest version of GFXReconstruct continues to be made available through an open-source license, developers can use this tool freely and can choose to contribute back to the community by providing enhancements, support, or bug fixes.
The GFXReconstruct package is a customizable Swiss army knife when it comes to capture/replay tools. On the capture side, GFXReconstruct provides proxy libraries that record graphics API calls to a capture file on disk. On the replay side, GFXReconstruct provides a series of command-line tools and scripts to read and process capture files.
The most frequently used capture file processing tools are gfxrecon-replay and gfxrecon-optimize. The gfxrecon-replay tool replays capture files, and the gfxrecon-optimize tool produces new capture files with improved replay performance. Please see the documentation for more information on all the tools available in GFXReconstruct.
The software architecture behind GFXReconstruct is also quite extensible. It is written in such a way that developers can implement support for capturing other graphics APIs and develop custom consumers/tools for processing the content of capture files.
How to use GFXReconstruct
Let’s capture and replay AMD’s Hybrid Shadows sample to illustrate how one might use GFXReconstruct. We recommend starting with applications like this to learn the tool before moving onto heavier workloads. For simplicity, this example will use GFXReconstruct provided in a release archive with default settings.
After decompressing a release archive we will find:
- Proxy libraries (in DLL form) inside a
- Tools and consumers (in executable and script form) at the root
First, we identify GFXReconstruct’s proxy libraries and copy them beside our application executable, highlighted below:
Second, we run the application as we normally would, and reach a scene of interest:
Third, we observe the creation of our GFXReconstruct .gfxr capture file, which will be ready for consumption once the application is closed. By default, the capture file will be created in the application’s working directory, highlighted below:
We have now obtained a “full” capture file which contains everything from application launch until its termination. GFXReconstruct can also obtain “trimmed” capture files which only contain a user-defined frame range. This is helpful when seeking specific frames that exclude loading screens. To do this, we would change some capture-time settings as explained in the documentation.
At this point we can analyze the captured workload via a means of our choosing. We can collect performance metrics, debug visual artifacts, or whatever needs to be done – all without needing to run the live application.
Another important piece in this workflow is optimization of D3D12 capture files. This is done by running the gfxrecon-optimize tool on a capture file, which achieves two important things:
First, the optimizer will trim out creation of unreferenced pipeline state objects (PSOs). This action can dramatically reduce capture file load time for cases when the source application created thousands of PSOs that were not referenced in the captured frames.
Second, the optimizer will analyze a DXR workload and inject specialized commands that help gfxrecon-replay quickly fetch the GPU virtual addresses it needs. This action allows replay performance to match the original application more closely.
We highly encourage users to leverage the optimizer in their workflow for those interested in the best replay experience with GFXReconstruct. More details are available in the documentation.
This overview only scratches the surface.
Head over to GitHub to get the code, read docs, and dig deeper!