gryphn+vulkan render pass descriptors

This commit is contained in:
Greg Wells
2025-05-28 14:57:41 -04:00
parent e9b87ca773
commit b443b5173c
9 changed files with 165 additions and 1 deletions

View File

@@ -9,6 +9,7 @@
#include "window_surface/gryphn_surface_create_functions.h"
#include "shader_module/gryphn_shader_module.h"
#include "pipelines/graphics_pipeline/gryphn_graphics_pipeline.h"
#include "renderpass/gryphn_render_pass_descriptor.h"
typedef struct gnFunctions_t {
gnReturnCode (*_gnCreateInstance)(gnInstance* instance, struct gnInstanceInfo_t info);
@@ -56,6 +57,9 @@ typedef struct gnDeviceFunctions_t {
gnReturnCode (*_gnCreateShaderModule)(struct gnShaderModule_t* module, struct gnOutputDevice_t* device, struct gnShaderModuleInfo_t shaderModuleInfo);
void (*_gnDestroyShaderModule)(struct gnShaderModule_t* module);
gnReturnCode (*_gnCreateRenderPassDescriptor)(struct gnRenderPassDescriptor_t* renderPass, struct gnOutputDevice_t* device, struct gnRenderPassDescriptorInfo_t info);
void (*_gnDestroyRenderPassDescriptor)(struct gnRenderPassDescriptor_t* renderPass);
gnReturnCode (*_gnCreateGraphicsPipeline)(struct gnGraphicsPipeline_t* pipeline, struct gnOutputDevice_t* device, struct gnGraphicsPipelineInfo_t pipelineInfo);
void (*_gnDestroyGraphicsPipeline)(struct gnGraphicsPipeline_t* pipeline);
} gnDeviceFunctions;

View File

@@ -73,6 +73,8 @@ void gnLoadDeviceFunctions(struct gnDynamicLibrary_t* lib, struct gnDeviceFuncti
gnLoadDLLFunction(lib, functions->_gnDestroyPresentationQueue, "gnDestroyPresentationQueueFn");
gnLoadDLLFunction(lib, functions->_gnCreateShaderModule, "gnCreateShaderModuleFn");
gnLoadDLLFunction(lib, functions->_gnDestroyShaderModule, "gnDestroyShaderModuleFn");
gnLoadDLLFunction(lib, functions->_gnCreateRenderPassDescriptor, "gnCreateRenderPassDescriptorFn");
gnLoadDLLFunction(lib, functions->_gnDestroyRenderPassDescriptor, "gnDestroyRenderPassDescriptorFn");
gnLoadDLLFunction(lib, functions->_gnCreateGraphicsPipeline, "gnCreateGraphicsPipelineFn");
gnLoadDLLFunction(lib, functions->_gnDestroyGraphicsPipeline, "gnDestroyGraphicsPipelineFn");
}

View File

@@ -0,0 +1,11 @@
#include "gryphn_render_pass_descriptor.h"
#include "core/gryphn_platform_functions.h"
gnReturnCode gnCreateRenderPassDescriptor(struct gnRenderPassDescriptor_t* renderPass, struct gnOutputDevice_t* device, struct gnRenderPassDescriptorInfo_t info) {
renderPass->device = device;
return device->deviceFunctions->_gnCreateRenderPassDescriptor(renderPass, device, info);
}
void gnDestroyRenderPassDescriptor(struct gnRenderPassDescriptor_t* renderPass) {
renderPass->device->deviceFunctions->_gnDestroyRenderPassDescriptor(renderPass);
}

View File

@@ -0,0 +1,52 @@
#pragma once
#include "utils/types/gryphn_image_format.h"
#include "stdint.h"
#include "core/output_device/gryphn_output_device.h"
typedef enum gnLoadOperation_e {
GN_LOAD_OPERATION_LOAD, GN_LOAD_OPERATION_CLEAR, GN_LOAD_OPERATION_DONT_CARE
} gnLoadOperation;
typedef enum gnStoreOperation_e {
GN_STORE_OPERATION_STORE, GN_STORE_OPERATION_DONT_CARE
} gnStoreOperation;
typedef struct gnRenderPassAttachmentInfo_t {
enum gnImageFormat_e format;
enum gnLoadOperation_e loadOperation;
enum gnStoreOperation_e storeOperation;
enum gnLoadOperation_e stencilLoadOperation;
enum gnStoreOperation_e stencilStoreOperation;
enum gnImageLayout_e initialLayout;
enum gnImageLayout_e finalLayout;
} gnRenderPassAttachmentInfo;
typedef struct gnSubpassAttachmentInfo_t {
uint32_t index;
enum gnImageLayout_e imageLayout;
} gnSubpassAttachmentInfo;
typedef struct gnSubpassInfo_t {
uint32_t colorAttachmentCount;
struct gnSubpassAttachmentInfo_t* colorAttachments;
} gnSubpassInfo;
typedef struct gnRenderPassDescriptorInfo_t {
uint32_t attachmentCount;
struct gnRenderPassAttachmentInfo_t* attachmentInfos;
uint32_t subpassCount;
struct gnSubpassInfo_t* subpassInfos;
} gnRenderPassDescriptorInfo;
struct gnPlatformRenderPassDescriptor_t;
typedef struct gnRenderPassDescriptor_t {
struct gnPlatformRenderPassDescriptor_t* renderPassDescriptor;
struct gnOutputDevice_t* device;
} gnRenderPassDescriptor;
gnReturnCode gnCreateRenderPassDescriptor(struct gnRenderPassDescriptor_t* renderPass, struct gnOutputDevice_t* device, struct gnRenderPassDescriptorInfo_t info);
void gnDestroyRenderPassDescriptor(struct gnRenderPassDescriptor_t* renderPass);

View File

@@ -20,7 +20,8 @@ typedef enum gnReturnCode_t {
GN_FAILED_TO_CREATE_SHADER_MODULE,
GN_FAILED_TO_CONVERT_SHADER_CODE,
GN_FAILED_TO_FIND_ENTRY_POINT,
GN_FAILED_TO_CREATE_UNIFORM_LAYOUT
GN_FAILED_TO_CREATE_UNIFORM_LAYOUT,
GN_FAILED_TO_CREATE_RENDER_PASS
// GN_UNKNOWN_FRAMEBUFFER_ATTACHMENT,
// GN_UNKNOWN_FUNCTION,
@@ -54,5 +55,6 @@ static const char* gnErrorCodeToCString(enum gnReturnCode_t returnCode) {
case GN_FAILED_TO_CONVERT_SHADER_CODE: return "GN_FAILED_TO_CONVERT_SHADER_CODE";
case GN_FAILED_TO_FIND_ENTRY_POINT: return "GN_FAILED_TO_FIND_ENTRY_POINT";
case GN_FAILED_TO_CREATE_UNIFORM_LAYOUT: return "GN_FAILED_TO_CREATE_UNIFORM_LAYOUT";
case GN_FAILED_TO_CREATE_RENDER_PASS: return "GN_FAILED_TO_CREATE_RENDER_PASS";
}
}

View File

@@ -12,3 +12,7 @@ typedef enum gnColorSpace_e {
typedef enum gnImageSharingMode_e {
GN_SHARING_MODE_EXCLUSIVE, GN_SHARING_MODE_CONCURRENT
} gnImageSharingMode;
typedef enum gnImageLayout_e {
GN_LAYOUT_UNDEFINED, GN_LAYOUT_PRESENTATION_QUEUE_IMAGE, GN_LAYOUT_TRANSFER_DESTINATION, GN_COLOR_ATTACHMENT
} gnImageLayout;