Printing values from shaders in Vulkan
As graphics programmers, we must all agree that debugging shaders is one of the most frustrating aspects of our jobs. Even though some frame capture software provides shader debugging, it may still be difficult to find the exact pixel you would like to debug, or you may need another piece of information about a set of pixels instead of just inspecting them one by one.
Thankfully, Vulkan provides a way to print values directly from shaders. The information can be inspected directly on RenderDoc, for example, or retrieved from the validation error messages (please refer to the Retrieving debugging information from shaders recipe for more details on how to do this).
In this recipe, you will learn how to print values from your shader code using a simple function that is like printf
.
Getting ready
To utilize the functionality of printing values from shaders, it’s a prerequisite to enable the VK_KHR_shader_non_semantic_info
device...