Optimize device calls to reduce dispatch overhead
masterBy default, device-related calls (like vkCmdDraw) go through the Vulkan loader dispatch, which can incur up to 7% overhead. You can optimize this using two methods:
- Single Device Applications: If you only use one
VkDevice, callvolkLoadDevice(device)to load entrypoints directly from the driver. This overwrites global function pointers with device-specific versions. - Multi-Device Applications: If you use multiple
VkDeviceobjects, usevolkLoadDeviceTable(table, device)to load entrypoints into aVolkDeviceTable. You must store one table per device and call functions from that table instead of the global pointers.
Note: If you use volkLoadDevice or the table-based approach, you can use volkLoadInstanceOnly() instead of volkLoadInstance() to avoid loading device-specific functions into the global namespace.