From ab73e2e051ef8711b9af62e8e10fc8b189aa6b71 Mon Sep 17 00:00:00 2001 From: Greg Wells Date: Tue, 27 May 2025 12:38:32 -0400 Subject: [PATCH] get images from swapchain in vulkan --- .../src/presentation_queue/vulkan_presentation_queue.c | 4 ++++ .../src/presentation_queue/vulkan_presentation_queue.h | 5 +---- src/core/presentation_queue/gryphn_presentation_queue.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/rendering_api/vulkan/src/presentation_queue/vulkan_presentation_queue.c b/rendering_api/vulkan/src/presentation_queue/vulkan_presentation_queue.c index 3c40e67..0a33c00 100644 --- a/rendering_api/vulkan/src/presentation_queue/vulkan_presentation_queue.c +++ b/rendering_api/vulkan/src/presentation_queue/vulkan_presentation_queue.c @@ -74,6 +74,10 @@ gnReturnCode gnCreatePresentationQueueFn(gnPresentationQueue* presentationQueue, return GN_FAILED_TO_CREATE_PRESENTATION_QUEUE; } + vkGetSwapchainImagesKHR(device->outputDevice->device, presentationQueue->presentationQueue->swapChain, &presentationQueue->imageCount, NULL); + presentationQueue->presentationQueue->swapChainImages = malloc(sizeof(VkImage) * presentationQueue->imageCount); + vkGetSwapchainImagesKHR(device->outputDevice->device, presentationQueue->presentationQueue->swapChain, &presentationQueue->imageCount, presentationQueue->presentationQueue->swapChainImages); + return GN_SUCCESS; } diff --git a/rendering_api/vulkan/src/presentation_queue/vulkan_presentation_queue.h b/rendering_api/vulkan/src/presentation_queue/vulkan_presentation_queue.h index 3886ea2..161b9be 100644 --- a/rendering_api/vulkan/src/presentation_queue/vulkan_presentation_queue.h +++ b/rendering_api/vulkan/src/presentation_queue/vulkan_presentation_queue.h @@ -4,9 +4,6 @@ typedef struct gnPlatformPresentationQueue_t { VkSwapchainKHR swapChain; - // VkDevice* device; - // gnOutputDevice* outputDevice; - // vulkanSwapchainDetails swapchainDetails; - // VkResult result; + VkImage* swapChainImages; } gnPlatformPresentationQueue; diff --git a/src/core/presentation_queue/gryphn_presentation_queue.h b/src/core/presentation_queue/gryphn_presentation_queue.h index eefb066..39985fe 100644 --- a/src/core/presentation_queue/gryphn_presentation_queue.h +++ b/src/core/presentation_queue/gryphn_presentation_queue.h @@ -20,7 +20,7 @@ typedef struct gnPresentationQueue_t { struct gnPlatformPresentationQueue_t* presentationQueue; struct gnOutputDevice_t* outputDevice; gnBool valid; - int imageCount; + uint32_t imageCount; } gnPresentationQueue; gnReturnCode gnCreatePresentationQueue(gnPresentationQueue* presentationQueue, struct gnOutputDevice_t* device, struct gnPresentationQueueInfo_t presentationInfo);