From cfcb37a1a4487b4938fbe7c2a3953f161ca82dc6 Mon Sep 17 00:00:00 2001 From: Greg Wells Date: Tue, 15 Jul 2025 11:43:17 -0400 Subject: [PATCH] vulkan remove queue API --- projects/apis/metal/loader/metal_extensions.m | 1 + .../apis/vulkan/loader/vulkan_extensions.c | 1 + .../command_pool/vulkan_command_pool.c | 2 +- .../vulkan/src/instance/vulkan_instance.c | 1 - .../src/output_device/vulkan_output_device.c | 40 ++++---- .../src/output_device/vulkan_output_devices.h | 14 ++- .../output_device/vulkan_physical_device.c | 92 +++++++++++++++---- .../output_device/vulkan_physical_device.h | 9 ++ .../apis/vulkan/src/present/vulkan_present.c | 11 +-- .../vulkan_presentation_queue.c | 4 +- .../apis/vulkan/src/submit/vulkan_submit.c | 7 +- .../src/vulkan_surface/vulkan_surface.h | 1 + projects/core/gryphn_extensions.h | 1 + .../command_pool/gryphn_command_pool.h | 4 +- .../src/output_device/gryphn_output_device.h | 14 +-- .../gryphn_physical_output_device.c | 2 +- .../gryphn_physical_output_device.h | 32 +++---- projects/core/src/present/gryphn_present.h | 2 +- .../gryphn_presentation_queue.h | 4 +- projects/core/src/submit/gryphn_submit.h | 2 +- .../core/src/window_surface/gryphn_surface.h | 1 - 21 files changed, 156 insertions(+), 89 deletions(-) diff --git a/projects/apis/metal/loader/metal_extensions.m b/projects/apis/metal/loader/metal_extensions.m index 74fe590..90fd02a 100644 --- a/projects/apis/metal/loader/metal_extensions.m +++ b/projects/apis/metal/loader/metal_extensions.m @@ -2,5 +2,6 @@ gnBool metalIsExtensionSupported(gnExtension extension) { if (extension == GN_EXT_SYNCHRONIZATION) return gnTrue; + if (extension == GN_EXT_QUEUES) return gnTrue; return gnFalse; } diff --git a/projects/apis/vulkan/loader/vulkan_extensions.c b/projects/apis/vulkan/loader/vulkan_extensions.c index 3a93170..14e914d 100644 --- a/projects/apis/vulkan/loader/vulkan_extensions.c +++ b/projects/apis/vulkan/loader/vulkan_extensions.c @@ -2,5 +2,6 @@ gnBool vulkanIsExtensionSupported(gnExtension extension){ if (extension == GN_EXT_SYNCHRONIZATION) return gnTrue; + if (extension == GN_EXT_QUEUES) return gnTrue; return gnFalse; } diff --git a/projects/apis/vulkan/src/commands/command_pool/vulkan_command_pool.c b/projects/apis/vulkan/src/commands/command_pool/vulkan_command_pool.c index 59121b4..0576b0a 100644 --- a/projects/apis/vulkan/src/commands/command_pool/vulkan_command_pool.c +++ b/projects/apis/vulkan/src/commands/command_pool/vulkan_command_pool.c @@ -7,7 +7,7 @@ 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 = info.queueIndex, + .queueFamilyIndex = device->outputDevice->queues[device->outputDevice->graphicsQueueIndex].queueInfo.queueIndex, }; if (vkCreateCommandPool(device->outputDevice->device, &poolInfo, NULL, &commandPool->commandPool->commandPool) != VK_SUCCESS) { diff --git a/projects/apis/vulkan/src/instance/vulkan_instance.c b/projects/apis/vulkan/src/instance/vulkan_instance.c index 43580cb..303aa56 100644 --- a/projects/apis/vulkan/src/instance/vulkan_instance.c +++ b/projects/apis/vulkan/src/instance/vulkan_instance.c @@ -1,5 +1,4 @@ #include "vulkan_instance.h" -#include #include typedef struct vkUserData { diff --git a/projects/apis/vulkan/src/output_device/vulkan_output_device.c b/projects/apis/vulkan/src/output_device/vulkan_output_device.c index 47b0973..1a1f4a8 100644 --- a/projects/apis/vulkan/src/output_device/vulkan_output_device.c +++ b/projects/apis/vulkan/src/output_device/vulkan_output_device.c @@ -8,13 +8,13 @@ gnReturnCode createOutputDevice(gnOutputDeviceHandle outputDevice, gnInstanceHandle instance, gnOutputDeviceInfo deviceInfo) { outputDevice->outputDevice = malloc(sizeof(gnPlatformOutputDevice)); - VkDeviceQueueCreateInfo* queueCreateInfos = malloc(sizeof(VkDeviceQueueCreateInfo) * deviceInfo.queueInfoCount); + VkDeviceQueueCreateInfo* queueCreateInfos = malloc(sizeof(VkDeviceQueueCreateInfo) * deviceInfo.physicalDevice->physicalDevice->neededQueueCount); float queuePriority = 1.0f; - for (int i = 0; i < deviceInfo.queueInfoCount; i++) { + for (int i = 0; i < deviceInfo.physicalDevice->physicalDevice->neededQueueCount; i++) { queueCreateInfos[i].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO; queueCreateInfos[i].flags = 0; - queueCreateInfos[i].queueFamilyIndex = deviceInfo.queueInfos[i].queueIndex; - queueCreateInfos[i].queueCount = deviceInfo.queueInfos[i].queueCount; + queueCreateInfos[i].queueFamilyIndex = deviceInfo.physicalDevice->physicalDevice->neededQueues[i].queueIndex; + queueCreateInfos[i].queueCount = 1; queueCreateInfos[i].pQueuePriorities = &queuePriority; } @@ -24,7 +24,7 @@ gnReturnCode createOutputDevice(gnOutputDeviceHandle outputDevice, gnInstanceHan VkDeviceCreateInfo deviceCreateInfo = { .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, - .queueCreateInfoCount = deviceInfo.queueInfoCount, + .queueCreateInfoCount = deviceInfo.physicalDevice->physicalDevice->neededQueueCount, .pQueueCreateInfos = queueCreateInfos, .pEnabledFeatures = &deviceFeatures }; @@ -45,9 +45,20 @@ gnReturnCode createOutputDevice(gnOutputDeviceHandle outputDevice, gnInstanceHan if (vkCreateDevice(deviceInfo.physicalDevice->physicalDevice->device, &deviceCreateInfo, NULL, &outputDevice->outputDevice->device) != VK_SUCCESS) return GN_FAILED_TO_CREATE_DEVICE; - outputDevice->outputDevice->queues = malloc(sizeof(VkQueue) * deviceInfo.queueInfoCount); - for (int i = 0; i < deviceInfo.queueInfoCount; i++) { - vkGetDeviceQueue(outputDevice->outputDevice->device, deviceInfo.queueInfos[i].queueIndex, 0, &outputDevice->outputDevice->queues[i]); + outputDevice->outputDevice->queues = malloc(sizeof(VkQueue) * deviceInfo.physicalDevice->physicalDevice->neededQueueCount); + uint32_t transferQueue = 0; + for (int i = 0; i < deviceInfo.physicalDevice->physicalDevice->neededQueueCount; i++) { + outputDevice->outputDevice->queues[i].queueInfo = deviceInfo.physicalDevice->physicalDevice->neededQueues[i]; + + vkGetDeviceQueue(outputDevice->outputDevice->device, deviceInfo.physicalDevice->physicalDevice->neededQueues[i].queueIndex, 0, &outputDevice->outputDevice->queues[i].queue); + if ((outputDevice->outputDevice->queues[i].queueInfo.createFlags & VK_QUEUE_TRANSFER_BIT) == VK_QUEUE_TRANSFER_BIT) { + outputDevice->outputDevice->transferQueueIndex = i; + transferQueue = outputDevice->outputDevice->queues[i].queueInfo.queueIndex; + } + + if ((outputDevice->outputDevice->queues[i].queueInfo.createFlags & VK_QUEUE_GRAPHICS_BIT) == VK_QUEUE_GRAPHICS_BIT) { + outputDevice->outputDevice->graphicsQueueIndex = i; + } } uint32_t queueCount = 0; @@ -64,19 +75,10 @@ gnReturnCode createOutputDevice(gnOutputDeviceHandle outputDevice, gnInstanceHan queueFamilies ); - uint32_t transferQueueIndex = 0; - for (int i = 0; i < queueCount; i++) { - if ((queueFamilies[i].queueFlags & VK_QUEUE_TRANSFER_BIT) == VK_QUEUE_TRANSFER_BIT) { - transferQueueIndex = i; - vkGetDeviceQueue(outputDevice->outputDevice->device, deviceInfo.queueInfos[i].queueIndex, 0, &outputDevice->outputDevice->transferQueue); - break; - } - } - VkCommandPoolCreateInfo poolInfo = { .sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, .flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, - .queueFamilyIndex = transferQueueIndex + .queueFamilyIndex = transferQueue }; if (vkCreateCommandPool(outputDevice->outputDevice->device, &poolInfo, NULL, &outputDevice->outputDevice->transferCommandPool) != VK_SUCCESS) @@ -116,5 +118,5 @@ VkCommandBuffer gnBeginVulkanTransferOperation(gnDevice device) { return VkBeginTransferOperation(device->outputDevice->device, device->outputDevice->transferCommandPool); } void gnEndVulkanTransferOperation(gnDevice device, VkCommandBuffer buffer) { - VkEndTransferOperation(buffer, device->outputDevice->transferCommandPool, device->outputDevice->transferQueue, device->outputDevice->device); + VkEndTransferOperation(buffer, device->outputDevice->transferCommandPool, device->outputDevice->queues[device->outputDevice->transferQueueIndex].queue, device->outputDevice->device); } diff --git a/projects/apis/vulkan/src/output_device/vulkan_output_devices.h b/projects/apis/vulkan/src/output_device/vulkan_output_devices.h index fe379bf..2dcc838 100644 --- a/projects/apis/vulkan/src/output_device/vulkan_output_devices.h +++ b/projects/apis/vulkan/src/output_device/vulkan_output_devices.h @@ -2,20 +2,26 @@ #include #include #include "buffers/vulkan_buffer.h" +#include "vulkan_physical_device.h" + +typedef struct vulkanQueue { + VkQueue queue; + vulkanNeededQueue queueInfo; +} vulkanQueue; typedef struct gnPlatformOutputDevice_t { VkDevice device; - uint32_t queueCount; - VkQueue* queues; - VkQueue transferQueue; + uint32_t transferQueueIndex, graphicsQueueIndex; + uint32_t queueCount; + vulkanQueue* queues; + VkCommandPool transferCommandPool; VkGryphnBuffer stagingBuffer; VkDeviceSize stagingBufferSize; VkFence barrierFence; - gnBool enabledOversizedDescriptorPools; } gnPlatformOutputDevice; diff --git a/projects/apis/vulkan/src/output_device/vulkan_physical_device.c b/projects/apis/vulkan/src/output_device/vulkan_physical_device.c index befa031..4ede8e9 100644 --- a/projects/apis/vulkan/src/output_device/vulkan_physical_device.c +++ b/projects/apis/vulkan/src/output_device/vulkan_physical_device.c @@ -56,20 +56,37 @@ gnPhysicalDevice* getPhysicalDevices(gnInstanceHandle instance, uint32_t* device case VK_PHYSICAL_DEVICE_TYPE_MAX_ENUM: outputDevices[i]->properties.deviceType = GN_INTEGRATED_DEVICE; } - vkGetPhysicalDeviceQueueFamilyProperties(physicalDevices[i], &outputDevices[i]->queueProperties.queueCount, NULL); + uint32_t queueFamilyCount = 0; + vkGetPhysicalDeviceQueueFamilyProperties(physicalDevices[i], &queueFamilyCount, NULL); + VkQueueFamilyProperties* queueFamilies = malloc(sizeof(VkQueueFamilyProperties) * queueFamilyCount); + vkGetPhysicalDeviceQueueFamilyProperties(physicalDevices[i], &queueFamilyCount, queueFamilies); - VkQueueFamilyProperties* queueFamilies = malloc(sizeof(VkQueueFamilyProperties) * outputDevices[i]->queueProperties.queueCount); - outputDevices[i]->queueProperties.queueProperties = malloc(sizeof(gnQueueProperties) * outputDevices[i]->queueProperties.queueCount); - vkGetPhysicalDeviceQueueFamilyProperties(physicalDevices[i], &outputDevices[i]->queueProperties.queueCount, queueFamilies); - for (int c = 0; c < outputDevices[i]->queueProperties.queueCount; c++) { - outputDevices[i]->queueProperties.queueProperties[i].queueCount = queueFamilies[i].queueCount; + outputDevices[i]->physicalDevice->neededQueues = malloc(sizeof(vulkanNeededQueue) * queueFamilyCount); + gnBool foundGraphicsQueueFamily = gnFalse, foundTransferQueueFamily = gnFalse; + for (int c = 0; c < queueFamilyCount; c++) { + gnBool hasNeededQueue = gnFalse; - gnQueueTypeFlags finalQueueType = 0; - if (queueFamilies[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) finalQueueType |= GN_QUEUE_GRAPHICS; - if (queueFamilies[i].queueFlags & VK_QUEUE_COMPUTE_BIT) finalQueueType |= GN_QUEUE_COMPUTE; - if (queueFamilies[i].queueFlags & VK_QUEUE_TRANSFER_BIT) finalQueueType |= GN_QUEUE_TRANSFER; - if (queueFamilies[i].queueFlags & VK_QUEUE_SPARSE_BINDING_BIT) finalQueueType |= GN_QUEUE_SPARSE_BINDING; - outputDevices[i]->queueProperties.queueProperties[i].queueType = finalQueueType; + if ((queueFamilies[c].queueFlags & VK_QUEUE_GRAPHICS_BIT) == VK_QUEUE_GRAPHICS_BIT) { + foundGraphicsQueueFamily = true; + hasNeededQueue = gnTrue; + } + if ((queueFamilies[c].queueFlags & VK_QUEUE_TRANSFER_BIT) == VK_QUEUE_TRANSFER_BIT) { + foundTransferQueueFamily = true; + hasNeededQueue = gnTrue; + } + + if (hasNeededQueue) { + vulkanNeededQueue neededQueue = { + .queueIndex = c, + .createFlags = 0, + .usedForPresent = gnFalse + }; + if ((queueFamilies[c].queueFlags & VK_QUEUE_GRAPHICS_BIT)) neededQueue.createFlags |= VK_QUEUE_GRAPHICS_BIT; + if ((queueFamilies[c].queueFlags & VK_QUEUE_TRANSFER_BIT)) neededQueue.createFlags |= VK_QUEUE_TRANSFER_BIT; + + outputDevices[i]->physicalDevice->neededQueues[outputDevices[i]->physicalDevice->neededQueueCount] = neededQueue; + outputDevices[i]->physicalDevice->neededQueueCount++; + } } VkPhysicalDeviceProperties physicalDeviceProperties; @@ -78,16 +95,55 @@ gnPhysicalDevice* getPhysicalDevices(gnInstanceHandle instance, uint32_t* device outputDevices[i]->features.maxDepthSamples = vkSampleCountToGryphn(physicalDeviceProperties.limits.framebufferDepthSampleCounts); outputDevices[i]->features.maxMemoryAllocations = physicalDeviceProperties.limits.maxMemoryAllocationCount; outputDevices[i]->features.maxPushConstantSize = physicalDeviceProperties.limits.maxPushConstantsSize; + + free(queueFamilies); } free(physicalDevices); return outputDevices; } -gnBool queueCanPresentToSurface(gnPhysicalDevice device, uint32_t queueIndex, gnWindowSurfaceHandle windowSurface) { - VkBool32 supportsPresent = VK_FALSE; - vkGetPhysicalDeviceSurfaceSupportKHR(device->physicalDevice->device, queueIndex, windowSurface->windowSurface->surface, &supportsPresent); - if (supportsPresent) - return gnTrue; - return gnFalse; +gnBool deviceCanPresentToSurface(gnPhysicalDevice device, gnWindowSurface surface) { + gnBool foundQueue = gnFalse; + for (int i = 0; i < device->physicalDevice->neededQueueCount; i++) { + VkBool32 supportsPresent = VK_FALSE; + vkGetPhysicalDeviceSurfaceSupportKHR(device->physicalDevice->device, device->physicalDevice->neededQueues[i].queueIndex, surface->windowSurface->surface, &supportsPresent); + if (supportsPresent) { + device->physicalDevice->neededQueues[i].usedForPresent = gnTrue; + foundQueue = gnTrue; + break; + } + surface->windowSurface->presentQueueIndex = i; + } + + if (!foundQueue) { + uint32_t queueFamilyCount = 0; + vkGetPhysicalDeviceQueueFamilyProperties(device->physicalDevice->device, &queueFamilyCount, NULL); + + for (int i = 0; i < queueFamilyCount; i++) { + VkBool32 supportsPresent = VK_FALSE; + vkGetPhysicalDeviceSurfaceSupportKHR(device->physicalDevice->device, i, surface->windowSurface->surface, &supportsPresent); + if (supportsPresent) { + device->physicalDevice->neededQueues[device->physicalDevice->neededQueueCount] = (vulkanNeededQueue){ + .queueIndex = i, + .createFlags = 0, + .usedForPresent = gnTrue + }; + foundQueue = gnTrue; + surface->windowSurface->presentQueueIndex = device->physicalDevice->neededQueueCount; + device->physicalDevice->neededQueueCount++; + break; + } + } + } + + return foundQueue; } + +// gnBool queueCanPresentToSurface(gnPhysicalDevice device, uint32_t queueIndex, gnWindowSurfaceHandle windowSurface) { +// VkBool32 supportsPresent = VK_FALSE; +// vkGetPhysicalDeviceSurfaceSupportKHR(device->physicalDevice->device, queueIndex, windowSurface->windowSurface->surface, &supportsPresent); +// if (supportsPresent) +// return gnTrue; +// return gnFalse; +// } diff --git a/projects/apis/vulkan/src/output_device/vulkan_physical_device.h b/projects/apis/vulkan/src/output_device/vulkan_physical_device.h index e381bb1..a1a6ad0 100644 --- a/projects/apis/vulkan/src/output_device/vulkan_physical_device.h +++ b/projects/apis/vulkan/src/output_device/vulkan_physical_device.h @@ -2,8 +2,17 @@ #include #include +typedef struct vulkanNeededQueue { + VkQueueFlags createFlags; + gnBool usedForPresent; + uint32_t queueIndex; +} vulkanNeededQueue; + typedef struct gnPlatformPhysicalDevice_t { VkPhysicalDevice device; + uint32_t neededQueueCount; + vulkanNeededQueue* neededQueues; + } gnPlatformPhysicalDevice; gnPhysicalDevice* getPhysicalDevices(gnInstanceHandle instance, uint32_t* deviceCount); diff --git a/projects/apis/vulkan/src/present/vulkan_present.c b/projects/apis/vulkan/src/present/vulkan_present.c index 035a54f..059bba0 100644 --- a/projects/apis/vulkan/src/present/vulkan_present.c +++ b/projects/apis/vulkan/src/present/vulkan_present.c @@ -1,5 +1,6 @@ #include "vulkan_present.h" #include "extensions/synchronization/commands/gryphn_sync_present.h" +#include "vulkan_surface/vulkan_surface.h" gnReturnCode vulkanPresentSync(gnDevice device, gnPresentSyncInfo info) { VkSemaphore* waitSemaphores = malloc(sizeof(VkSemaphore) * info.waitCount); @@ -17,10 +18,7 @@ gnReturnCode vulkanPresentSync(gnDevice device, gnPresentSyncInfo info) { .pImageIndices = info.imageIndices }; - VkQueue queue; - vkGetDeviceQueue(device->outputDevice->device, info.queueIndex, 0, &queue); - - VkResult result = vkQueuePresentKHR(queue, &presentInfo); + VkResult result = vkQueuePresentKHR(device->outputDevice->queues[info.presentationQueues[0]->info.surface->windowSurface->presentQueueIndex].queue, &presentInfo); if (result == VK_ERROR_OUT_OF_DATE_KHR) return GN_OUT_OF_DATE_PRESENTATION_QUEUE; if (result == VK_SUBOPTIMAL_KHR) return GN_SUBOPTIMAL_PRESENTATION_QUEUE; return GN_SUCCESS; @@ -40,10 +38,7 @@ gnReturnCode vulkanPresent(gnDevice device, gnPresentInfo info) { .pImageIndices = info.imageIndices }; - VkQueue queue; - vkGetDeviceQueue(device->outputDevice->device, info.queueIndex, 0, &queue); - - VkResult result = vkQueuePresentKHR(queue, &presentInfo); + VkResult result = vkQueuePresentKHR(device->outputDevice->queues[info.presentationQueues[0]->info.surface->windowSurface->presentQueueIndex].queue, &presentInfo); if (result == VK_ERROR_OUT_OF_DATE_KHR) return GN_OUT_OF_DATE_PRESENTATION_QUEUE; if (result == VK_SUBOPTIMAL_KHR) return GN_SUBOPTIMAL_PRESENTATION_QUEUE; return GN_SUCCESS; diff --git a/projects/apis/vulkan/src/presentation_queue/vulkan_presentation_queue.c b/projects/apis/vulkan/src/presentation_queue/vulkan_presentation_queue.c index a61cce3..5ab52d6 100644 --- a/projects/apis/vulkan/src/presentation_queue/vulkan_presentation_queue.c +++ b/projects/apis/vulkan/src/presentation_queue/vulkan_presentation_queue.c @@ -34,8 +34,8 @@ gnReturnCode createPresentationQueue(gnPresentationQueueHandle presentationQueue createInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE; else createInfo.imageSharingMode = VK_SHARING_MODE_CONCURRENT; - createInfo.queueFamilyIndexCount = presentationInfo.queueFamilyCount; - createInfo.pQueueFamilyIndices = presentationInfo.queueFamilies; + 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; createInfo.presentMode = presentMode; diff --git a/projects/apis/vulkan/src/submit/vulkan_submit.c b/projects/apis/vulkan/src/submit/vulkan_submit.c index ff3edf0..f43a48f 100644 --- a/projects/apis/vulkan/src/submit/vulkan_submit.c +++ b/projects/apis/vulkan/src/submit/vulkan_submit.c @@ -26,7 +26,7 @@ gnReturnCode vulkanSubmitSync(gnDevice device, gnSubmitSyncInfo info) { VkQueue queue; vkGetDeviceQueue(device->outputDevice->device, info.queueIndex, 0, &queue); - if (vkQueueSubmit(queue, 1, &submitInfo, info.fence->fence->fence) != VK_SUCCESS) { + if (vkQueueSubmit(device->outputDevice->queues[device->outputDevice->graphicsQueueIndex].queue, 1, &submitInfo, info.fence->fence->fence) != VK_SUCCESS) { free(waitSemaphores); free(waitStages); free(commandBuffers); @@ -55,11 +55,8 @@ gnReturnCode vulkanSubmit(gnDevice device, gnSubmitInfo info) { .pSignalSemaphores = NULL }; - VkQueue queue; - vkGetDeviceQueue(device->outputDevice->device, info.queueIndex, 0, &queue); - vkResetFences(device->outputDevice->device, 1, &device->outputDevice->barrierFence); - if (vkQueueSubmit(queue, 1, &submitInfo, device->outputDevice->barrierFence) != VK_SUCCESS) + if (vkQueueSubmit(device->outputDevice->queues[device->outputDevice->graphicsQueueIndex].queue, 1, &submitInfo, device->outputDevice->barrierFence) != VK_SUCCESS) return GN_FAILED_TO_SUBMIT_COMMAND_BUFFER; vkWaitForFences(device->outputDevice->device, 1, &device->outputDevice->barrierFence, VK_TRUE, UINT64_MAX); return GN_SUCCESS; diff --git a/projects/apis/vulkan/src/vulkan_surface/vulkan_surface.h b/projects/apis/vulkan/src/vulkan_surface/vulkan_surface.h index 6a6ca14..54edcb3 100644 --- a/projects/apis/vulkan/src/vulkan_surface/vulkan_surface.h +++ b/projects/apis/vulkan/src/vulkan_surface/vulkan_surface.h @@ -4,6 +4,7 @@ typedef struct gnPlatformWindowSurface_t { VkSurfaceKHR surface; + uint32_t presentQueueIndex; } gnPlatformWindowSurface; VkFormat vkGryphnFormatToVulkanFormat(gnImageFormat format); diff --git a/projects/core/gryphn_extensions.h b/projects/core/gryphn_extensions.h index 158f042..ba37c3a 100644 --- a/projects/core/gryphn_extensions.h +++ b/projects/core/gryphn_extensions.h @@ -3,3 +3,4 @@ typedef uint32_t gnExtension; #define GN_EXT_SYNCHRONIZATION 0 +#define GN_EXT_QUEUES 1 diff --git a/projects/core/src/command/command_pool/gryphn_command_pool.h b/projects/core/src/command/command_pool/gryphn_command_pool.h index a40edd3..b49cb5f 100644 --- a/projects/core/src/command/command_pool/gryphn_command_pool.h +++ b/projects/core/src/command/command_pool/gryphn_command_pool.h @@ -1,5 +1,5 @@ #pragma once -#include "stdint.h" +// #include "stdint.h" #include #include "gryphn_handles.h" @@ -9,7 +9,7 @@ typedef enum gnCommandPoolFlags { } gnCommandPoolFlags; typedef struct gnCommandPoolInfo { - uint32_t queueIndex; + // uint32_t queueIndex; gnCommandPoolFlags flags; } gnCommandPoolInfo; diff --git a/projects/core/src/output_device/gryphn_output_device.h b/projects/core/src/output_device/gryphn_output_device.h index 9315e59..5d7fb05 100644 --- a/projects/core/src/output_device/gryphn_output_device.h +++ b/projects/core/src/output_device/gryphn_output_device.h @@ -2,15 +2,15 @@ #include #include -typedef struct gnDeviceQueueInfo { - int queueIndex; - int queueCount; - // float* queuePriority; -} gnDeviceQueueInfo; +// typedef struct gnDeviceQueueInfo { +// int queueIndex; +// int queueCount; +// // float* queuePriority; +// } gnDeviceQueueInfo; typedef struct gnOutputDeviceInfo { - uint32_t queueInfoCount; - gnDeviceQueueInfo* queueInfos; + // uint32_t queueInfoCount; + // gnDeviceQueueInfo* queueInfos; gnPhysicalDeviceFeatures enabledFeatures; gnPhysicalDevice physicalDevice; } gnOutputDeviceInfo; diff --git a/projects/core/src/output_device/gryphn_physical_output_device.c b/projects/core/src/output_device/gryphn_physical_output_device.c index 182cdc3..258bd03 100644 --- a/projects/core/src/output_device/gryphn_physical_output_device.c +++ b/projects/core/src/output_device/gryphn_physical_output_device.c @@ -59,4 +59,4 @@ int gnGetPresentQueueIndex(gnPhysicalDevice device, gnWindowSurfaceHandle window gnPhysicalDeviceProperties gnGetPhysicalDeviceProperties(gnPhysicalOutputDeviceHandle device) { return device->properties; } gnPhysicalDeviceFeatures gnGetPhysicalDeviceFeatures(gnPhysicalOutputDeviceHandle device) { return device->features; } -gnPhysicalDeviceQueueProperties gnGetPhysicalDeviceQueueProperties(gnPhysicalOutputDeviceHandle device) { return device->queueProperties; } +// gnPhysicalDeviceQueueProperties gnGetPhysicalDeviceQueueProperties(gnPhysicalOutputDeviceHandle device) { return device->queueProperties; } diff --git a/projects/core/src/output_device/gryphn_physical_output_device.h b/projects/core/src/output_device/gryphn_physical_output_device.h index c54f3fe..ff76818 100644 --- a/projects/core/src/output_device/gryphn_physical_output_device.h +++ b/projects/core/src/output_device/gryphn_physical_output_device.h @@ -28,29 +28,29 @@ typedef struct gnPhysicalDeviceFeatures { uint32_t maxPushConstantSize; } gnPhysicalDeviceFeatures; -typedef enum gnQueueTypeFlags { - GN_QUEUE_GRAPHICS = 1 << 0, - GN_QUEUE_COMPUTE = 1 << 1, - GN_QUEUE_TRANSFER = 1 << 2, - GN_QUEUE_SPARSE_BINDING = 1 << 3 -} gnQueueTypeFlags; +// typedef enum gnQueueTypeFlags { +// GN_QUEUE_GRAPHICS = 1 << 0, +// GN_QUEUE_COMPUTE = 1 << 1, +// GN_QUEUE_TRANSFER = 1 << 2, +// GN_QUEUE_SPARSE_BINDING = 1 << 3 +// } gnQueueTypeFlags; -typedef struct gnQueueProperties { - uint32_t queueCount; - gnQueueTypeFlags queueType; -} gnQueueProperties; +// typedef struct gnQueueProperties { +// uint32_t queueCount; +// gnQueueTypeFlags queueType; +// } gnQueueProperties; -typedef struct gnPhysicalDeviceQueueProperties { - uint32_t queueCount; - gnQueueProperties* queueProperties; -} gnPhysicalDeviceQueueProperties; +// typedef struct gnPhysicalDeviceQueueProperties { +// uint32_t queueCount; +// gnQueueProperties* queueProperties; +// } gnPhysicalDeviceQueueProperties; #ifdef GN_REVEAL_IMPL typedef struct gnPhysicalOutputDevice_t { struct gnPlatformPhysicalDevice_t* physicalDevice; gnPhysicalDeviceProperties properties; gnPhysicalDeviceFeatures features; - gnPhysicalDeviceQueueProperties queueProperties; + // gnPhysicalDeviceQueueProperties queueProperties; gnInstanceHandle instance; } gnPhysicalOutputDevice_t; @@ -61,7 +61,7 @@ gnBool gnQueueCanPresentToSurface(gnPhysicalOutputDeviceHandle device, uint32_t gnPhysicalDeviceProperties gnGetPhysicalDeviceProperties(gnPhysicalOutputDeviceHandle device); gnPhysicalDeviceFeatures gnGetPhysicalDeviceFeatures(gnPhysicalOutputDeviceHandle device); -gnPhysicalDeviceQueueProperties gnGetPhysicalDeviceQueueProperties(gnPhysicalOutputDeviceHandle device); +// gnPhysicalDeviceQueueProperties gnGetPhysicalDeviceQueueProperties(gnPhysicalOutputDeviceHandle device); gnBool gnHasGraphicsQueue(gnPhysicalOutputDeviceHandle device); gnBool gnHasPresentQueue(gnPhysicalOutputDeviceHandle device, gnWindowSurfaceHandle windowSurface); diff --git a/projects/core/src/present/gryphn_present.h b/projects/core/src/present/gryphn_present.h index 1d875a0..b050b4d 100644 --- a/projects/core/src/present/gryphn_present.h +++ b/projects/core/src/present/gryphn_present.h @@ -7,7 +7,7 @@ typedef struct gnPresentInfo { uint32_t presentationQueueCount; gnPresentationQueueHandle* presentationQueues; uint32_t* imageIndices; - uint32_t queueIndex; + // uint32_t queueIndex; } gnPresentInfo; gnReturnCode gnPresent(gnOutputDeviceHandle device, gnPresentInfo info); diff --git a/projects/core/src/presentation_queue/gryphn_presentation_queue.h b/projects/core/src/presentation_queue/gryphn_presentation_queue.h index 71921c5..f568694 100644 --- a/projects/core/src/presentation_queue/gryphn_presentation_queue.h +++ b/projects/core/src/presentation_queue/gryphn_presentation_queue.h @@ -10,8 +10,8 @@ typedef struct gnPresentationQueueInfo { gnWindowSurfaceHandle surface; gnSurfaceFormat format; gnImageSharingMode imageSharingMode; - uint32_t queueFamilyCount; - uint32_t* queueFamilies; + // uint32_t queueFamilyCount; + // uint32_t* queueFamilies; } gnPresentationQueueInfo; struct gnPlatformPresentationQueue_t; diff --git a/projects/core/src/submit/gryphn_submit.h b/projects/core/src/submit/gryphn_submit.h index 4ac8680..1f2419b 100644 --- a/projects/core/src/submit/gryphn_submit.h +++ b/projects/core/src/submit/gryphn_submit.h @@ -6,6 +6,6 @@ typedef struct gnSubmitInfo { uint32_t commandBufferCount; gnCommandBufferHandle* commandBuffers; - uint32_t queueIndex; + // uint32_t queueIndex; } gnSubmitInfo; gnReturnCode gnSubmit(gnOutputDevice device, gnSubmitInfo info); diff --git a/projects/core/src/window_surface/gryphn_surface.h b/projects/core/src/window_surface/gryphn_surface.h index d90562b..f3fb9f0 100644 --- a/projects/core/src/window_surface/gryphn_surface.h +++ b/projects/core/src/window_surface/gryphn_surface.h @@ -2,7 +2,6 @@ #include #include #include -#include "output_device/gryphn_physical_output_device.h" #include "utils/math/gryphn_vec2.h" typedef struct gnSurfaceFormat {