submit command moved to sync extension
This commit is contained in:
@@ -28,3 +28,4 @@
|
||||
#include <extensions/synchronization/fence/gryphn_fence.h>
|
||||
#include <extensions/synchronization/semaphore/gryphn_semaphore.h>
|
||||
#include <extensions/synchronization/gryphn_synced_presentation_queue.h>
|
||||
#include <extensions/synchronization/commands/gryphn_sync_submit.h>
|
||||
|
@@ -52,7 +52,7 @@ gnDeviceFunctions loadVulkanDeviceFunctions() {
|
||||
._gnTextureData = textureData,
|
||||
._gnDestroyTexture = destroyTexture,
|
||||
|
||||
._gnSubmit = submit,
|
||||
._gnSubmit = vulkanSubmit,
|
||||
._gnPresent = present,
|
||||
|
||||
._gnWaitForDevice = waitForDevice
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include <sync/semaphore/vulkan_semaphore.h>
|
||||
#include <sync/fence/vulkan_fence.h>
|
||||
#include "presentation_queue/vulkan_presentation_queue.h"
|
||||
#include "submit/vulkan_submit.h"
|
||||
|
||||
gnSyncExtFunctions loadVulkanSyncFunctions() {
|
||||
return (gnSyncExtFunctions){
|
||||
@@ -14,5 +15,7 @@ gnSyncExtFunctions loadVulkanSyncFunctions() {
|
||||
._gnWaitForFence = waitForFence,
|
||||
._gnResetFence = resetFence,
|
||||
._gnDestroyFence = destroyFence,
|
||||
|
||||
._gnSubmitSync = vulkanSubmitSync
|
||||
};
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
#include "vulkan_submit.h"
|
||||
|
||||
|
||||
gnReturnCode submit(gnDevice device, gnSubmitInfo info) {
|
||||
gnReturnCode vulkanSubmitSync(gnDevice device, 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;
|
||||
@@ -40,3 +39,26 @@ gnReturnCode submit(gnDevice device, gnSubmitInfo info) {
|
||||
free(signalSemaphores);
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
|
||||
gnReturnCode vulkanSubmit(gnDevice device, gnSubmitInfo info) {
|
||||
VkCommandBuffer* commandBuffers = malloc(sizeof(VkCommandBuffer) * info.commandBufferCount);
|
||||
for (int i = 0; i < info.commandBufferCount; i++) commandBuffers[i] = info.commandBuffers[i]->commandBuffer->buffer;
|
||||
|
||||
VkSubmitInfo submitInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
|
||||
.waitSemaphoreCount = 0,
|
||||
.pWaitSemaphores = NULL,
|
||||
.pWaitDstStageMask = NULL,
|
||||
.commandBufferCount = info.commandBufferCount,
|
||||
.pCommandBuffers = commandBuffers,
|
||||
.signalSemaphoreCount = 0,
|
||||
.pSignalSemaphores = NULL
|
||||
};
|
||||
|
||||
VkQueue queue;
|
||||
vkGetDeviceQueue(device->outputDevice->device, info.queueIndex, 0, &queue);
|
||||
|
||||
if (vkQueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE) != VK_SUCCESS)
|
||||
return GN_FAILED_TO_SUBMIT_COMMAND_BUFFER;
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
|
@@ -5,5 +5,7 @@
|
||||
#include <commands/command_buffer/vulkan_command_buffer.h>
|
||||
#include <output_device/vulkan_output_devices.h>
|
||||
#include <renderpass/vulkan_render_pass_descriptor.h>
|
||||
#include "extensions/synchronization/commands/gryphn_sync_submit.h"
|
||||
|
||||
gnReturnCode submit(gnDevice device, gnSubmitInfo info);
|
||||
gnReturnCode vulkanSubmitSync(gnDevice device, gnSubmitSyncInfo info);
|
||||
gnReturnCode vulkanSubmit(gnDevice device, gnSubmitInfo info);
|
||||
|
@@ -1,18 +1,11 @@
|
||||
#pragma once
|
||||
#include "stdint.h"
|
||||
#include "renderpass/gryphn_render_pass_descriptor.h"
|
||||
#include "utils/gryphn_error_code.h"
|
||||
#include "gryphn_handles.h"
|
||||
|
||||
typedef struct gnSubmitInfo {
|
||||
uint32_t waitCount;
|
||||
gnRenderPassStage* waitStages;
|
||||
gnSemaphoreHandle* waitSemaphores;
|
||||
uint32_t signalCount;
|
||||
gnSemaphoreHandle* signalSemaphores;
|
||||
uint32_t commandBufferCount;
|
||||
gnCommandBufferHandle* commandBuffers;
|
||||
uint32_t queueIndex;
|
||||
gnFenceHandle fence;
|
||||
} gnSubmitInfo;
|
||||
|
||||
gnReturnCode gnSubmit(gnOutputDevice device, gnSubmitInfo info);
|
||||
|
@@ -0,0 +1,7 @@
|
||||
#include "gryphn_sync_submit.h"
|
||||
#include "core/src/output_device/gryphn_output_device.h"
|
||||
#include "core/src/instance/gryphn_instance.h"
|
||||
|
||||
gnReturnCode gnSubmitSync(gnOutputDevice device, gnSubmitSyncInfo info) {
|
||||
return device->instance->callingLayer->syncFunctions._gnSubmitSync(device, info);
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include "stdint.h"
|
||||
#include "core/src/renderpass/gryphn_render_pass_descriptor.h"
|
||||
#include "core/src/gryphn_handles.h"
|
||||
|
||||
typedef struct gnSubmitSyncInfo {
|
||||
uint32_t waitCount;
|
||||
gnRenderPassStage* waitStages;
|
||||
gnSemaphoreHandle* waitSemaphores;
|
||||
uint32_t signalCount;
|
||||
gnSemaphoreHandle* signalSemaphores;
|
||||
uint32_t commandBufferCount;
|
||||
gnCommandBufferHandle* commandBuffers;
|
||||
uint32_t queueIndex;
|
||||
gnFenceHandle fence;
|
||||
} gnSubmitSyncInfo;
|
||||
|
||||
gnReturnCode gnSubmitSync(gnOutputDevice device, gnSubmitSyncInfo info);
|
@@ -3,15 +3,18 @@
|
||||
#include "utils/gryphn_error_code.h"
|
||||
#include "core/src/gryphn_handles.h"
|
||||
|
||||
typedef struct gnSubmitSyncInfo gnSubmitSyncInfo;
|
||||
|
||||
typedef struct gnSyncExtFunctions {
|
||||
gnReturnCode (*_gnPresentationQueueGetImageAsync)(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphoreHandle semaphore, uint32_t* imageIndex);
|
||||
|
||||
gnReturnCode (*_gnCreateSemaphore)(gnSemaphoreHandle semaphore, gnOutputDeviceHandle device);
|
||||
void (*_gnDestroySemaphore)(gnSemaphoreHandle semaphore);
|
||||
|
||||
|
||||
gnReturnCode (*_gnCreateFence)(gnFenceHandle fence, gnOutputDeviceHandle device);
|
||||
void (*_gnWaitForFence)(gnFenceHandle fence, uint64_t timeout);
|
||||
void (*_gnResetFence)(gnFenceHandle fence);
|
||||
void (*_gnDestroyFence)(gnFenceHandle fence);
|
||||
|
||||
gnReturnCode (*_gnSubmitSync)(gnOutputDevice device, gnSubmitSyncInfo info);
|
||||
} gnSyncExtFunctions;
|
||||
|
@@ -4,6 +4,7 @@
|
||||
#include <core/src/debugger/gryphn_debugger.h>
|
||||
#include "synchronization/semaphore/gryphn_semaphore.h"
|
||||
#include "synchronization/fence/gryphn_fence.h"
|
||||
#include "synchronization/commands/gryphn_sync_submit.h"
|
||||
|
||||
gnReturnCode checkPresentationQueueGetImageAsync(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphoreHandle semaphore, uint32_t* imageIndex) {
|
||||
CHECK_FUNCTION_WITH_RETURN_CODE(presentationQueue->outputDevice->instance, _gnPresentationQueueGetImageAsync, syncFunctions, presentationQueue, timeout, semaphore, imageIndex);
|
||||
@@ -28,3 +29,7 @@ void checkResetFence(gnFenceHandle fence) {
|
||||
void checkDestroyFence(gnFenceHandle fence) {
|
||||
CHECK_VOID_FUNCTION(fence->device->instance, _gnDestroyFence, syncFunctions, fence);
|
||||
}
|
||||
|
||||
gnReturnCode checkSubmitSync(gnOutputDevice device, gnSubmitSyncInfo info) {
|
||||
CHECK_FUNCTION_WITH_RETURN_CODE(device->instance, _gnSubmitSync, syncFunctions, device, info);
|
||||
}
|
||||
|
@@ -7,3 +7,6 @@ gnReturnCode checkCreateFence(gnFenceHandle fence, gnOutputDeviceHandle device);
|
||||
void checkWaitForFence(gnFenceHandle fence, uint64_t timeout);
|
||||
void checkResetFence(gnFenceHandle fence);
|
||||
void checkDestroyFence(gnFenceHandle fence);
|
||||
// gnReturnCode fdsfsdf(gnOutputDevice device, gnSubmitSyncInfo info);
|
||||
|
||||
gnReturnCode checkSubmitSync(gnOutputDevice device, gnSubmitSyncInfo info);
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "src/instance_functions.h"
|
||||
#include "src/device_functions.h"
|
||||
#include "src/command_functions.h"
|
||||
#include "extensions/sync_functions.h"
|
||||
|
||||
gnInstanceFunctions loadFunctionLoaderInstanceFunctions() {
|
||||
return (gnInstanceFunctions){
|
||||
@@ -115,5 +116,7 @@ gnSyncExtFunctions loadFunctionLoaderSyncExtFunctions() {
|
||||
._gnWaitForFence = checkWaitForFence,
|
||||
._gnResetFence = checkResetFence,
|
||||
._gnDestroyFence = checkDestroyFence,
|
||||
|
||||
._gnSubmitSync = checkSubmitSync
|
||||
};
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
#include "loader/src/gryphn_device_functions.h"
|
||||
|
||||
gnReturnCode checkCreatePresentationQueue(gnPresentationQueueHandle presentationQueue, const gnOutputDeviceHandle device, gnPresentationQueueInfo presentationInfo);
|
||||
gnReturnCode checkPresentationQueueGetImageAsync(gnPresentationQueueHandle presentationQueue, uint64_t timeout, gnSemaphoreHandle semaphore, uint32_t* imageIndex);
|
||||
gnReturnCode checkPresentationQueueGetImage(gnPresentationQueueHandle presentationQueue, uint32_t *imageIndex);
|
||||
void checkDestroyPresentationQueue(gnPresentationQueueHandle presentationQueue);
|
||||
|
||||
@@ -20,9 +19,6 @@ void checkDestroyFramebuffer(gnFramebuffer framebuffer);
|
||||
gnReturnCode checkCreateCommandPool(gnCommandPoolHandle commandPool, gnOutputDeviceHandle device, gnCommandPoolInfo info);
|
||||
void checkDestroyCommandPool(gnCommandPoolHandle commandPool);
|
||||
|
||||
gnReturnCode checkCreateSemaphore(gnSemaphoreHandle semaphore, gnOutputDeviceHandle device);
|
||||
void checkDestroySemaphore(gnSemaphoreHandle semaphore);
|
||||
|
||||
gnReturnCode checkCreateBuffer(gnBufferHandle buffer, gnDeviceHandle device, gnBufferInfo info);
|
||||
void checkBufferData(gnBufferHandle buffer, size_t size, void* data);
|
||||
void checkBufferSubData(gnBufferHandle buffer, size_t offset, size_t size, void* data);
|
||||
@@ -41,11 +37,6 @@ gnReturnCode checkCreateTexture(gnTexture texture, gnDevice device, const gnText
|
||||
void checkTextureData(gnTextureHandle texture, void* pixelData);
|
||||
void checkDestroyTexture(gnTexture texture);
|
||||
|
||||
gnReturnCode checkCreateFence(gnFenceHandle fence, gnOutputDeviceHandle device);
|
||||
void checkWaitForFence(gnFenceHandle fence, uint64_t timeout);
|
||||
void checkResetFence(gnFenceHandle fence);
|
||||
void checkDestroyFence(gnFenceHandle fence);
|
||||
|
||||
gnReturnCode checkSubmit(gnOutputDeviceHandle device, gnSubmitInfo submit);
|
||||
gnReturnCode checkPresent(gnOutputDeviceHandle device, gnPresentInfo info);
|
||||
|
||||
|
Reference in New Issue
Block a user