Retrieving debug information from shaders
One of the most difficult tasks in graphics programming is writing tests. Be those smoke, integration, end-to-end, or unit tests, how do you ensure that the output of your engine is really what you would expect? Except for simple tests, screenshot-like types of tests are prone to several problems. One particularly difficult problem is testing shader code – since you don’t usually have access to the hardware, testing shader code is very painful.
Thankfully, Vulkan has a mechanism that allows you to capture the value output from shaders with the debugPrintfEXT
function directly from the validation layer. This mechanism isn’t new and could be enabled using the Vulkan Configurator. But, introduced with the Vulkan SDK 1.3.275
, the VK_EXT_layer_settings
instance extension allows you to enable this mechanism directly from your application without manually having to edit any other configuration.
In this recipe, you will learn...