Skip to content

Debugging

Carsten Rudolph edited this page Aug 9, 2022 · 1 revision

LiteFX has builtin support for API-level debugging utilities. This page describes, how to use different debuggers with your application.

Debugging

RenderDoc

RenderDoc is a powerful debugger, that can capture various graphics APIs. When launching a LiteFX application through it, many of the API resources should be automatically named. However, in some scenarios, you might want to use the in-application API it provides. This is especially true, if you want to debug a Vulkan application, that uses the interop DXGI swap chain. Since in this case, the Vulkan backend is not issuing any present calls, RenderDoc cannot determine when to start or end a capture. In this case, you have to frame the capture from code. The samples already can load the API, if it is available. To enable this, you can configure the project with the BUILD_EXAMPLES_RENDERDOC_LOADER option set to ON. When launched from RenderDoc and with the --load-render-doc=true command line parameter provided, this will cause the API to be initialized. However, none of the samples make actual use of the API. Instead, you have to do this manually in your application. When starting and ending a capture, make sure not to provide the window handle, but the proper VkInstance:

const auto& instance = dynamic_cast<VulkanBackend&>(*this->activeBackend(BackendType::Rendering));

if (renderDoc)
    renderDoc->StartFrameCapture(RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE(instance.handle()), nullptr);

// ...

if (renderDoc)
    renderDoc->EndFrameCapture(RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE(instance.handle()), nullptr);

For the DirectX12 backend, or if you are using the Vulkan swap chain (i.e. not build the DX12 backend), you can provide both parameters to StartFrameCapture/EndFrameCapture.

PIX