Loading Renderdoc from Java

Loading Renderdoc from Java

Renderdoc is a tremendously useful graphics debugger by Baldur Karlsson that works by intercepting your Vulkan/Direct3D/OpenGL API calls either by injecting its little helper library into your running application or by loading the helper library before the actual API library. The Renderdoc library will then record all the API calls, and forward them to the rendering API. After triggering a frame capture, Renderdoc will show you all the API calls you have done during this frame, for you to click through, and hopefully find your error quick.

Renderdoc's helper library can for example be loaded as a Vulkan instance layer, or even with it's own C API for all graphics APIs.

Now, if you are using Java, you are a bit out of luck. Or are you? If you just want the helper library loaded, without programmatically interacting with Renderdoc, you can just use JNA or System.loadLibrary(), e.g.

// JNA, requires additional interface definition
Native.loadLibrary("renderdoc", RenderdocLibrary.class);
// pure Java, simplest way
System.loadLibrary("renderdoc");

And there you go, Renderdoc will great you upon the next start of your application with its PrtScrn to capture banner:

Renderdoc having successfully attached.

Happy debugging!

Note: A preliminary sketch of using JNA to programmatically interfacte with Renderdoc from Kotlin can be found in scenery's Github repository