gryphn buffer API
This commit is contained in:
12
src/core/buffers/gryphn_buffer.c
Normal file
12
src/core/buffers/gryphn_buffer.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "gryphn_buffer.h"
|
||||
#include "core/output_device/gryphn_output_device.h"
|
||||
#include "core/gryphn_platform_functions.h"
|
||||
|
||||
gnReturnCode gnCreateBuffer(gnBufferHandle* buffer, gnOutputDeviceHandle device, gnBufferInfo info) {
|
||||
*buffer = malloc(sizeof(struct gnBuffer_t));
|
||||
(*buffer)->device = device;
|
||||
return device->deviceFunctions->_gnCreateBuffer(*buffer, device, info);
|
||||
}
|
||||
void gnDestroyBuffer(gnBufferHandle buffer) {
|
||||
buffer->device->deviceFunctions->_gnDestroyBuffer(buffer);
|
||||
}
|
23
src/core/buffers/gryphn_buffer.h
Normal file
23
src/core/buffers/gryphn_buffer.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#include "stdlib.h"
|
||||
#include "utils/gryphn_error_code.h"
|
||||
#include <core/gryphn_handles.h>
|
||||
|
||||
typedef enum gnBufferType {
|
||||
GN_VERTEX_BUFFER = 0x00000001
|
||||
} gnBufferType;
|
||||
|
||||
typedef struct gnBufferInfo {
|
||||
size_t size;
|
||||
gnBufferType type;
|
||||
} gnBufferInfo;
|
||||
|
||||
#ifdef GN_REVEAL_IMPL
|
||||
struct gnBuffer_t {
|
||||
struct gnPlatformBuffer_t* buffer;
|
||||
gnDeviceHandle device;
|
||||
};
|
||||
#endif
|
||||
|
||||
gnReturnCode gnCreateBuffer(gnBufferHandle* buffer, gnOutputDeviceHandle device, gnBufferInfo info);
|
||||
void gnDestroyBuffer(gnBufferHandle buffer);
|
@@ -4,6 +4,10 @@
|
||||
typedef struct type##_t* type##Handle; \
|
||||
typedef struct type##_t* type
|
||||
|
||||
#define GN_HANDLE_ALIAS(alias, handle) \
|
||||
typedef struct handle##_t* alias##Handle; \
|
||||
typedef struct handle##_t* alias
|
||||
|
||||
GN_HANDLE(gnInstance);
|
||||
GN_HANDLE(gnDebugger);
|
||||
GN_HANDLE(gnWindowSurface);
|
||||
@@ -11,6 +15,7 @@ GN_HANDLE(gnPresentationQueue);
|
||||
GN_HANDLE(gnTexture);
|
||||
GN_HANDLE(gnRenderPassDescriptor);
|
||||
GN_HANDLE(gnOutputDevice);
|
||||
GN_HANDLE_ALIAS(gnDevice, gnOutputDevice);
|
||||
GN_HANDLE(gnShaderModule);
|
||||
GN_HANDLE(gnGraphicsPipeline);
|
||||
GN_HANDLE(gnCommandPool);
|
||||
@@ -18,3 +23,4 @@ GN_HANDLE(gnCommandBuffer);
|
||||
GN_HANDLE(gnSemaphore);
|
||||
GN_HANDLE(gnFence);
|
||||
GN_HANDLE(gnFramebuffer);
|
||||
GN_HANDLE(gnBuffer);
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include "sync/semaphore/gryphn_semaphore.h"
|
||||
#include "core/submit/gryphn_submit.h"
|
||||
#include "core/present/gryphn_present.h"
|
||||
#include "core/buffers/gryphn_buffer.h"
|
||||
|
||||
typedef struct gnFunctions_t {
|
||||
gnReturnCode (*_gnCreateInstance)(gnInstanceHandle instance, gnInstanceInfo info);
|
||||
@@ -81,6 +82,9 @@ typedef struct gnDeviceFunctions_t {
|
||||
gnReturnCode (*_gnCreateSemaphore)(gnSemaphoreHandle semaphore, gnOutputDeviceHandle device);
|
||||
void (*_gnDestroySemaphore)(gnSemaphoreHandle semaphore);
|
||||
|
||||
gnReturnCode (*_gnCreateBuffer)(gnBufferHandle buffer, gnDeviceHandle device, gnBufferInfo info);
|
||||
gnReturnCode(*_gnDestroyBuffer)(gnBufferHandle buffer);
|
||||
|
||||
gnReturnCode (*_gnCreateFence)(gnFenceHandle fence, gnOutputDeviceHandle device);
|
||||
void (*_gnSignalFence)(gnFenceHandle fence);
|
||||
void (*_gnWaitForFence)(gnFenceHandle fence, uint64_t timeout);
|
||||
|
Reference in New Issue
Block a user