diff options
author | Jordan Halase <jordan@halase.me> | 2019-10-31 23:05:03 -0500 |
---|---|---|
committer | Jordan Halase <jordan@halase.me> | 2019-10-31 23:05:03 -0500 |
commit | 3ece0bd80226a2550592dfeee3b9cc9d88e6109e (patch) | |
tree | d009ef7e60c75c06bce5f261fc9405d72c7e98b0 | |
parent | 4f1523e2f6e55c6d09146c26750b356b0b391bae (diff) |
Get graphics queue handle
-rw-r--r-- | main.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -90,6 +90,7 @@ struct VulkanAPI { struct VulkanDev { PFN_vkDestroyDevice vkDestroyDevice; PFN_vkDeviceWaitIdle vkDeviceWaitIdle; + PFN_vkGetDeviceQueue vkGetDeviceQueue; }; /** Vulkan application that uses Pugl for windows and events */ @@ -105,6 +106,7 @@ struct RenderVulkan { VkPhysicalDevice physicalDevice; uint32_t graphicsIndex; VkDevice device; + VkQueue graphicsQueue; }; #define RVK_ERRMSG_LEN 4096 @@ -753,9 +755,18 @@ static int rvkLoadDeviceFunctions(struct RenderVulkan *vk, VkDevice device) return -1; } + static const char *const _vkGetDeviceQueue = "vkGetDeviceQueue"; + uintptr_t *__vkGetDeviceQueue = (uintptr_t*)&vk->dev->vkGetDeviceQueue; + *__vkGetDeviceQueue = (uintptr_t)vk->api->vkGetDeviceProcAddr(device, _vkGetDeviceQueue); + if (!vk->dev->vkGetDeviceQueue) { + rvkSetErrMsg(vk, strErrLd, _vkGetDeviceQueue); + return -1; + } + return 0; } +/** Opens the logical device and retrieves the queue(s) for this application. */ int rvkOpenDevice(struct RenderVulkan *vk) { if (vk->device) { @@ -794,6 +805,7 @@ int rvkOpenDevice(struct RenderVulkan *vk) if (rvkLoadDeviceFunctions(vk, device)) { return -1; } + vk->dev->vkGetDeviceQueue(vk->device, vk->graphicsIndex, 0, &vk->graphicsQueue); return 0; } |