load the actuall first layer

This commit is contained in:
Greg Wells
2025-06-26 14:13:24 -04:00
parent b39fc43905
commit ab3bd566d2
4 changed files with 20 additions and 14 deletions

View File

@@ -6,17 +6,22 @@
gnReturnCode gnCreateInstance(gnInstanceHandle* instance, gnInstanceInfo info) {
*instance = malloc(sizeof(struct gnInstance_t));
(*instance)->layers = loaderLayerArrayListCreate();
// load the API layers (this will)
loaderInfo loadInfo = {
.api = info.renderingAPI
.api = info.renderingAPI,
.layerToLoad = api_layer
};
(*instance)->instanceFunctions = loadInstanceFunctions(loadInfo);
(*instance)->deviceFunctions = loadDeviceFunctions(loadInfo);
(*instance)->commandFunctions = loadCommandFunctions(loadInfo);
loaderLayerArrayListAdd(&(*instance)->layers, loadLayer(loadInfo));
// i hate this line of code but im not fixing it
(*instance)->callingLayer = &(*instance)->layers.data[(*instance)->layers.count - 1];
(*instance)->debugger = info.debugger;
return (*instance)->instanceFunctions._gnCreateInstance((*instance), info);
return (*instance)->callingLayer->instanceFunctions._gnCreateInstance((*instance), info);
}
void gnDestroyInstance(gnInstanceHandle instance) {
instance->instanceFunctions._gnDestroyInstance(instance);
instance->callingLayer->instanceFunctions._gnDestroyInstance(instance);
}

View File

@@ -3,9 +3,7 @@
#include "gryphn_handles.h"
#include "utils/gryphn_version.h"
#include "utils/gryphn_error_code.h"
#include "loader/src/gryphn_instance_functions.h"
#include "loader/src/gryphn_device_functions.h"
#include "loader/src/gryphn_command_functions.h"
#include "loader/src/gryphn_loader.h"
typedef struct gnInstanceInfo {
gnString applicationName;
@@ -23,9 +21,8 @@ struct gnInstance_t {
struct gnPlatformInstance_t* instance;
gnBool valid;
gnInstanceFunctions instanceFunctions;
gnDeviceFunctions deviceFunctions;
gnCommandFunctions commandFunctions;
loaderLayerArrayList layers;
loaderLayer* callingLayer;
gnDebuggerHandle debugger;
};