move present over to sync extension
This commit is contained in:
@@ -53,7 +53,7 @@ gnDeviceFunctions loadVulkanDeviceFunctions() {
|
||||
._gnDestroyTexture = destroyTexture,
|
||||
|
||||
._gnSubmit = vulkanSubmit,
|
||||
._gnPresent = present,
|
||||
._gnPresent = vulkanPresent,
|
||||
|
||||
._gnWaitForDevice = waitForDevice
|
||||
};
|
||||
|
@@ -3,6 +3,7 @@
|
||||
#include <sync/fence/vulkan_fence.h>
|
||||
#include "presentation_queue/vulkan_presentation_queue.h"
|
||||
#include "submit/vulkan_submit.h"
|
||||
#include "present/vulkan_present.h"
|
||||
|
||||
gnSyncExtFunctions loadVulkanSyncFunctions() {
|
||||
return (gnSyncExtFunctions){
|
||||
@@ -16,6 +17,7 @@ gnSyncExtFunctions loadVulkanSyncFunctions() {
|
||||
._gnResetFence = resetFence,
|
||||
._gnDestroyFence = destroyFence,
|
||||
|
||||
._gnSubmitSync = vulkanSubmitSync
|
||||
._gnSubmitSync = vulkanSubmitSync,
|
||||
._gnPresentSync = vulkanPresentSync
|
||||
};
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
#include "vulkan_present.h"
|
||||
#include "extensions/synchronization/commands/gryphn_sync_present.h"
|
||||
|
||||
gnReturnCode present(gnDevice device, gnPresentInfo info) {
|
||||
gnReturnCode vulkanPresentSync(gnDevice device, gnPresentSyncInfo info) {
|
||||
VkSemaphore* waitSemaphores = malloc(sizeof(VkSemaphore) * info.waitCount);
|
||||
for (int i = 0; i < info.waitCount; i++) waitSemaphores[i] = info.waitSemaphores[i]->semaphore->semaphore;
|
||||
|
||||
@@ -24,3 +25,26 @@ gnReturnCode present(gnDevice device, gnPresentInfo info) {
|
||||
if (result == VK_SUBOPTIMAL_KHR) return GN_SUBOPTIMAL_PRESENTATION_QUEUE;
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
gnReturnCode vulkanPresent(gnDevice device, gnPresentInfo info) {
|
||||
VkSwapchainKHR* swapchains = malloc(sizeof(VkSwapchainKHR) * info.presentationQueueCount);
|
||||
for (int i = 0; i < info.presentationQueueCount; i++) swapchains[i] = info.presentationQueues[i]->presentationQueue->swapChain;
|
||||
|
||||
VkPresentInfoKHR presentInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR,
|
||||
.waitSemaphoreCount = 0,
|
||||
.pWaitSemaphores = NULL,
|
||||
.swapchainCount = info.presentationQueueCount,
|
||||
.pSwapchains = swapchains,
|
||||
.pImageIndices = info.imageIndices
|
||||
};
|
||||
|
||||
VkQueue queue;
|
||||
vkGetDeviceQueue(device->outputDevice->device, info.queueIndex, 0, &queue);
|
||||
|
||||
VkResult result = vkQueuePresentKHR(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;
|
||||
}
|
||||
|
@@ -3,4 +3,5 @@
|
||||
#include <presentation_queue/vulkan_presentation_queue.h>
|
||||
#include <output_device/vulkan_output_devices.h>
|
||||
|
||||
gnReturnCode present(gnDevice device, gnPresentInfo info);
|
||||
gnReturnCode vulkanPresentSync(gnDevice device, gnPresentSyncInfo info);
|
||||
gnReturnCode vulkanPresent(gnDevice device, gnPresentInfo info);
|
||||
|
Reference in New Issue
Block a user