summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Halase <jordan@halase.me>2019-10-31 23:05:03 -0500
committerJordan Halase <jordan@halase.me>2019-10-31 23:05:03 -0500
commit3ece0bd80226a2550592dfeee3b9cc9d88e6109e (patch)
treed009ef7e60c75c06bce5f261fc9405d72c7e98b0
parent4f1523e2f6e55c6d09146c26750b356b0b391bae (diff)
Get graphics queue handle
-rw-r--r--main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/main.c b/main.c
index 6748668..f126251 100644
--- a/main.c
+++ b/main.c
@@ -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;
}