more GN_EXT_QUEUES business
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "vulkan_command_pool.h"
|
||||
#include "output_device/vulkan_output_devices.h"
|
||||
#include "instance/gryphn_instance.h"
|
||||
|
||||
gnReturnCode createCommandPool(gnCommandPool commandPool, gnDevice device, gnCommandPoolInfo info) {
|
||||
commandPool->commandPool = malloc(sizeof(gnPlatformCommandPool));
|
||||
@@ -7,12 +8,12 @@ gnReturnCode createCommandPool(gnCommandPool commandPool, gnDevice device, gnCom
|
||||
VkCommandPoolCreateInfo poolInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
|
||||
.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT,
|
||||
.queueFamilyIndex = device->outputDevice->queues[device->outputDevice->graphicsQueueIndex].queueInfo.queueIndex,
|
||||
.queueFamilyIndex = info.queueFamilyIndex,
|
||||
};
|
||||
if (!device->instance->enabledExtensions[GN_EXT_QUEUES]) poolInfo.queueFamilyIndex = device->outputDevice->queues[device->outputDevice->graphicsQueueIndex].queueInfo.queueIndex;
|
||||
|
||||
if (vkCreateCommandPool(device->outputDevice->device, &poolInfo, NULL, &commandPool->commandPool->commandPool) != VK_SUCCESS) {
|
||||
if (vkCreateCommandPool(device->outputDevice->device, &poolInfo, NULL, &commandPool->commandPool->commandPool) != VK_SUCCESS)
|
||||
return GN_FAILED_TO_CREATE_COMMAND_POOL;
|
||||
}
|
||||
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
|
@@ -30,17 +30,23 @@ gnReturnCode createPresentationQueue(gnPresentationQueueHandle presentationQueue
|
||||
createInfo.imageArrayLayers = 1;
|
||||
createInfo.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||
|
||||
if (presentationInfo.surface->windowSurface->presentQueueIndex != device->outputDevice->graphicsQueueIndex) {
|
||||
createInfo.imageSharingMode = VK_SHARING_MODE_CONCURRENT;
|
||||
createInfo.queueFamilyIndexCount = 2;
|
||||
createInfo.pQueueFamilyIndices = (uint32_t[]){
|
||||
device->outputDevice->queues[presentationInfo.surface->windowSurface->presentQueueIndex].queueInfo.queueIndex,
|
||||
device->outputDevice->queues[device->outputDevice->graphicsQueueIndex].queueInfo.queueIndex
|
||||
};
|
||||
if (device->instance->enabledExtensions[GN_EXT_QUEUES]) {
|
||||
createInfo.imageSharingMode = (presentationInfo.imageSharingMode == GN_SHARING_MODE_CONCURRENT) ? VK_SHARING_MODE_CONCURRENT : VK_SHARING_MODE_EXCLUSIVE;
|
||||
createInfo.queueFamilyIndexCount = presentationInfo.queueFamilyCount;
|
||||
createInfo.pQueueFamilyIndices = presentationInfo.queueFamilies;
|
||||
} else {
|
||||
createInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
||||
createInfo.queueFamilyIndexCount = 1;
|
||||
createInfo.pQueueFamilyIndices = &device->outputDevice->queues[presentationInfo.surface->windowSurface->presentQueueIndex].queueInfo.queueIndex;
|
||||
if (presentationInfo.surface->windowSurface->presentQueueIndex != device->outputDevice->graphicsQueueIndex) {
|
||||
createInfo.imageSharingMode = VK_SHARING_MODE_CONCURRENT;
|
||||
createInfo.queueFamilyIndexCount = 2;
|
||||
createInfo.pQueueFamilyIndices = (uint32_t[]){
|
||||
device->outputDevice->queues[presentationInfo.surface->windowSurface->presentQueueIndex].queueInfo.queueIndex,
|
||||
device->outputDevice->queues[device->outputDevice->graphicsQueueIndex].queueInfo.queueIndex
|
||||
};
|
||||
} else {
|
||||
createInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
||||
createInfo.queueFamilyIndexCount = 1;
|
||||
createInfo.pQueueFamilyIndices = &device->outputDevice->queues[presentationInfo.surface->windowSurface->presentQueueIndex].queueInfo.queueIndex;
|
||||
}
|
||||
}
|
||||
createInfo.preTransform = details.capabilities.currentTransform;
|
||||
createInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
|
||||
|
Reference in New Issue
Block a user