During drawing or dispatching computational work, specific shader stages are executed--the ones defined during the pipeline creation. So the shaders can perform their job, we need to provide data to them. Most of the time we use descriptor sets, as they allow us to provide kilobytes or even megabytes of data through buffers or images. But using them is quite complicated. And, what's more important, frequent changes of descriptor sets may impact the performance of our application. But sometimes, we need to provide a small amount of data in a fast and easy way. We can do this using push constants.
Providing data to shaders through push constants
How to do it...
- Store the handle of a command buffer in a variable of type VkCommandBuffer named command_buffer. Make...