cleanup
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include "instance/gryphn_instance.h"
|
||||
#include <loader/src/gryphn_instance_functions.h>
|
||||
#include "loader/src/gryphn_loader.h"
|
||||
#include "debugger/gryphn_debugger.h"
|
||||
|
||||
gnReturnCode gnCreateInstance(gnInstanceHandle* instance, gnInstanceInfo info) {
|
||||
*instance = malloc(sizeof(struct gnInstance_t));
|
||||
@@ -13,15 +14,17 @@ gnReturnCode gnCreateInstance(gnInstanceHandle* instance, gnInstanceInfo info) {
|
||||
.layerToLoad = api_layer
|
||||
}));
|
||||
|
||||
loaderLayerArrayListAdd(&(*instance)->layers, loadLayer((loaderInfo){
|
||||
.api = info.renderingAPI,
|
||||
.layerToLoad = function_checker_layer
|
||||
}));
|
||||
gnBool loaderFunctionChecker = gnFalse;
|
||||
for (int i = 0; i < info.debugger->info.layerCount; i++) {
|
||||
if (info.debugger->info.layers[i] == GN_DEBUGGER_LAYER_FUNCTIONS) loaderFunctionChecker = gnTrue;
|
||||
}
|
||||
|
||||
if (loaderFunctionChecker) {
|
||||
loaderLayerArrayListAdd(&(*instance)->layers, loadLayer((loaderInfo){
|
||||
.api = info.renderingAPI,
|
||||
.layerToLoad = function_checker_layer
|
||||
}));
|
||||
}
|
||||
|
||||
(*instance)->currentLayer = ((*instance)->layers.count - 1);
|
||||
for (int i = 0; i < (*instance)->layers.count; i++) (*instance)->layers.data[i].layerIndex = i;
|
||||
|
@@ -6,8 +6,11 @@
|
||||
gnReturnCode checkCreateInstance(gnInstanceHandle instance, gnInstanceInfo info) {
|
||||
loaderLayer* nextLayer = loaderGetNextLayer(instance);
|
||||
if (nextLayer->instanceFunctions._gnCreateInstance == NULL) {
|
||||
return GN_FAILED_TO_LOAD_FUNCTION;
|
||||
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){
|
||||
.message = gnCreateString("Failed to load create instance function")
|
||||
});
|
||||
resetLayer(instance);
|
||||
return GN_FAILED_TO_LOAD_FUNCTION;
|
||||
}
|
||||
return nextLayer->instanceFunctions._gnCreateInstance(instance, info);
|
||||
}
|
||||
@@ -19,8 +22,9 @@ void checkDestroyInstance(gnInstance instance) {
|
||||
.message = gnCreateString("Failed to load destroy instance function")
|
||||
});
|
||||
resetLayer(instance);
|
||||
return;
|
||||
}
|
||||
return nextLayer->instanceFunctions._gnDestroyInstance(instance);
|
||||
nextLayer->instanceFunctions._gnDestroyInstance(instance);
|
||||
}
|
||||
|
||||
gnPhysicalDevice* checkGetPhysicalDevices(gnInstanceHandle instance, uint32_t* count) {
|
||||
|
Reference in New Issue
Block a user