gnQueueSubmit
This commit is contained in:
@@ -1,8 +1,12 @@
|
|||||||
#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>
|
||||||
|
|
||||||
gnQueueExtFunctions loadVulkanQueueFunctions() {
|
gnQueueExtFunctions loadVulkanQueueFunctions() {
|
||||||
return (gnQueueExtFunctions) {
|
return (gnQueueExtFunctions) {
|
||||||
._gnGetPhysicalDeviceQueueProperties = vulkanPhysicalDeviceQueueProperties
|
._gnGetPhysicalDeviceQueueProperties = vulkanPhysicalDeviceQueueProperties,
|
||||||
|
._gnQueueSubmit = vulkanSubmitQueue,
|
||||||
|
._gnQueueSubmitSync = vulkanSubmitSyncQueue,
|
||||||
|
._gnGetDeviceQueue = getVulkanDeviceQueue
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ gnReturnCode vulkanPhysicalDeviceQueueProperties(gnPhysicalOutputDeviceHandle de
|
|||||||
return GN_SUCCESS;
|
return GN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gnGetDeviceQueue(gnOutputDevice device, uint32_t queueFamily, uint32_t queueIndex, gnQueue* queue) {
|
void getVulkanDeviceQueue(gnOutputDevice device, uint32_t queueFamily, uint32_t queueIndex, gnQueue* queue) {
|
||||||
VkQueue vulkanQueue;
|
VkQueue vulkanQueue;
|
||||||
vkGetDeviceQueue(device->outputDevice->device, queueFamily, queueIndex, &vulkanQueue);
|
vkGetDeviceQueue(device->outputDevice->device, queueFamily, queueIndex, &vulkanQueue);
|
||||||
*queue = (uint64_t)vulkanQueue;
|
*queue = (uint64_t)vulkanQueue;
|
||||||
|
@@ -5,3 +5,4 @@
|
|||||||
#include <extensions/queues/gryphn_physcial_device_queue.h>
|
#include <extensions/queues/gryphn_physcial_device_queue.h>
|
||||||
|
|
||||||
gnReturnCode vulkanPhysicalDeviceQueueProperties(gnPhysicalOutputDeviceHandle device, uint32_t queueFamilyCount, gnQueueFamilyProperties* queues);
|
gnReturnCode vulkanPhysicalDeviceQueueProperties(gnPhysicalOutputDeviceHandle device, uint32_t queueFamilyCount, gnQueueFamilyProperties* queues);
|
||||||
|
void getVulkanDeviceQueue(gnOutputDevice device, uint32_t queueFamily, uint32_t queueIndex, gnQueue* queue);
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#include "vulkan_submit.h"
|
#include "vulkan_submit.h"
|
||||||
|
|
||||||
gnReturnCode vulkanSubmitSync(gnDevice device, gnSubmitSyncInfo info) {
|
gnReturnCode vulkanSubmitSyncQueue(gnOutputDevice device, gnQueue queue, gnSubmitSyncInfo info) {
|
||||||
VkSemaphore* waitSemaphores = malloc(sizeof(VkSemaphore) * info.waitCount);
|
VkSemaphore* waitSemaphores = malloc(sizeof(VkSemaphore) * info.waitCount);
|
||||||
VkPipelineStageFlags* waitStages = malloc(sizeof(VkPipelineStageFlags) * info.waitCount);
|
VkPipelineStageFlags* waitStages = malloc(sizeof(VkPipelineStageFlags) * 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;
|
||||||
@@ -23,10 +23,7 @@ gnReturnCode vulkanSubmitSync(gnDevice device, gnSubmitSyncInfo info) {
|
|||||||
.pSignalSemaphores = signalSemaphores
|
.pSignalSemaphores = signalSemaphores
|
||||||
};
|
};
|
||||||
|
|
||||||
VkQueue queue;
|
if (vkQueueSubmit((VkQueue)queue, 1, &submitInfo, info.fence->fence->fence) != VK_SUCCESS) {
|
||||||
vkGetDeviceQueue(device->outputDevice->device, info.queueIndex, 0, &queue);
|
|
||||||
|
|
||||||
if (vkQueueSubmit(device->outputDevice->queues[device->outputDevice->graphicsQueueIndex].queue, 1, &submitInfo, info.fence->fence->fence) != VK_SUCCESS) {
|
|
||||||
free(waitSemaphores);
|
free(waitSemaphores);
|
||||||
free(waitStages);
|
free(waitStages);
|
||||||
free(commandBuffers);
|
free(commandBuffers);
|
||||||
@@ -40,7 +37,11 @@ gnReturnCode vulkanSubmitSync(gnDevice device, gnSubmitSyncInfo info) {
|
|||||||
return GN_SUCCESS;
|
return GN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
gnReturnCode vulkanSubmit(gnDevice device, gnSubmitInfo info) {
|
gnReturnCode vulkanSubmitSync(gnDevice device, gnSubmitSyncInfo info) {
|
||||||
|
return vulkanSubmitSyncQueue(device, (gnQueue)device->outputDevice->queues[device->outputDevice->graphicsQueueIndex].queue, info);
|
||||||
|
}
|
||||||
|
|
||||||
|
gnReturnCode vulkanSubmitQueue(gnOutputDevice device, gnQueue queue, gnSubmitInfo info) {
|
||||||
VkCommandBuffer* commandBuffers = malloc(sizeof(VkCommandBuffer) * info.commandBufferCount);
|
VkCommandBuffer* commandBuffers = malloc(sizeof(VkCommandBuffer) * info.commandBufferCount);
|
||||||
for (int i = 0; i < info.commandBufferCount; i++) commandBuffers[i] = info.commandBuffers[i]->commandBuffer->buffer;
|
for (int i = 0; i < info.commandBufferCount; i++) commandBuffers[i] = info.commandBuffers[i]->commandBuffer->buffer;
|
||||||
|
|
||||||
@@ -56,8 +57,12 @@ gnReturnCode vulkanSubmit(gnDevice device, gnSubmitInfo info) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
vkResetFences(device->outputDevice->device, 1, &device->outputDevice->barrierFence);
|
vkResetFences(device->outputDevice->device, 1, &device->outputDevice->barrierFence);
|
||||||
if (vkQueueSubmit(device->outputDevice->queues[device->outputDevice->graphicsQueueIndex].queue, 1, &submitInfo, device->outputDevice->barrierFence) != VK_SUCCESS)
|
if (vkQueueSubmit((VkQueue)queue, 1, &submitInfo, device->outputDevice->barrierFence) != VK_SUCCESS)
|
||||||
return GN_FAILED_TO_SUBMIT_COMMAND_BUFFER;
|
return GN_FAILED_TO_SUBMIT_COMMAND_BUFFER;
|
||||||
vkWaitForFences(device->outputDevice->device, 1, &device->outputDevice->barrierFence, VK_TRUE, UINT64_MAX);
|
vkWaitForFences(device->outputDevice->device, 1, &device->outputDevice->barrierFence, VK_TRUE, UINT64_MAX);
|
||||||
return GN_SUCCESS;
|
return GN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gnReturnCode vulkanSubmit(gnDevice device, gnSubmitInfo info) {
|
||||||
|
return vulkanSubmitQueue(device, (gnQueue)device->outputDevice->queues[device->outputDevice->graphicsQueueIndex].queue, info);
|
||||||
|
}
|
||||||
|
@@ -7,5 +7,7 @@
|
|||||||
#include <renderpass/vulkan_render_pass_descriptor.h>
|
#include <renderpass/vulkan_render_pass_descriptor.h>
|
||||||
#include "extensions/synchronization/commands/gryphn_sync_submit.h"
|
#include "extensions/synchronization/commands/gryphn_sync_submit.h"
|
||||||
|
|
||||||
|
gnReturnCode vulkanSubmitSyncQueue(gnOutputDevice device, gnQueue queue, gnSubmitSyncInfo info);
|
||||||
gnReturnCode vulkanSubmitSync(gnDevice device, gnSubmitSyncInfo info);
|
gnReturnCode vulkanSubmitSync(gnDevice device, gnSubmitSyncInfo info);
|
||||||
|
gnReturnCode vulkanSubmitQueue(gnOutputDevice device, gnQueue queue, gnSubmitInfo info);
|
||||||
gnReturnCode vulkanSubmit(gnDevice device, gnSubmitInfo info);
|
gnReturnCode vulkanSubmit(gnDevice device, gnSubmitInfo info);
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include <extensions/synchronization/commands/gryphn_sync_submit.h>
|
||||||
|
#include <core/src/submit/gryphn_submit.h>
|
||||||
|
|
||||||
typedef struct gnQueueSubmitInfo {
|
gnReturnCode gnQueueSubmit(gnOutputDevice device, gnQueue queue, gnSubmitInfo info);
|
||||||
|
gnReturnCode gnQueueSubmitSync(gnOutputDevice device, gnQueue queue, gnSubmitSyncInfo info);
|
||||||
} gnQueueSubmitInfo;
|
|
||||||
|
@@ -4,8 +4,13 @@
|
|||||||
#include "core/src/gryphn_handles.h"
|
#include "core/src/gryphn_handles.h"
|
||||||
|
|
||||||
typedef struct gnQueueFamilyProperties gnQueueFamilyProperties;
|
typedef struct gnQueueFamilyProperties gnQueueFamilyProperties;
|
||||||
|
typedef struct gnSubmitInfo gnSubmitInfo;
|
||||||
|
typedef struct gnSubmitSyncInfo gnSubmitSyncInfo;
|
||||||
|
|
||||||
typedef struct gnQueueExtFunctions {
|
typedef struct gnQueueExtFunctions {
|
||||||
gnReturnCode (*_gnGetPhysicalDeviceQueueProperties)(gnPhysicalOutputDeviceHandle device, uint32_t queueCount, gnQueueFamilyProperties* queues);
|
gnReturnCode (*_gnGetPhysicalDeviceQueueProperties)(gnPhysicalOutputDeviceHandle device, uint32_t queueCount, gnQueueFamilyProperties* queues);
|
||||||
void (*_gnGetDeviceQueue)(gnOutputDevice device, uint32_t queueFamily, uint32_t queueIndex, gnQueue* queue);
|
void (*_gnGetDeviceQueue)(gnOutputDevice device, uint32_t queueFamily, uint32_t queueIndex, gnQueue* queue);
|
||||||
|
|
||||||
|
gnReturnCode (*_gnQueueSubmit)(gnOutputDevice device, gnQueue queue, gnSubmitInfo info);
|
||||||
|
gnReturnCode (*_gnQueueSubmitSync)(gnOutputDevice device, gnQueue queue, gnSubmitSyncInfo info);
|
||||||
} gnQueueExtFunctions;
|
} gnQueueExtFunctions;
|
||||||
|
@@ -2,8 +2,6 @@
|
|||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
#include "core/src/renderpass/gryphn_render_pass_descriptor.h"
|
#include "core/src/renderpass/gryphn_render_pass_descriptor.h"
|
||||||
#include "core/src/gryphn_handles.h"
|
#include "core/src/gryphn_handles.h"
|
||||||
#include "extensions/synchronization/semaphore/gryphn_semaphore.h"
|
|
||||||
#include "extensions/synchronization/fence/gryphn_fence.h"
|
|
||||||
|
|
||||||
typedef struct gnSubmitSyncInfo {
|
typedef struct gnSubmitSyncInfo {
|
||||||
uint32_t waitCount;
|
uint32_t waitCount;
|
||||||
|
Reference in New Issue
Block a user