GN_EXT_QUEUES done, untested
This commit is contained in:
@@ -1,12 +1,15 @@
|
|||||||
#include "vulkan_loader.h"
|
#include "vulkan_loader.h"
|
||||||
#include "extensions/queues/vulkan_device_queues.h"
|
#include "extensions/queues/vulkan_device_queues.h"
|
||||||
#include <submit/vulkan_submit.h>
|
#include <submit/vulkan_submit.h>
|
||||||
|
#include <present/vulkan_present.h>
|
||||||
|
|
||||||
gnQueueExtFunctions loadVulkanQueueFunctions() {
|
gnQueueExtFunctions loadVulkanQueueFunctions() {
|
||||||
return (gnQueueExtFunctions) {
|
return (gnQueueExtFunctions) {
|
||||||
._gnGetPhysicalDeviceQueueProperties = vulkanPhysicalDeviceQueueProperties,
|
._gnGetPhysicalDeviceQueueProperties = vulkanPhysicalDeviceQueueProperties,
|
||||||
._gnQueueSubmit = vulkanSubmitQueue,
|
._gnQueueSubmit = vulkanSubmitQueue,
|
||||||
._gnQueueSubmitSync = vulkanSubmitSyncQueue,
|
._gnQueueSubmitSync = vulkanSubmitSyncQueue,
|
||||||
._gnGetDeviceQueue = getVulkanDeviceQueue
|
._gnGetDeviceQueue = getVulkanDeviceQueue,
|
||||||
|
._gnQueuePresent = vulkanQueuePresent,
|
||||||
|
._gnQueuePresentSync = vulkanQueuePresentSync
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
#include "extensions/synchronization/commands/gryphn_sync_present.h"
|
#include "extensions/synchronization/commands/gryphn_sync_present.h"
|
||||||
#include "vulkan_surface/vulkan_surface.h"
|
#include "vulkan_surface/vulkan_surface.h"
|
||||||
|
|
||||||
gnReturnCode vulkanPresentSync(gnDevice device, gnPresentSyncInfo info) {
|
gnReturnCode vulkanQueuePresentSync(gnDevice device, gnQueue queue, gnPresentSyncInfo info) {
|
||||||
VkSemaphore* waitSemaphores = malloc(sizeof(VkSemaphore) * info.waitCount);
|
VkSemaphore* waitSemaphores = malloc(sizeof(VkSemaphore) * info.waitCount);
|
||||||
for (int i = 0; i < info.waitCount; i++) waitSemaphores[i] = info.waitSemaphores[i]->semaphore->semaphore;
|
for (int i = 0; i < info.waitCount; i++) waitSemaphores[i] = info.waitSemaphores[i]->semaphore->semaphore;
|
||||||
|
|
||||||
@@ -18,14 +18,17 @@ gnReturnCode vulkanPresentSync(gnDevice device, gnPresentSyncInfo info) {
|
|||||||
.pImageIndices = info.imageIndices
|
.pImageIndices = info.imageIndices
|
||||||
};
|
};
|
||||||
|
|
||||||
VkResult result = vkQueuePresentKHR(device->outputDevice->queues[info.presentationQueues[0]->info.surface->windowSurface->presentQueueIndex].queue, &presentInfo);
|
VkResult result = vkQueuePresentKHR((VkQueue)queue, &presentInfo);
|
||||||
if (result == VK_ERROR_OUT_OF_DATE_KHR) return GN_OUT_OF_DATE_PRESENTATION_QUEUE;
|
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;
|
if (result == VK_SUBOPTIMAL_KHR) return GN_SUBOPTIMAL_PRESENTATION_QUEUE;
|
||||||
return GN_SUCCESS;
|
return GN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gnReturnCode vulkanPresentSync(gnDevice device, gnPresentSyncInfo info) {
|
||||||
|
return vulkanQueuePresentSync(device, (gnQueue)device->outputDevice->queues[info.presentationQueues[0]->info.surface->windowSurface->presentQueueIndex].queue, info);
|
||||||
|
}
|
||||||
|
|
||||||
gnReturnCode vulkanPresent(gnDevice device, gnPresentInfo info) {
|
gnReturnCode vulkanQueuePresent(gnDevice device, gnQueue queue, gnPresentInfo info) {
|
||||||
VkSwapchainKHR* swapchains = malloc(sizeof(VkSwapchainKHR) * info.presentationQueueCount);
|
VkSwapchainKHR* swapchains = malloc(sizeof(VkSwapchainKHR) * info.presentationQueueCount);
|
||||||
for (int i = 0; i < info.presentationQueueCount; i++) swapchains[i] = info.presentationQueues[i]->presentationQueue->swapChain;
|
for (int i = 0; i < info.presentationQueueCount; i++) swapchains[i] = info.presentationQueues[i]->presentationQueue->swapChain;
|
||||||
|
|
||||||
@@ -38,8 +41,12 @@ gnReturnCode vulkanPresent(gnDevice device, gnPresentInfo info) {
|
|||||||
.pImageIndices = info.imageIndices
|
.pImageIndices = info.imageIndices
|
||||||
};
|
};
|
||||||
|
|
||||||
VkResult result = vkQueuePresentKHR(device->outputDevice->queues[info.presentationQueues[0]->info.surface->windowSurface->presentQueueIndex].queue, &presentInfo);
|
VkResult result = vkQueuePresentKHR((VkQueue)queue, &presentInfo);
|
||||||
if (result == VK_ERROR_OUT_OF_DATE_KHR) return GN_OUT_OF_DATE_PRESENTATION_QUEUE;
|
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;
|
if (result == VK_SUBOPTIMAL_KHR) return GN_SUBOPTIMAL_PRESENTATION_QUEUE;
|
||||||
return GN_SUCCESS;
|
return GN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gnReturnCode vulkanPresent(gnDevice device, gnPresentInfo info) {
|
||||||
|
return vulkanQueuePresent(device, (gnQueue)device->outputDevice->queues[info.presentationQueues[0]->info.surface->windowSurface->presentQueueIndex].queue, info);
|
||||||
|
}
|
||||||
|
@@ -4,4 +4,6 @@
|
|||||||
#include <output_device/vulkan_output_devices.h>
|
#include <output_device/vulkan_output_devices.h>
|
||||||
|
|
||||||
gnReturnCode vulkanPresentSync(gnDevice device, gnPresentSyncInfo info);
|
gnReturnCode vulkanPresentSync(gnDevice device, gnPresentSyncInfo info);
|
||||||
|
gnReturnCode vulkanQueuePresentSync(gnDevice device, gnQueue queue, gnPresentSyncInfo info);
|
||||||
gnReturnCode vulkanPresent(gnDevice device, gnPresentInfo info);
|
gnReturnCode vulkanPresent(gnDevice device, gnPresentInfo info);
|
||||||
|
gnReturnCode vulkanQueuePresent(gnOutputDevice device, gnQueue queue, gnPresentInfo info);
|
||||||
|
6
projects/extensions/queues/gryphn_queue_present.h
Normal file
6
projects/extensions/queues/gryphn_queue_present.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <extensions/synchronization/commands/gryphn_sync_present.h>
|
||||||
|
#include <core/src/present/gryphn_present.h>
|
||||||
|
|
||||||
|
gnReturnCode gnQueuePresent(gnDevice device, gnQueue queue, gnPresentInfo info);
|
||||||
|
gnReturnCode gnQueuePresentSync(gnDevice device, gnQueue queue, gnPresentSyncInfo info);
|
@@ -6,6 +6,8 @@
|
|||||||
typedef struct gnQueueFamilyProperties gnQueueFamilyProperties;
|
typedef struct gnQueueFamilyProperties gnQueueFamilyProperties;
|
||||||
typedef struct gnSubmitInfo gnSubmitInfo;
|
typedef struct gnSubmitInfo gnSubmitInfo;
|
||||||
typedef struct gnSubmitSyncInfo gnSubmitSyncInfo;
|
typedef struct gnSubmitSyncInfo gnSubmitSyncInfo;
|
||||||
|
typedef struct gnPresentInfo gnPresentInfo;
|
||||||
|
typedef struct gnPresentSyncInfo gnPresentSyncInfo;
|
||||||
|
|
||||||
typedef struct gnQueueExtFunctions {
|
typedef struct gnQueueExtFunctions {
|
||||||
gnReturnCode (*_gnGetPhysicalDeviceQueueProperties)(gnPhysicalOutputDeviceHandle device, uint32_t queueCount, gnQueueFamilyProperties* queues);
|
gnReturnCode (*_gnGetPhysicalDeviceQueueProperties)(gnPhysicalOutputDeviceHandle device, uint32_t queueCount, gnQueueFamilyProperties* queues);
|
||||||
@@ -13,4 +15,7 @@ typedef struct gnQueueExtFunctions {
|
|||||||
|
|
||||||
gnReturnCode (*_gnQueueSubmit)(gnOutputDevice device, gnQueue queue, gnSubmitInfo info);
|
gnReturnCode (*_gnQueueSubmit)(gnOutputDevice device, gnQueue queue, gnSubmitInfo info);
|
||||||
gnReturnCode (*_gnQueueSubmitSync)(gnOutputDevice device, gnQueue queue, gnSubmitSyncInfo info);
|
gnReturnCode (*_gnQueueSubmitSync)(gnOutputDevice device, gnQueue queue, gnSubmitSyncInfo info);
|
||||||
|
|
||||||
|
gnReturnCode (*_gnQueuePresent)(gnDevice device, gnQueue queue, gnPresentInfo info);
|
||||||
|
gnReturnCode (*_gnQueuePresentSync)(gnDevice device, gnQueue queue, gnPresentSyncInfo info);
|
||||||
} gnQueueExtFunctions;
|
} gnQueueExtFunctions;
|
||||||
|
@@ -2,7 +2,6 @@
|
|||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
#include "utils/gryphn_error_code.h"
|
#include "utils/gryphn_error_code.h"
|
||||||
#include "gryphn_handles.h"
|
#include "gryphn_handles.h"
|
||||||
#include "extensions/synchronization/semaphore/gryphn_semaphore.h"
|
|
||||||
|
|
||||||
typedef struct gnPresentSyncInfo {
|
typedef struct gnPresentSyncInfo {
|
||||||
uint32_t waitCount;
|
uint32_t waitCount;
|
||||||
|
Reference in New Issue
Block a user