inplement the allocators into instance creation
This commit is contained in:
@@ -7,5 +7,5 @@ typedef struct gnPlatformInstance_t {
|
||||
NSView* metalContentView;
|
||||
} gnPlatformInstance;
|
||||
|
||||
gnReturnCode metalCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* instanceInfo, gryphnInstanceFunctionLayers* next);
|
||||
void metalDestroyInstance(gnInstance instance, gryphnInstanceFunctionLayers* next);
|
||||
gnReturnCode metalCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* instanceInfo, gryphnInstanceFunctionLayers* next, gnAllocators* allocators);
|
||||
void metalDestroyInstance(gnInstance instance, gryphnInstanceFunctionLayers* next, gnAllocators* allocators);
|
||||
|
@@ -1,14 +1,14 @@
|
||||
#include "metal_instance.h"
|
||||
|
||||
// metal instances are kinda useless
|
||||
gnReturnCode metalCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* instanceInfo, gryphnInstanceFunctionLayers* next) {
|
||||
gnReturnCode metalCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* instanceInfo, gryphnInstanceFunctionLayers* next, gnAllocators* allocators) {
|
||||
if (next != NULL) return GN_SUCCESS;
|
||||
|
||||
if (instanceInfo == NULL) return GN_INCOMPLETE;
|
||||
instance->instance = malloc(sizeof(gnPlatformInstance));
|
||||
instance->instance = allocators->malloc(sizeof(gnPlatformInstance), allocators->userData);
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
void metalDestroyInstance(gnInstanceHandle instance, gryphnInstanceFunctionLayers* next) {
|
||||
void metalDestroyInstance(gnInstanceHandle instance, gryphnInstanceFunctionLayers* next, gnAllocators* allocators) {
|
||||
if (next != NULL) return;
|
||||
free(instance->instance);
|
||||
allocators->free(instance->instance, allocators->userData);
|
||||
}
|
||||
|
Reference in New Issue
Block a user