From bb6b1c175d787b9757dd83de17cb5119d7da5e0c Mon Sep 17 00:00:00 2001 From: Greg Wells Date: Sun, 29 Jun 2025 07:50:50 -0400 Subject: [PATCH] cleanup --- projects/core/src/instance/gryphn_instance.c | 19 +++++++++++-------- .../loader/instance_functions.c | 8 ++++++-- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/projects/core/src/instance/gryphn_instance.c b/projects/core/src/instance/gryphn_instance.c index 666a15e..8c6628c 100644 --- a/projects/core/src/instance/gryphn_instance.c +++ b/projects/core/src/instance/gryphn_instance.c @@ -2,6 +2,7 @@ #include "instance/gryphn_instance.h" #include #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; + } - loaderLayerArrayListAdd(&(*instance)->layers, loadLayer((loaderInfo){ - .api = info.renderingAPI, - .layerToLoad = function_checker_layer - })); + 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; diff --git a/projects/validation_layers/function_loader/loader/instance_functions.c b/projects/validation_layers/function_loader/loader/instance_functions.c index f16b693..2adf0b8 100644 --- a/projects/validation_layers/function_loader/loader/instance_functions.c +++ b/projects/validation_layers/function_loader/loader/instance_functions.c @@ -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) {