aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuentin LADEVIE <qladevie@wanadev.fr>2022-02-24 12:42:53 +0100
committerQuentin LADEVIE <qladevie@wanadev.fr>2022-02-24 12:42:53 +0100
commitb088d17e07dc68ff81830f40f4a49eda4f93dc13 (patch)
tree10b04b1a7e214f686a7aaa967bbf49c5a4b9980c /src
parent5b87100b8ca9953832086f392ee60e1421654b3b (diff)
Choose a device queue based on queue usages
Diffstat (limited to 'src')
-rw-r--r--src/vk-context.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/vk-context.cpp b/src/vk-context.cpp
index 52edc09..b539194 100644
--- a/src/vk-context.cpp
+++ b/src/vk-context.cpp
@@ -3,6 +3,7 @@
#include "vk-context.hpp"
#include "vulkan-loader.hpp"
+#include "vulkan/vulkan_core.h"
#define VMA_IMPLEMENTATION
#include "thirdparty/vk_mem_alloc.h"
@@ -108,7 +109,7 @@ void vkcontext::create_debugger() {
void vkcontext::create_device() {
select_physical_device();
- select_queue();
+ select_queue(VK_QUEUE_COMPUTE_BIT | VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_TRANSFER_BIT);
VkDeviceQueueCreateInfo queue_create_info = {};
queue_create_info.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
@@ -189,7 +190,7 @@ void vkcontext::select_physical_device() {
assert(physical_device != VK_NULL_HANDLE);
}
-void vkcontext::select_queue() {
+void vkcontext::select_queue(VkQueueFlags queueUsage) {
uint32_t queue_properties_count = 0;
vkGetPhysicalDeviceQueueFamilyProperties(physical_device, &queue_properties_count, nullptr);
@@ -197,7 +198,7 @@ void vkcontext::select_queue() {
vkGetPhysicalDeviceQueueFamilyProperties(physical_device, &queue_properties_count, queue_properties.data());
for (uint32_t properties_index = 0; properties_index < queue_properties_count; properties_index++) {
- if (queue_properties[properties_index].queueFlags & VK_QUEUE_COMPUTE_BIT) {
+ if (queue_properties[properties_index].queueFlags & queueUsage) {
queue_index = properties_index;
return;
}