|
|
|
@@ -1,6 +1,6 @@
|
|
|
|
|
#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);
|
|
|
|
|
VkPipelineStageFlags* waitStages = malloc(sizeof(VkPipelineStageFlags) * info.waitCount);
|
|
|
|
|
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
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
VkQueue queue;
|
|
|
|
|
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) {
|
|
|
|
|
if (vkQueueSubmit((VkQueue)queue, 1, &submitInfo, info.fence->fence->fence) != VK_SUCCESS) {
|
|
|
|
|
free(waitSemaphores);
|
|
|
|
|
free(waitStages);
|
|
|
|
|
free(commandBuffers);
|
|
|
|
@@ -40,7 +37,11 @@ gnReturnCode vulkanSubmitSync(gnDevice device, gnSubmitSyncInfo info) {
|
|
|
|
|
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);
|
|
|
|
|
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);
|
|
|
|
|
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;
|
|
|
|
|
vkWaitForFences(device->outputDevice->device, 1, &device->outputDevice->barrierFence, VK_TRUE, UINT64_MAX);
|
|
|
|
|
return GN_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gnReturnCode vulkanSubmit(gnDevice device, gnSubmitInfo info) {
|
|
|
|
|
return vulkanSubmitQueue(device, (gnQueue)device->outputDevice->queues[device->outputDevice->graphicsQueueIndex].queue, info);
|
|
|
|
|
}
|
|
|
|
|