gryphn + vulkan stuff for depth textures

This commit is contained in:
Gregory Wells
2025-06-17 14:32:56 -04:00
parent e5a11b1ef4
commit 86f2ac6e5a
11 changed files with 99 additions and 48 deletions

View File

@@ -1,7 +1,7 @@
#include "gryphn_render_pass_descriptor.h"
#include "core/gryphn_platform_functions.h"
gnReturnCode gnCreateRenderPassDescriptor(gnRenderPassDescriptorHandle* renderPass, gnOutputDeviceHandle device, struct gnRenderPassDescriptorInfo_t info) {
gnReturnCode gnCreateRenderPassDescriptor(gnRenderPassDescriptorHandle* renderPass, gnOutputDeviceHandle device, gnRenderPassDescriptorInfo info) {
*renderPass = malloc(sizeof(struct gnRenderPassDescriptor_t));
(*renderPass)->device = device;
(*renderPass)->info = info;

View File

@@ -4,12 +4,14 @@
#include "utils/gryphn_error_code.h"
#include "core/gryphn_handles.h"
typedef enum gnRenderPassStage_e {
GN_COLOR_ATTACHMENT_OUTPUT = 0x00000400
typedef enum gnRenderPassStage {
GN_COLOR_ATTACHMENT_OUTPUT = 1,
GN_EARLY_FRAGMENT_TEST = 2
} gnRenderPassStage; // I stole these from vulkan to make that conversion easier
typedef enum gnRenderPassAccess_e {
GN_COLOR_ATTACHMENT_WRITE = 0x00000100
typedef enum gnRenderPassAccess {
GN_COLOR_ATTACHMENT_WRITE = 1,
GN_DEPTH_STENCIL_WRITE = 2
} gnRenderPassAccess;
typedef enum gnLoadOperation_e {
@@ -39,7 +41,8 @@ typedef struct gnSubpassAttachmentInfo_t {
typedef struct gnSubpassInfo_t {
uint32_t colorAttachmentCount;
struct gnSubpassAttachmentInfo_t* colorAttachments;
gnSubpassAttachmentInfo* colorAttachments;
gnSubpassAttachmentInfo* depthAttachment;
} gnSubpassInfo;
#define GN_SUBPASS_EXTERNAL -1
@@ -47,31 +50,31 @@ typedef struct gnSubpassInfo_t {
typedef struct gnSubpassDependencyInfo_t {
int source, destination;
enum gnRenderPassStage_e soruceStageMask;
enum gnRenderPassAccess_e sourceAccessMask;
gnRenderPassStage soruceStageMask;
gnRenderPassAccess sourceAccessMask;
enum gnRenderPassStage_e destinationStageMask;
enum gnRenderPassAccess_e destinationAccessMask;
gnRenderPassStage destinationStageMask;
gnRenderPassAccess destinationAccessMask;
} gnSubpassDependencyInfo;
typedef struct gnRenderPassDescriptorInfo_t {
typedef struct gnRenderPassDescriptorInfo {
uint32_t attachmentCount;
struct gnRenderPassAttachmentInfo_t* attachmentInfos;
gnRenderPassAttachmentInfo* attachmentInfos;
uint32_t subpassCount;
struct gnSubpassInfo_t* subpassInfos;
gnSubpassInfo* subpassInfos;
uint32_t dependencyCount;
struct gnSubpassDependencyInfo_t* dependencies;
gnSubpassDependencyInfo* dependencies;
} gnRenderPassDescriptorInfo;
#ifdef GN_REVEAL_IMPL
struct gnRenderPassDescriptor_t {
struct gnPlatformRenderPassDescriptor_t* renderPassDescriptor;
struct gnRenderPassDescriptorInfo_t info;
struct gnOutputDevice_t* device;
gnRenderPassDescriptorInfo info;
gnDeviceHandle device;
};
#endif
gnReturnCode gnCreateRenderPassDescriptor(gnRenderPassDescriptorHandle* renderPass, gnOutputDeviceHandle device, struct gnRenderPassDescriptorInfo_t info);
gnReturnCode gnCreateRenderPassDescriptor(gnRenderPassDescriptorHandle* renderPass, gnOutputDeviceHandle device, gnRenderPassDescriptorInfo info);
void gnDestroyRenderPassDescriptor(gnRenderPassDescriptorHandle renderPass);

View File

@@ -1,17 +1,18 @@
#pragma once
#include "stdint.h"
#include "core/sync/fence/gryphn_fence.h"
#include "core/renderpass/gryphn_render_pass_descriptor.h"
#include "core/gryphn_handles.h"
typedef struct gnSubmitInfo_t {
uint32_t waitCount;
enum gnRenderPassStage_e* waitStages;
gnRenderPassStage* waitStages;
gnSemaphoreHandle* waitSemaphores;
uint32_t signalCount;
gnSemaphoreHandle* signalSemaphores;
uint32_t commandBufferCount;
gnCommandBufferHandle* commandBuffers;
uint32_t queueIndex;
struct gnFence_t* fence;
gnFenceHandle fence;
} gnSubmitInfo;
gnReturnCode gnSubmit(gnOutputDevice device, gnSubmitInfo info);

View File

@@ -4,6 +4,7 @@
gnReturnCode gnCreateTexture(gnTexture* texture, gnDevice device, const gnTextureInfo info) {
*texture = malloc(sizeof(struct gnTexture_t));
(*texture)->device = device;
(*texture)->info = info;
return device->deviceFunctions->_gnCreateTexture(*texture, device, info);
}

View File

@@ -29,6 +29,7 @@ typedef struct gnTextureInfo {
struct gnTexture_t {
struct gnPlatformTexture_t* texture;
gnDeviceHandle device;
gnTextureInfo info;
};
#endif