presentaion queue handles + texture handle

This commit is contained in:
Greg Wells
2025-06-03 14:38:51 -04:00
parent fbc30509c4
commit c48e11f998
14 changed files with 69 additions and 59 deletions

View File

@@ -1,12 +1,11 @@
#pragma once
#include "core/renderpass/gryphn_render_pass_descriptor.h"
#include "core/textures/gryphn_texture.h"
#include "utils/math/gryphn_vec2.h"
typedef struct gnFramebufferInfo_t {
struct gnRenderPassDescriptor_t* renderPassDescriptor;
uint32_t attachmentCount;
struct gnTexture_t* attachments;
gnTextureHandle* attachments;
gnUInt2 size;
} gnFramebufferInfo;

View File

@@ -7,3 +7,5 @@ typedef struct type##_t* type
GN_HANDLE(gnInstance);
GN_HANDLE(gnDebugger);
GN_HANDLE(gnWindowSurface);
GN_HANDLE(gnPresentationQueue);
GN_HANDLE(gnTexture);

View File

@@ -59,9 +59,9 @@ typedef struct gnFunctions_t {
#include "core/presentation_queue/gryphn_presentation_queue.h"
typedef struct gnDeviceFunctions_t {
gnReturnCode (*_gnCreatePresentationQueue)(gnPresentationQueue* presentationQueue, const gnOutputDeviceHandle device, struct gnPresentationQueueInfo_t presentationInfo);
gnReturnCode (*_gnPresentationQueueGetImage)(gnPresentationQueue* presentationQueue, uint64_t timeout, struct gnSemaphore_t* semaphore, uint32_t* imageIndex);
void (*_gnDestroyPresentationQueue)(gnPresentationQueue *presentationQueue);
gnReturnCode (*_gnCreatePresentationQueue)(gnPresentationQueueHandle presentationQueue, const gnOutputDeviceHandle device, struct gnPresentationQueueInfo_t presentationInfo);
gnReturnCode (*_gnPresentationQueueGetImage)(gnPresentationQueueHandle presentationQueue, uint64_t timeout, struct gnSemaphore_t* semaphore, uint32_t* imageIndex);
void (*_gnDestroyPresentationQueue)(gnPresentationQueueHandle presentationQueue);
gnReturnCode (*_gnCreateShaderModule)(struct gnShaderModule_t* module, gnOutputDeviceHandle device, struct gnShaderModuleInfo_t shaderModuleInfo);
void (*_gnDestroyShaderModule)(struct gnShaderModule_t* module);

View File

@@ -6,7 +6,7 @@ typedef struct gnPresentInfo_t {
uint32_t waitCount;
struct gnSemaphore_t* waitSemaphores;
uint32_t presentationQueueCount;
struct gnPresentationQueue_t* presentationQueues;
gnPresentationQueueHandle* presentationQueues;
uint32_t* imageIndices;
uint32_t queueIndex;
} gnPresentInfo;

View File

@@ -1,5 +0,0 @@
#pragma once
typedef enum gnPresentationQueueState_e {
GN_OUT_OF_DATE, GN_SUBOPTIMAL, GN_VALID
} gnPresentationQueueState;

View File

@@ -1,16 +1,21 @@
#include "gryphn_presentation_queue.h"
#include "core/gryphn_platform_functions.h"
gnReturnCode gnCreatePresentationQueue(gnPresentationQueue* presentationQueue, struct gnOutputDevice_t* device, struct gnPresentationQueueInfo_t presentationInfo){
presentationQueue->outputDevice = device;
presentationQueue->info = presentationInfo;
return device->deviceFunctions->_gnCreatePresentationQueue(presentationQueue, device, presentationInfo);
gnReturnCode gnCreatePresentationQueue(gnPresentationQueueHandle* presentationQueue, struct gnOutputDevice_t* device, struct gnPresentationQueueInfo_t presentationInfo){
*presentationQueue = malloc(sizeof(struct gnPresentationQueue_t));
(*presentationQueue)->outputDevice = device;
(*presentationQueue)->info = presentationInfo;
return device->deviceFunctions->_gnCreatePresentationQueue(*presentationQueue, device, presentationInfo);
}
gnReturnCode gnPresentationQueueGetImage(gnPresentationQueue* presentationQueue, uint64_t timeout, struct gnSemaphore_t* semaphore, uint32_t* imageIndex) {
gnReturnCode gnPresentationQueueGetImage(gnPresentationQueueHandle presentationQueue, uint64_t timeout, struct gnSemaphore_t* semaphore, uint32_t* imageIndex) {
return presentationQueue->outputDevice->deviceFunctions->_gnPresentationQueueGetImage(presentationQueue, timeout, semaphore, imageIndex);
}
void gnDestroyPresentationQueue(gnPresentationQueue *presentationQueue) {
presentationQueue->outputDevice->deviceFunctions->_gnDestroyPresentationQueue(presentationQueue);
uint32_t gnGetPresentationQueueImageCount(gnPresentationQueueHandle presentationQueue) { return presentationQueue->imageCount; }
gnTextureHandle gnGetPresentationQueueImage(gnPresentationQueueHandle presentationQueue, uint32_t index) {
return presentationQueue->images[index];
}
void gnDestroyPresentationQueue(gnPresentationQueueHandle presentationQueue) {
presentationQueue->outputDevice->deviceFunctions->_gnDestroyPresentationQueue(presentationQueue);
free(presentationQueue);
}

View File

@@ -4,6 +4,7 @@
#include <core/window_surface/gryphn_surface.h>
#include <utils/types/gryphn_image_format.h>
#include <core/sync/semaphore/gryphn_semaphore.h>
#include "core/gryphn_handles.h"
typedef struct gnPresentationQueueInfo_t {
uint32_t minImageCount;
@@ -17,15 +18,19 @@ typedef struct gnPresentationQueueInfo_t {
struct gnPlatformPresentationQueue_t;
typedef struct gnPresentationQueue_t {
#ifdef GN_REVEAL_IMPL
struct gnPresentationQueue_t {
struct gnPlatformPresentationQueue_t* presentationQueue;
struct gnOutputDevice_t* outputDevice;
gnOutputDeviceHandle outputDevice;
gnBool valid;
uint32_t imageCount;
struct gnTexture_t* images;
gnTextureHandle* images;
struct gnPresentationQueueInfo_t info;
} gnPresentationQueue;
};
#endif
gnReturnCode gnCreatePresentationQueue(gnPresentationQueue* presentationQueue, struct gnOutputDevice_t* device, struct gnPresentationQueueInfo_t presentationInfo);
gnReturnCode gnPresentationQueueGetImage(gnPresentationQueue* presentationQueue, uint64_t timeout, struct gnSemaphore_t* semaphore, uint32_t* imageIndex);
void gnDestroyPresentationQueue(gnPresentationQueue* presentationQueue);
gnReturnCode gnCreatePresentationQueue(gnPresentationQueueHandle* presentationQueue, struct gnOutputDevice_t* device, struct gnPresentationQueueInfo_t presentationInfo);
gnReturnCode gnPresentationQueueGetImage(gnPresentationQueueHandle presentationQueue, uint64_t timeout, struct gnSemaphore_t* semaphore, uint32_t* imageIndex);
uint32_t gnGetPresentationQueueImageCount(gnPresentationQueueHandle presentationQueue);
gnTextureHandle gnGetPresentationQueueImage(gnPresentationQueueHandle presentationQueue, uint32_t index);
void gnDestroyPresentationQueue(gnPresentationQueueHandle presentationQueue);

View File

@@ -1,7 +1,7 @@
#pragma once
struct gnPlatformTexture_t;
typedef struct gnTexture_t {
#ifdef GN_REVEAL_IMPL
struct gnTexture_t {
struct gnPlatformTexture_t* texture;
} gnTexture;
};
#endif