a lot of loader cleanup

This commit is contained in:
Gregory Wells
2025-08-03 11:43:20 -04:00
parent 988333c0ac
commit 17b1cff781
16 changed files with 77 additions and 64 deletions

View File

@@ -7,8 +7,8 @@
gryphnInstanceFunctionLayers checkerLoadInstanceFunctions() {
return (gryphnInstanceFunctionLayers) {
.createInstance = { checkCreateInstance, NULL },
.destroyInstance = { checkDestroyInstance, NULL }
.createInstance = checkCreateInstance,
.destroyInstance = checkDestroyInstance
};
}

View File

@@ -3,6 +3,9 @@
#include "loader/src/gryphn_device_functions.h"
#include "loader/src/gryphn_command_functions.h"
typedef struct gryphnInstanceFunctionLayers gryphnInstanceFunctionLayers;
gryphnInstanceFunctionLayers checkerLoadInstanceFunctions();
gnInstanceFunctions loadFunctionLoaderInstanceFunctions();
gnDeviceFunctions loadFunctionLoaderDeviceFunctions();
gnCommandFunctions loadFunctionLoaderCommandFunctions();

View File

@@ -4,23 +4,24 @@
#include "core/src/output_device/gryphn_output_device.h"
#include "core/src/window_surface/gryphn_surface.h"
gnReturnCode checkCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* info, PFN_gnCreateInstance_layer* next) {
if (next->func == NULL) {
gnReturnCode checkCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* info, gryphnInstanceFunctionLayers* next) {
if (next == NULL || next->createInstance == NULL) {
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){
.message = gnCreateString("Failed to load gnCreateInstance this indicates a bug within gryphn")
});
return GN_FAILED_TO_LOAD_FUNCTION;
}
return (*(PFN_gnCreateInstance*)next->func)(instance, info, next->next);
return next->createInstance(instance, info, next->next);
}
void checkDestroyInstance(gnInstanceHandle instance, PFN_gnDestroyInstance_layer* next) {
if (next->func == NULL) {
void checkDestroyInstance(gnInstanceHandle instance, gryphnInstanceFunctionLayers* next) {
if (next == NULL || next->destroyInstance == NULL) {
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){
.message = gnCreateString("Failed to load gnDestroyInstance this indicates a bug within gryphn")
});
return;
}
(*(PFN_gnDestroyInstance*)next->func)(instance, next->next);
next->destroyInstance(instance, next->next);
}
gnPhysicalDevice* checkGetPhysicalDevices(gnInstanceHandle instance, uint32_t* count) {

View File

@@ -2,8 +2,8 @@
#include "core/src/instance/gryphn_instance.h"
#include <core/src/window_surface/gryphn_surface_create_functions.h>
gnReturnCode checkCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* info, PFN_gnCreateInstance_layer* next);
void checkDestroyInstance(gnInstanceHandle instance, PFN_gnDestroyInstance_layer* next);
gnReturnCode checkCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* info, gryphnInstanceFunctionLayers* next);
void checkDestroyInstance(gnInstanceHandle instance, gryphnInstanceFunctionLayers* next);
gnPhysicalDevice* checkGetPhysicalDevices(gnInstanceHandle instance, uint32_t* count);
gnBool checkCanDevicePresent(gnPhysicalDevice device, gnWindowSurfaceHandle windowSurface);