load the actuall first layer
This commit is contained in:
@@ -6,17 +6,22 @@
|
|||||||
gnReturnCode gnCreateInstance(gnInstanceHandle* instance, gnInstanceInfo info) {
|
gnReturnCode gnCreateInstance(gnInstanceHandle* instance, gnInstanceInfo info) {
|
||||||
*instance = malloc(sizeof(struct gnInstance_t));
|
*instance = malloc(sizeof(struct gnInstance_t));
|
||||||
|
|
||||||
|
(*instance)->layers = loaderLayerArrayListCreate();
|
||||||
|
|
||||||
|
// load the API layers (this will)
|
||||||
loaderInfo loadInfo = {
|
loaderInfo loadInfo = {
|
||||||
.api = info.renderingAPI
|
.api = info.renderingAPI,
|
||||||
|
.layerToLoad = api_layer
|
||||||
};
|
};
|
||||||
|
|
||||||
(*instance)->instanceFunctions = loadInstanceFunctions(loadInfo);
|
loaderLayerArrayListAdd(&(*instance)->layers, loadLayer(loadInfo));
|
||||||
(*instance)->deviceFunctions = loadDeviceFunctions(loadInfo);
|
|
||||||
(*instance)->commandFunctions = loadCommandFunctions(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;
|
(*instance)->debugger = info.debugger;
|
||||||
return (*instance)->instanceFunctions._gnCreateInstance((*instance), info);
|
return (*instance)->callingLayer->instanceFunctions._gnCreateInstance((*instance), info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gnDestroyInstance(gnInstanceHandle instance) {
|
void gnDestroyInstance(gnInstanceHandle instance) {
|
||||||
instance->instanceFunctions._gnDestroyInstance(instance);
|
instance->callingLayer->instanceFunctions._gnDestroyInstance(instance);
|
||||||
}
|
}
|
||||||
|
@@ -3,9 +3,7 @@
|
|||||||
#include "gryphn_handles.h"
|
#include "gryphn_handles.h"
|
||||||
#include "utils/gryphn_version.h"
|
#include "utils/gryphn_version.h"
|
||||||
#include "utils/gryphn_error_code.h"
|
#include "utils/gryphn_error_code.h"
|
||||||
#include "loader/src/gryphn_instance_functions.h"
|
#include "loader/src/gryphn_loader.h"
|
||||||
#include "loader/src/gryphn_device_functions.h"
|
|
||||||
#include "loader/src/gryphn_command_functions.h"
|
|
||||||
|
|
||||||
typedef struct gnInstanceInfo {
|
typedef struct gnInstanceInfo {
|
||||||
gnString applicationName;
|
gnString applicationName;
|
||||||
@@ -23,9 +21,8 @@ struct gnInstance_t {
|
|||||||
struct gnPlatformInstance_t* instance;
|
struct gnPlatformInstance_t* instance;
|
||||||
gnBool valid;
|
gnBool valid;
|
||||||
|
|
||||||
gnInstanceFunctions instanceFunctions;
|
loaderLayerArrayList layers;
|
||||||
gnDeviceFunctions deviceFunctions;
|
loaderLayer* callingLayer;
|
||||||
gnCommandFunctions commandFunctions;
|
|
||||||
|
|
||||||
gnDebuggerHandle debugger;
|
gnDebuggerHandle debugger;
|
||||||
};
|
};
|
||||||
|
@@ -81,8 +81,6 @@ loaderLayer api_loaded_layer(gnRenderingAPI api) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loaderLayer loadLayer(loaderInfo info) {
|
loaderLayer loadLayer(loaderInfo info) {
|
||||||
if (info.layerToLoad == no_layer) return null_layer();
|
|
||||||
if (info.layerToLoad == api_layer) return api_loaded_layer(info.api);
|
if (info.layerToLoad == api_layer) return api_loaded_layer(info.api);
|
||||||
|
|
||||||
return null_layer();
|
return null_layer();
|
||||||
}
|
}
|
||||||
|
@@ -6,9 +6,15 @@
|
|||||||
#include "utils/lists/gryphn_array_list.h"
|
#include "utils/lists/gryphn_array_list.h"
|
||||||
|
|
||||||
typedef struct loaderLayer {
|
typedef struct loaderLayer {
|
||||||
|
// idk why I sperate these info different classes, I should really shove them in one bit class
|
||||||
|
// they used to be loaded seperatly but I guess there not anymore
|
||||||
|
// initlization is hard
|
||||||
gnInstanceFunctions instanceFunctions;
|
gnInstanceFunctions instanceFunctions;
|
||||||
gnDeviceFunctions deviceFunctions;
|
gnDeviceFunctions deviceFunctions;
|
||||||
gnCommandFunctions commandFunctions;
|
gnCommandFunctions commandFunctions;
|
||||||
|
|
||||||
|
// this index is not set by loadLayer, set by gnCreateInstance
|
||||||
|
uint32_t layerIndex;
|
||||||
} loaderLayer;
|
} loaderLayer;
|
||||||
|
|
||||||
loaderLayer loadLayer(loaderInfo info);
|
loaderLayer loadLayer(loaderInfo info);
|
||||||
|
Reference in New Issue
Block a user