Getting Memory to Shaders in Vulkan

Author: Greg Gutmann
Affiliation: Tokyo Institute of Technology


Since the Vulkan API has been built to be flexible and run on various types of hardware, from server grade GPU to cellphones, it needs a certain amount of information to do what you want in an efficient manner. This means that when allocating and using memory it can take a fair number of steps.

The Web of Descriptors

Is my description for what working with memory in Vulkan feels like.

When learning about the processes involved to create usable memory for the shaders, reading about it just didn’t feel sufficient as there are so many components. What I wanted was a detailed map of how all of the components are connected and the flow from start to finish. There are abstracted diagrams showing how things work [1] but for coding, I really wanted the details, so I made my own figure showing the connections between the components involved.

The destination for most descriptors is the VkGraphicsPipelineCreateInfo structure, signified by the double-walled purple box. In addition, functions are used to bind VkBuffer (memory) to the VkCommandBuffer, which is submitted to the GPU when calling vkQueueSubmit.

The following are subjectively the main functions and structures involved with: creating bindings with descriptor sets for shaders and setting up vertex buffers for shaders.

Shader code shown is from the Vulkan SDK tutorial

Leave a comment if you have corrections or suggestions on how to further clarify this topic, thanks.

Contact me if you would like to use the contents of this post. 
Copyright © 2019 by Gregory Gutmann

This Post Has One Comment

  1. So Thank you for summarizing this huge relationship!

Leave a Reply

Close Menu