submitted command buffers + subpass depends

This commit is contained in:
Greg Wells
2025-05-30 13:09:35 -04:00
parent 64da9c4ec4
commit dd5e93864d
9 changed files with 127 additions and 2 deletions

View File

@@ -16,6 +16,7 @@
#include "renderpass/gryphn_render_pass.h"
#include "sync/fence/gryphn_fence.h"
#include "sync/semaphore/gryphn_semaphore.h"
#include "core/submit/gryphn_submit.h"
typedef struct gnFunctions_t {
gnReturnCode (*_gnCreateInstance)(gnInstance* instance, struct gnInstanceInfo_t info);
@@ -84,6 +85,8 @@ typedef struct gnDeviceFunctions_t {
void (*_gnWaitForFence)(struct gnFence_t* fence, uint64_t timeout);
void (*_gnResetFence)(struct gnFence_t* fence);
void (*_gnDestroyFence)(struct gnFence_t* fence);
gnReturnCode (*_gnSubmit)(struct gnOutputDevice_t* device, struct gnSubmitInfo_t submit);
} gnDeviceFunctions;
typedef struct gnCommandFunctions_t {

View File

@@ -89,6 +89,7 @@ void gnLoadDeviceFunctions(struct gnDynamicLibrary_t* lib, struct gnDeviceFuncti
gnLoadDLLFunction(lib, functions->_gnWaitForFence, "gnWaitForFenceFn");
gnLoadDLLFunction(lib, functions->_gnResetFence, "gnResetFenceFn");
gnLoadDLLFunction(lib, functions->_gnDestroyFence, "gnDestroyFenceFn");
gnLoadDLLFunction(lib, functions->_gnSubmit, "gnSubmitFn");
}
void gnLoadCommandFunctions(struct gnDynamicLibrary_t* lib, struct gnCommandFunctions_t* functions) {

View File

@@ -3,6 +3,14 @@
#include "stdint.h"
#include "core/output_device/gryphn_output_device.h"
typedef enum gnRenderPassStage_e {
GN_COLOR_ATTACHMENT_OUTPUT = 0x00000400
} gnRenderPassStage; // I stole these from vulkan to make that conversion easier
typedef enum gnRenderPassAccess_e {
GN_COLOR_ATTACHMENT_WRITE = 0x00000100
} gnRenderPassAccess;
typedef enum gnLoadOperation_e {
GN_LOAD_OPERATION_LOAD, GN_LOAD_OPERATION_CLEAR, GN_LOAD_OPERATION_DONT_CARE
} gnLoadOperation;
@@ -33,12 +41,27 @@ typedef struct gnSubpassInfo_t {
struct gnSubpassAttachmentInfo_t* colorAttachments;
} gnSubpassInfo;
#define GN_SUBPASS_EXTERNAL -1
typedef struct gnSubpassDependencyInfo_t {
int source, destination;
enum gnRenderPassStage_e soruceStageMask;
enum gnRenderPassAccess_e sourceAccessMask;
enum gnRenderPassStage_e destinationStageMask;
enum gnRenderPassAccess_e destinationAccessMask;
} gnSubpassDependencyInfo;
typedef struct gnRenderPassDescriptorInfo_t {
uint32_t attachmentCount;
struct gnRenderPassAttachmentInfo_t* attachmentInfos;
uint32_t subpassCount;
struct gnSubpassInfo_t* subpassInfos;
uint32_t dependencyCount;
struct gnSubpassDependencyInfo_t* dependencies;
} gnRenderPassDescriptorInfo;
struct gnPlatformRenderPassDescriptor_t;

View File

@@ -0,0 +1,6 @@
#include "gryphn_submit.h"
#include "core/gryphn_platform_functions.h"
gnReturnCode gnSubmit(struct gnOutputDevice_t* device, struct gnSubmitInfo_t info) {
return device->deviceFunctions->_gnSubmit(device, info);
}

View File

@@ -0,0 +1,20 @@
#pragma once
#include "stdint.h"
#include "core/sync/semaphore/gryphn_semaphore.h"
#include "core/sync/fence/gryphn_fence.h"
#include "core/command/command_buffer/gryphn_command_buffer.h"
#include "core/output_device/gryphn_output_device.h"
typedef struct gnSubmitInfo_t {
uint32_t waitCount;
enum gnRenderPassStage_e* waitStages;
struct gnSemaphore_t* waitSemaphores;
uint32_t signalCount;
struct gnSemaphore_t* signalSemaphores;
uint32_t commandBufferCount;
struct gnCommandBuffer_t* commandBuffers;
uint32_t queueIndex;
struct gnFence_t* fence;
} gnSubmitInfo;
gnReturnCode gnSubmit(struct gnOutputDevice_t* device, struct gnSubmitInfo_t submit);

View File

@@ -32,7 +32,8 @@ typedef enum gnReturnCode_t {
GN_FAIELD_TO_END_RECORDING,
GN_FAILED_TO_ALLOCATE_COMMAND_BUFFERS,
GN_FAILED_TO_CREATE_FENCE,
GN_FAILED_TO_CREATE_SEMAPHORE
GN_FAILED_TO_CREATE_SEMAPHORE,
GN_FAILED_TO_SUBMIT_COMMAND_BUFFER
} gnReturnCode;
typedef gnReturnCode gnErrorCode;
@@ -70,5 +71,6 @@ static const char* gnErrorCodeToCString(enum gnReturnCode_t returnCode) {
case GN_FAILED_TO_ALLOCATE_COMMAND_BUFFERS: return "GN_FAILED_TO_ALLOCATE_COMMAND_BUFFERS";
case GN_FAILED_TO_CREATE_FENCE: return "GN_FAILED_TO_CREATE_FENCE";
case GN_FAILED_TO_CREATE_SEMAPHORE: return "GN_FAILED_TO_CREATE_SEMAPHORE";
case GN_FAILED_TO_SUBMIT_COMMAND_BUFFER: return "GN_FAILED_TO_SUBMIT_COMMAND_BUFFER";
}
}