Apart from drawing, Vulkan can be used to perform general computations. For this purpose, we need to write compute shaders and execute them--this is called dispatching.
When we want to issue computational work to be performed, we need to specify how many separate compute shader instances should be executed and how they are divided into workgroups.
Dispatching compute work
How to do it...
- Take the handle of a command buffer and store it in a variable of type VkCommandBuffer named command_buffer. Make sure the command buffer is in the recording state and no render pass is currently started.
- Store the number of local workgroups along the x dimension in a variable of type uint32_t named x_size.
- The number of local workgroups in the y dimensions should be stored in a...