start to redo validation

This commit is contained in:
Gregory Wells
2025-06-15 20:06:06 -04:00
parent 51e68307eb
commit 4baca92582
13 changed files with 201 additions and 245 deletions

View File

@@ -1,7 +1,6 @@
#include "gryphn_instance.h"
#include "init/gryphn_init.h"
#include <core/gryphn_platform_functions.h>
#include "core/debugger/gryphn_debugger.h"
#include "core/instance/gryphn_instance.h"
#include "stdio.h"
@@ -18,30 +17,11 @@ gnReturnCode gnCreateInstance(gnInstanceHandle* instanceHandlePtr, struct gnInst
instance->functions = malloc(sizeof(struct gnFunctions_t));
instance->loadCommandFunctions = gnFalse;
instance->loadDeviceFunctions = gnFalse;
instance->debugger = info.debugger;
gnLoadFunctions(instance->dynamicLib, instance->functions);
return instance->functions->_gnCreateInstance(instance, info);
}
void gnInstanceAttachDebugger(gnInstanceHandle instance, struct gnDebugger_t *debugger) {
if (instance->debugger != NULL) {
gnDebuggerSetErrorMessage(debugger, (gnMessageData){
.message = gnCreateString("Debugger already attached to instance")
});
}
instance->debugger = debugger;
debugger->instance = instance;
gnReturnCode debuggerInfo = instance->functions->_gnCreateDebugger(debugger, instance, debugger->info);
if (debuggerInfo != GN_SUCCESS) {
gnDebuggerSetErrorMessage(debugger, (gnMessageData){
.message = gnCreateString("Failed to attach debugger to instance")
});
}
}
void gnDestroyInstance(gnInstanceHandle instance) {
if (instance->debugger) instance->functions->_gnDestroyDebugger(instance->debugger);
instance->functions->_gnDestroyInstance(instance);
}
void gnInstanceReleaseDebugger(gnInstanceHandle instance) {
instance->debugger = NULL;
}

View File

@@ -15,6 +15,7 @@ typedef struct gnInstanceInfo_t {
gnVersion engineVersion;
gnRenderingAPI renderingAPI;
gnDebuggerHandle debugger;
} gnInstanceInfo;
#ifdef GN_REVEAL_IMPL
@@ -35,6 +36,4 @@ struct gnInstance_t {
#endif
gnReturnCode gnCreateInstance(gnInstanceHandle* instance, struct gnInstanceInfo_t info);
void gnInstanceAttachDebugger(gnInstanceHandle istance, gnDebuggerHandle debugger);
void gnInstanceReleaseDebugger(gnInstanceHandle instance);
void gnDestroyInstance(gnInstanceHandle instance);

View File

@@ -40,8 +40,8 @@ struct gnDynamicLibrary_t* gnLoadRenderingDLL(gnRenderingAPI renderingAPI) {
void gnLoadFunctions(struct gnDynamicLibrary_t* lib, struct gnFunctions_t* functions) {
gnLoadDLLFunction(lib, functions->_gnCreateInstance, "gnCreateInstanceFn");
gnLoadDLLFunction(lib, functions->_gnDestroyInstance, "gnDestroyInstanceFn");
gnLoadDLLFunction(lib, functions->_gnCreateDebugger, "gnCreateDebuggerFn");
gnLoadDLLFunction(lib, functions->_gnDestroyDebugger, "gnDestroyDebuggerFn");
// gnLoadDLLFunction(lib, functions->_gnCreateDebugger, "gnCreateDebuggerFn");
// gnLoadDLLFunction(lib, functions->_gnDestroyDebugger, "gnDestroyDebuggerFn");
gnLoadDLLFunction(lib, functions->_gnGetPhysicalDevices, "gnGetPhysicalDevicesFn");
gnLoadDLLFunction(lib, functions->_gnQueueCanPresentToSurface, "gnQueueCanPresentToSurfaceFn");
gnLoadDLLFunction(lib, functions->_gnCreateOutputDevoce, "gnCreateOutputDeviceFn");