framebuffer handles

This commit is contained in:
Greg Wells
2025-06-05 22:22:35 -04:00
parent d5d339105d
commit 3a69ed70ff
5 changed files with 17 additions and 12 deletions

View File

@@ -1,11 +1,12 @@
#include "gryphn_framebuffer.h" #include "gryphn_framebuffer.h"
#include "core/gryphn_platform_functions.h" #include "core/gryphn_platform_functions.h"
gnReturnCode gnCreateFramebuffer(struct gnFramebuffer_t* framebuffer, struct gnOutputDevice_t* device, struct gnFramebufferInfo_t framebufferInfo) { gnReturnCode gnCreateFramebuffer(gnFramebuffer* framebuffer, gnOutputDeviceHandle device, gnFramebufferInfo framebufferInfo) {
framebuffer->device = device; *framebuffer = malloc(sizeof(struct gnFramebuffer_t));
return device->deviceFunctions->_gnCreateFramebuffer(framebuffer, device, framebufferInfo); (*framebuffer)->device = device;
return device->deviceFunctions->_gnCreateFramebuffer(*framebuffer, device, framebufferInfo);
} }
void gnDestroyFramebuffer(struct gnFramebuffer_t *framebuffer) { void gnDestroyFramebuffer(gnFramebuffer framebuffer) {
framebuffer->device->deviceFunctions->_gnDestroyFramebuffer(framebuffer); framebuffer->device->deviceFunctions->_gnDestroyFramebuffer(framebuffer);
} }

View File

@@ -10,10 +10,12 @@ typedef struct gnFramebufferInfo_t {
gnUInt2 size; gnUInt2 size;
} gnFramebufferInfo; } gnFramebufferInfo;
typedef struct gnFramebuffer_t { #ifdef GN_REVEAL_IMPL
struct gnFramebuffer_t {
struct gnPlatformFramebuffer_t* framebuffer; struct gnPlatformFramebuffer_t* framebuffer;
gnOutputDeviceHandle device; gnOutputDeviceHandle device;
} gnFramebuffer; };
#endif
gnReturnCode gnCreateFramebuffer(struct gnFramebuffer_t* framebuffer, gnOutputDeviceHandle device, struct gnFramebufferInfo_t framebufferInfo); gnReturnCode gnCreateFramebuffer(gnFramebuffer* framebuffer, gnOutputDeviceHandle device, gnFramebufferInfo framebufferInfo);
void gnDestroyFramebuffer(struct gnFramebuffer_t* framebuffer); void gnDestroyFramebuffer(gnFramebuffer framebuffer);

View File

@@ -17,3 +17,4 @@ GN_HANDLE(gnCommandPool);
GN_HANDLE(gnCommandBuffer); GN_HANDLE(gnCommandBuffer);
GN_HANDLE(gnSemaphore); GN_HANDLE(gnSemaphore);
GN_HANDLE(gnFence); GN_HANDLE(gnFence);
GN_HANDLE(gnFramebuffer);

View File

@@ -72,8 +72,8 @@ typedef struct gnDeviceFunctions_t {
gnReturnCode (*_gnCreateGraphicsPipeline)(gnGraphicsPipelineHandle pipeline, gnOutputDeviceHandle device, gnGraphicsPipelineInfo pipelineInfo); gnReturnCode (*_gnCreateGraphicsPipeline)(gnGraphicsPipelineHandle pipeline, gnOutputDeviceHandle device, gnGraphicsPipelineInfo pipelineInfo);
void (*_gnDestroyGraphicsPipeline)(gnGraphicsPipelineHandle pipeline); void (*_gnDestroyGraphicsPipeline)(gnGraphicsPipelineHandle pipeline);
gnReturnCode (*_gnCreateFramebuffer)(struct gnFramebuffer_t* framebuffer, gnOutputDeviceHandle device, gnFramebufferInfo framebufferInfo); gnReturnCode (*_gnCreateFramebuffer)(gnFramebuffer framebuffer, gnOutputDeviceHandle device, gnFramebufferInfo framebufferInfo);
void (*_gnDestroyFramebuffer)(struct gnFramebuffer_t* framebuffer); void (*_gnDestroyFramebuffer)(gnFramebuffer framebuffer);
gnReturnCode (*_gnCreateCommandPool)(gnCommandPoolHandle commandPool, gnOutputDeviceHandle device, gnCommandPoolInfo info); gnReturnCode (*_gnCreateCommandPool)(gnCommandPoolHandle commandPool, gnOutputDeviceHandle device, gnCommandPoolInfo info);
void (*_gnDestroyCommandPool)(gnCommandPoolHandle commandPool); void (*_gnDestroyCommandPool)(gnCommandPoolHandle commandPool);

View File

@@ -1,10 +1,11 @@
#pragma once #pragma once
#include "core/framebuffer/gryphn_framebuffer.h"
#include "utils/types/gryphn_color.h" #include "utils/types/gryphn_color.h"
#include "utils/math/gryphn_vec2.h"
#include "core/gryphn_handles.h"
typedef struct gnRenderPassInfo_t { typedef struct gnRenderPassInfo_t {
gnRenderPassDescriptorHandle renderPassDescriptor; gnRenderPassDescriptorHandle renderPassDescriptor;
struct gnFramebuffer_t* framebuffer; gnFramebuffer framebuffer;
gnUInt2 offset; gnUInt2 offset;
gnUInt2 size; gnUInt2 size;
uint32_t clearValueCount; uint32_t clearValueCount;