finish moving some stuff over to the extension

This commit is contained in:
Gregory Wells
2025-07-09 20:00:44 -04:00
parent 414717d211
commit 6e22c85e43
14 changed files with 92 additions and 24 deletions

View File

@@ -9,8 +9,6 @@
#include <uniforms/vulkan_uniform.h>
#include <commands/command_pool/vulkan_command_pool.h>
#include <buffers/vulkan_buffer.h>
#include <sync/semaphore/vulkan_semaphore.h>
#include <sync/fence/vulkan_fence.h>
#include <present/vulkan_present.h>
#include <submit/vulkan_submit.h>
#include <output_device/vulkan_output_devices.h>
@@ -18,7 +16,7 @@
gnDeviceFunctions loadVulkanDeviceFunctions() {
return (gnDeviceFunctions){
._gnCreatePresentationQueue = createPresentationQueue,
// ._gnPresentationQueueGetImageAsync = getPresentQueueImageAsync,
._gnPresentationQueueGetImage = getVulkanPresentQueueImage,
._gnDestroyPresentationQueue = destroyPresentationQueue,
._gnCreateShaderModule = createShaderModule,
@@ -36,9 +34,6 @@ gnDeviceFunctions loadVulkanDeviceFunctions() {
._gnCreateCommandPool = createCommandPool,
._gnDestroyCommandPool = destroyCommandPool,
// ._gnCreateSemaphore = createSemaphore,
// ._gnDestroySemaphore = destroySemaphore,
._gnCreateBuffer = createBuffer,
._gnBufferData = bufferData,
._gnBufferSubData = vulkanBufferSubData,
@@ -57,11 +52,6 @@ gnDeviceFunctions loadVulkanDeviceFunctions() {
._gnTextureData = textureData,
._gnDestroyTexture = destroyTexture,
// ._gnCreateFence = createFence,
// ._gnWaitForFence = waitForFence,
// ._gnResetFence = resetFence,
// ._gnDestroyFence = destroyFence,
._gnSubmit = submit,
._gnPresent = present,

View File

@@ -2,7 +2,9 @@
#include "loader/src/gryphn_instance_functions.h"
#include "loader/src/gryphn_device_functions.h"
#include "loader/src/gryphn_command_functions.h"
#include "extensions/synchronization/loader/sync_functions.h"
gnInstanceFunctions loadVulkanInstanceFunctions();
gnDeviceFunctions loadVulkanDeviceFunctions();
gnCommandFunctions loadVulkanCommandFunctions();
gnSyncExtFunctions loadVulkanSyncFunctions();

View File

@@ -0,0 +1,18 @@
#include "vulkan_loader.h"
#include <sync/semaphore/vulkan_semaphore.h>
#include <sync/fence/vulkan_fence.h>
#include "presentation_queue/vulkan_presentation_queue.h"
gnSyncExtFunctions loadVulkanSyncFunctions() {
return (gnSyncExtFunctions){
._gnPresentationQueueGetImageAsync = getPresentQueueImageAsync,
._gnCreateSemaphore = createSemaphore,
._gnDestroySemaphore = destroySemaphore,
._gnCreateFence = createFence,
._gnWaitForFence = waitForFence,
._gnResetFence = resetFence,
._gnDestroyFence = destroyFence,
};
}

View File

@@ -81,6 +81,18 @@ gnReturnCode createPresentationQueue(gnPresentationQueueHandle presentationQueue
return GN_SUCCESS;
}
gnReturnCode getVulkanPresentQueueImage(gnPresentationQueueHandle presentationQueue, uint32_t* imageIndex) {
VkResult result = vkAcquireNextImageKHR(
presentationQueue->outputDevice->outputDevice->device,
presentationQueue->presentationQueue->swapChain,
UINT64_MAX, VK_NULL_HANDLE, VK_NULL_HANDLE, imageIndex);
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;
}
gnReturnCode getPresentQueueImageAsync(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphore semaphore, uint32_t* imageIndex) {
VkResult result = vkAcquireNextImageKHR(
presentationQueue->outputDevice->outputDevice->device,

View File

@@ -10,5 +10,6 @@ typedef struct gnPlatformPresentationQueue_t {
} gnPlatformPresentationQueue;
gnReturnCode createPresentationQueue(gnPresentationQueueHandle presentationQueue, const gnDevice device, gnPresentationQueueInfo presentationInfo);
gnReturnCode getVulkanPresentQueueImage(gnPresentationQueueHandle presentationQueue, uint32_t* imageIndex);
gnReturnCode getPresentQueueImageAsync(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphore semaphore, uint32_t* imageIndex);
void destroyPresentationQueue(gnPresentationQueueHandle queue);