more loader redoing (for instance)

This commit is contained in:
Gregory Wells
2025-08-03 09:59:19 -04:00
parent da20b01638
commit c4af74aa52
8 changed files with 24 additions and 18 deletions

View File

@@ -3,10 +3,15 @@
#include "surface/metal_surface.h"
#include "devices/metal_output_devices.h"
gryphnInstanceFunctionLayers metalLoadAPILayer() {
return (gryphnInstanceFunctionLayers) {
.createInstance = { metalCreateInstance, NULL },
.destroyInstance = { metalDestroyInstance, NULL }
};
}
gnInstanceFunctions loadMetalInstanceFunctions() {
return (gnInstanceFunctions){
._gnCreateInstance = createMetalInstance,
._gnDestroyInstance = destroyMetalInstance,
._gnGetPhysicalDevices = getMetalDevices,
._gnPhysicalDeviceCanPresentToSurface = metalCanDevicePresent,
._gnCreateOutputDevice = createMetalOutputDevice,

View File

@@ -5,6 +5,9 @@
#include "extensions/synchronization/loader/sync_functions.h"
#include "core/gryphn_extensions.h"
typedef struct gryphnInstanceFunctionLayers gryphnInstanceFunctionLayers;
gryphnInstanceFunctionLayers metalLoadAPILayer();
gnInstanceFunctions loadMetalInstanceFunctions();
gnDeviceFunctions loadMetalDeviceFunctions();
gnCommandFunctions loadMetalCommandFunctions();

View File

@@ -7,5 +7,5 @@ typedef struct gnPlatformInstance_t {
NSView* metalContentView;
} gnPlatformInstance;
gnReturnCode createMetalInstance(gnInstanceHandle instance, gnInstanceCreateInfo* instanceInfo);
void destroyMetalInstance(gnInstance instance);
gnReturnCode metalCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* instanceInfo, gryphnFunctionLayer* next);
void metalDestroyInstance(gnInstance instance, gryphnFunctionLayer* next);

View File

@@ -1,10 +1,10 @@
#include "metal_instance.h"
// metal instances are kinda useless
gnReturnCode createMetalInstance(gnInstanceHandle instance, gnInstanceCreateInfo* instanceInfo) {
gnReturnCode metalCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* instanceInfo, gryphnFunctionLayer* next) {
if (instance->instance == NULL) instance->instance = malloc(sizeof(gnPlatformInstance));
return GN_SUCCESS;
}
void destroyMetalInstance(gnInstance instance) {
void metalDestroyInstance(gnInstanceHandle instance, gryphnFunctionLayer* next) {
free(instance->instance);
}

View File

@@ -6,6 +6,9 @@
#include "extensions/queues/queues_functions.h"
#include "core/gryphn_extensions.h"
typedef struct gryphnInstanceFunctionLayers gryphnInstanceFunctionLayers;
gryphnInstanceFunctionLayers loadVulkanAPILayer();
gnInstanceFunctions loadVulkanInstanceFunctions();
gnDeviceFunctions loadVulkanDeviceFunctions();
gnCommandFunctions loadVulkanCommandFunctions();