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