more GN_EXT_QUEUES business
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#include "vulkan_command_pool.h"
|
#include "vulkan_command_pool.h"
|
||||||
#include "output_device/vulkan_output_devices.h"
|
#include "output_device/vulkan_output_devices.h"
|
||||||
|
#include "instance/gryphn_instance.h"
|
||||||
|
|
||||||
gnReturnCode createCommandPool(gnCommandPool commandPool, gnDevice device, gnCommandPoolInfo info) {
|
gnReturnCode createCommandPool(gnCommandPool commandPool, gnDevice device, gnCommandPoolInfo info) {
|
||||||
commandPool->commandPool = malloc(sizeof(gnPlatformCommandPool));
|
commandPool->commandPool = malloc(sizeof(gnPlatformCommandPool));
|
||||||
@@ -7,12 +8,12 @@ gnReturnCode createCommandPool(gnCommandPool commandPool, gnDevice device, gnCom
|
|||||||
VkCommandPoolCreateInfo poolInfo = {
|
VkCommandPoolCreateInfo poolInfo = {
|
||||||
.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
|
||||||
.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT,
|
.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_FAILED_TO_CREATE_COMMAND_POOL;
|
||||||
}
|
|
||||||
|
|
||||||
return GN_SUCCESS;
|
return GN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@@ -30,6 +30,11 @@ gnReturnCode createPresentationQueue(gnPresentationQueueHandle presentationQueue
|
|||||||
createInfo.imageArrayLayers = 1;
|
createInfo.imageArrayLayers = 1;
|
||||||
createInfo.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
createInfo.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||||
|
|
||||||
|
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 {
|
||||||
if (presentationInfo.surface->windowSurface->presentQueueIndex != device->outputDevice->graphicsQueueIndex) {
|
if (presentationInfo.surface->windowSurface->presentQueueIndex != device->outputDevice->graphicsQueueIndex) {
|
||||||
createInfo.imageSharingMode = VK_SHARING_MODE_CONCURRENT;
|
createInfo.imageSharingMode = VK_SHARING_MODE_CONCURRENT;
|
||||||
createInfo.queueFamilyIndexCount = 2;
|
createInfo.queueFamilyIndexCount = 2;
|
||||||
@@ -42,6 +47,7 @@ gnReturnCode createPresentationQueue(gnPresentationQueueHandle presentationQueue
|
|||||||
createInfo.queueFamilyIndexCount = 1;
|
createInfo.queueFamilyIndexCount = 1;
|
||||||
createInfo.pQueueFamilyIndices = &device->outputDevice->queues[presentationInfo.surface->windowSurface->presentQueueIndex].queueInfo.queueIndex;
|
createInfo.pQueueFamilyIndices = &device->outputDevice->queues[presentationInfo.surface->windowSurface->presentQueueIndex].queueInfo.queueIndex;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
createInfo.preTransform = details.capabilities.currentTransform;
|
createInfo.preTransform = details.capabilities.currentTransform;
|
||||||
createInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
|
createInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
|
||||||
createInfo.presentMode = presentMode;
|
createInfo.presentMode = presentMode;
|
||||||
|
@@ -11,6 +11,7 @@ typedef gnFlags gnCommandPoolFlags;
|
|||||||
|
|
||||||
typedef struct gnCommandPoolInfo {
|
typedef struct gnCommandPoolInfo {
|
||||||
gnCommandPoolFlags flags;
|
gnCommandPoolFlags flags;
|
||||||
|
uint32_t queueFamilyIndex; // ignored unless GN_EXT_QUEUES is enabled
|
||||||
} gnCommandPoolInfo;
|
} gnCommandPoolInfo;
|
||||||
|
|
||||||
#ifdef GN_REVEAL_IMPL
|
#ifdef GN_REVEAL_IMPL
|
||||||
|
@@ -9,9 +9,11 @@ typedef struct gnPresentationQueueInfo {
|
|||||||
gnUInt2 imageSize;
|
gnUInt2 imageSize;
|
||||||
gnWindowSurfaceHandle surface;
|
gnWindowSurfaceHandle surface;
|
||||||
gnSurfaceFormat format;
|
gnSurfaceFormat format;
|
||||||
// gnImageSharingMode imageSharingMode;
|
|
||||||
// uint32_t queueFamilyCount;
|
// ignored unless GN_EXT_QUEUES is enabled
|
||||||
// uint32_t* queueFamilies;
|
gnImageSharingMode imageSharingMode;
|
||||||
|
uint32_t queueFamilyCount;
|
||||||
|
uint32_t* queueFamilies;
|
||||||
} gnPresentationQueueInfo;
|
} gnPresentationQueueInfo;
|
||||||
|
|
||||||
struct gnPlatformPresentationQueue_t;
|
struct gnPlatformPresentationQueue_t;
|
||||||
|
Reference in New Issue
Block a user