Files
Gryphn/projects/core/src/gryphn_handles.h
2025-09-04 14:52:37 -04:00

52 lines
1.4 KiB
C

#pragma once
#include <stdint.h>
#define GN_NULL_HANDLE 0
typedef uint32_t gnFlags;
// The value of this handle is defined by the gryphn spec
#define GN_HANDLE(type) \
typedef struct type##_t* type##Handle; \
typedef struct type##_t* type
// The value of this handle is defined by the implementation
#ifndef GN_IMPLEMENTATION
#define GN_IMPLEMENTATION_HANDLE(type) \
typedef uint64_t type##Handle; \
typedef uint64_t type
#else
#define GN_IMPLEMENTATION_HANDLE(type) \
typedef uint64_t type##Handle; \
typedef uint64_t type
#endif
// can be used to alias a normal handle or an implementation handle
#define GN_HANDLE_ALIAS(handle, alias) \
typedef struct handle##_t* alias##Handle; \
typedef struct handle##_t* alias
GN_HANDLE(gnInstance);
GN_IMPLEMENTATION_HANDLE(gnPhysicalDevice); // NOTE: needs to become a impl handle
GN_HANDLE(gnWindowSurface);
GN_HANDLE(gnPresentationQueue);
GN_HANDLE(gnTexture);
GN_HANDLE(gnRenderPassDescriptor);
GN_HANDLE(gnOutputDevice);
GN_HANDLE_ALIAS(gnOutputDevice, gnDevice);
GN_HANDLE(gnShaderModule);
GN_HANDLE(gnGraphicsPipeline);
GN_HANDLE(gnCommandPool);
GN_HANDLE(gnCommandBuffer);
GN_HANDLE(gnFramebuffer);
GN_HANDLE(gnBuffer);
GN_HANDLE(gnUniformPool);
GN_HANDLE(gnUniform);
// extension objects
// GN_EXT_SYNCHRONIZATION
GN_HANDLE(gnSemaphore);
GN_HANDLE(gnFence);
// GN_EXT_QUEUES
GN_IMPLEMENTATION_HANDLE(gnQueue); // NOTE: this is an implementaion specific object