debugger handles
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
#include <core/debugger/gryphn_debugger.h>
|
#include <core/debugger/gryphn_debugger.h>
|
||||||
|
|
||||||
// these do nothing because I am too lazy to write a debugger for metal at this point in time
|
// these do nothing because I am too lazy to write a debugger for metal at this point in time
|
||||||
gnReturnCode gnCreateDebuggerFn(gnDebugger* debugger, gnInstanceHandle instance, const struct gnDebuggerInfo_t info) {
|
gnReturnCode gnCreateDebuggerFn(gnDebuggerHandle debugger, gnInstanceHandle instance, const struct gnDebuggerInfo_t info) {
|
||||||
return GN_SUCCESS;
|
return GN_SUCCESS;
|
||||||
}
|
}
|
||||||
void gnDestroyDebuggerFn(gnDebugger* instance) {
|
void gnDestroyDebuggerFn(gnDebuggerHandle instance) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -90,7 +90,7 @@ void vk_destroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessenger
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gnReturnCode gnCreateDebuggerFn(gnDebugger* debugger, gnInstanceHandle instance, const struct gnDebuggerInfo_t info) {
|
gnReturnCode gnCreateDebuggerFn(gnDebuggerHandle debugger, gnInstanceHandle instance, const struct gnDebuggerInfo_t info) {
|
||||||
debugger->debugger = malloc(sizeof(gnPlatformDebugger));
|
debugger->debugger = malloc(sizeof(gnPlatformDebugger));
|
||||||
|
|
||||||
if (instance->valid == gnFalse) {
|
if (instance->valid == gnFalse) {
|
||||||
@@ -156,6 +156,6 @@ gnReturnCode gnCreateDebuggerFn(gnDebugger* debugger, gnInstanceHandle instance,
|
|||||||
return GN_SUCCESS;
|
return GN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gnDestroyDebuggerFn(gnDebugger* debugger) {
|
void gnDestroyDebuggerFn(gnDebuggerHandle debugger) {
|
||||||
vk_destroyDebugUtilsMessengerEXT(debugger->instance->instance->vk_instance, debugger->debugger->debugMessenger, NULL);
|
vk_destroyDebugUtilsMessengerEXT(debugger->instance->instance->vk_instance, debugger->debugger->debugMessenger, NULL);
|
||||||
}
|
}
|
||||||
|
@@ -2,10 +2,11 @@
|
|||||||
#include <core/gryphn_platform_functions.h>
|
#include <core/gryphn_platform_functions.h>
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
|
|
||||||
gnReturnCode gnCreateDebugger(gnDebugger* debugger, const struct gnDebuggerInfo_t info) {
|
gnReturnCode gnCreateDebugger(gnDebuggerHandle* debugger, const struct gnDebuggerInfo_t info) {
|
||||||
debugger->info = info;
|
*debugger = malloc(sizeof(struct gnDebugger_t));
|
||||||
|
(*debugger)->info = info;
|
||||||
return GN_SUCCESS;
|
return GN_SUCCESS;
|
||||||
}
|
}
|
||||||
void gnDestroyDebugger(gnDebugger* debugger) {
|
void gnDestroyDebugger(gnDebuggerHandle debugger) {
|
||||||
// debugger->instance->functions->_gnDestroyDebugger(debugger);
|
free(debugger);
|
||||||
}
|
}
|
||||||
|
@@ -44,16 +44,23 @@ typedef struct gnDebuggerInfo_t {
|
|||||||
void* userData;
|
void* userData;
|
||||||
} gnDebuggerInfo;
|
} gnDebuggerInfo;
|
||||||
|
|
||||||
typedef struct gnDebugger_t {
|
#ifdef GN_REVEAL_IMPL
|
||||||
|
struct gnDebugger_t {
|
||||||
struct gnPlatformDebugger_t* debugger;
|
struct gnPlatformDebugger_t* debugger;
|
||||||
struct gnDebuggerInfo_t info;
|
struct gnDebuggerInfo_t info;
|
||||||
gnInstanceHandle instance;
|
gnInstanceHandle instance;
|
||||||
} gnDebugger;
|
};
|
||||||
|
#endif
|
||||||
|
typedef struct gnDebugger_t* gnDebuggerHandle;
|
||||||
|
typedef gnDebuggerHandle gnDebugger;
|
||||||
|
|
||||||
gnReturnCode gnCreateDebugger(gnDebugger* debugger, const struct gnDebuggerInfo_t info);
|
gnReturnCode gnCreateDebugger(gnDebuggerHandle* debugger, const struct gnDebuggerInfo_t info);
|
||||||
void gnDestroyDebugger(gnDebugger* debugger);
|
void gnDestroyDebugger(gnDebuggerHandle debugger);
|
||||||
|
|
||||||
|
#ifdef GN_REVEAL_IMPL
|
||||||
|
static void gnDebuggerSetErrorMessage(gnDebuggerHandle debugger, gnMessageData data) {
|
||||||
|
if (debugger == NULL) return;
|
||||||
|
|
||||||
static void gnDebuggerSetErrorMessage(gnDebugger* debugger, gnMessageData data) {
|
|
||||||
debugger->info.callback(
|
debugger->info.callback(
|
||||||
GN_MESSAGE_ERROR,
|
GN_MESSAGE_ERROR,
|
||||||
GN_DEBUG_MESSAGE_VALIDATION,
|
GN_DEBUG_MESSAGE_VALIDATION,
|
||||||
@@ -61,3 +68,4 @@ static void gnDebuggerSetErrorMessage(gnDebugger* debugger, gnMessageData data)
|
|||||||
debugger->info.userData
|
debugger->info.userData
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@@ -23,8 +23,8 @@ typedef struct gnFunctions_t {
|
|||||||
gnReturnCode (*_gnCreateInstance)(gnInstanceHandle instance, struct gnInstanceInfo_t info);
|
gnReturnCode (*_gnCreateInstance)(gnInstanceHandle instance, struct gnInstanceInfo_t info);
|
||||||
void (*_gnDestroyInstance)(gnInstanceHandle instance);
|
void (*_gnDestroyInstance)(gnInstanceHandle instance);
|
||||||
|
|
||||||
gnReturnCode (*_gnCreateDebugger)(gnDebugger* debugger, gnInstanceHandle instance, const struct gnDebuggerInfo_t info);
|
gnReturnCode (*_gnCreateDebugger)(gnDebuggerHandle debugger, gnInstanceHandle instance, const struct gnDebuggerInfo_t info);
|
||||||
void (*_gnDestroyDebugger)(gnDebugger* debugger);
|
void (*_gnDestroyDebugger)(gnDebuggerHandle debugger);
|
||||||
|
|
||||||
gnPhysicalDevice* (*_gnGetPhysicalDevices)(gnInstanceHandle instance, uint32_t* count);
|
gnPhysicalDevice* (*_gnGetPhysicalDevices)(gnInstanceHandle instance, uint32_t* count);
|
||||||
gnBool (*_gnQueueCanPresentToSurface)(const struct gnPhysicalDevice_t device, uint32_t queueIndex, const struct gnWindowSurface_t windowSurface);
|
gnBool (*_gnQueueCanPresentToSurface)(const struct gnPhysicalDevice_t device, uint32_t queueIndex, const struct gnWindowSurface_t windowSurface);
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
#include "init/gryphn_init.h"
|
#include "init/gryphn_init.h"
|
||||||
#include <core/gryphn_platform_functions.h>
|
#include <core/gryphn_platform_functions.h>
|
||||||
#include "core/debugger/gryphn_debugger.h"
|
#include "core/debugger/gryphn_debugger.h"
|
||||||
|
#include "core/instance/gryphn_instance.h"
|
||||||
|
|
||||||
gnReturnCode gnCreateInstance(gnInstanceHandle* instanceHandlePtr, struct gnInstanceInfo_t info) {
|
gnReturnCode gnCreateInstance(gnInstanceHandle* instanceHandlePtr, struct gnInstanceInfo_t info) {
|
||||||
*instanceHandlePtr = malloc(sizeof(struct gnInstance_t));
|
*instanceHandlePtr = malloc(sizeof(struct gnInstance_t));
|
||||||
@@ -42,4 +43,5 @@ void gnDestroyInstance(gnInstanceHandle instance) {
|
|||||||
|
|
||||||
void gnInstanceReleaseDebugger(gnInstanceHandle instance) {
|
void gnInstanceReleaseDebugger(gnInstanceHandle instance) {
|
||||||
instance->debugger = NULL;
|
instance->debugger = NULL;
|
||||||
|
free(instance);
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
struct gnPlatformInstance_t;
|
struct gnPlatformInstance_t;
|
||||||
struct gnFunctions_t;
|
struct gnFunctions_t;
|
||||||
struct gnDynamicLibrary_t;
|
struct gnDynamicLibrary_t;
|
||||||
struct gnDebugger_t;
|
typedef struct gnDebugger_t* gnDebuggerHandle;
|
||||||
|
|
||||||
typedef struct gnInstanceInfo_t {
|
typedef struct gnInstanceInfo_t {
|
||||||
gnString applicationName;
|
gnString applicationName;
|
||||||
@@ -17,6 +17,7 @@ typedef struct gnInstanceInfo_t {
|
|||||||
gnRenderingAPI renderingAPI;
|
gnRenderingAPI renderingAPI;
|
||||||
} gnInstanceInfo;
|
} gnInstanceInfo;
|
||||||
|
|
||||||
|
#ifdef GN_REVEAL_IMPL
|
||||||
struct gnInstance_t {
|
struct gnInstance_t {
|
||||||
struct gnPlatformInstance_t* instance;
|
struct gnPlatformInstance_t* instance;
|
||||||
gnBool valid,
|
gnBool valid,
|
||||||
@@ -29,12 +30,13 @@ struct gnInstance_t {
|
|||||||
struct gnDeviceFunctions_t* deviceFunctions;
|
struct gnDeviceFunctions_t* deviceFunctions;
|
||||||
struct gnCommandFunctions_t* commandFunctions;
|
struct gnCommandFunctions_t* commandFunctions;
|
||||||
|
|
||||||
struct gnDebugger_t* debugger;
|
gnDebuggerHandle debugger;
|
||||||
} gnInstance_t;
|
};
|
||||||
|
#endif
|
||||||
typedef struct gnInstance_t* gnInstanceHandle;
|
typedef struct gnInstance_t* gnInstanceHandle;
|
||||||
|
typedef struct gnInstance_t* gnInstance;
|
||||||
|
|
||||||
gnReturnCode gnCreateInstance(gnInstanceHandle* instance, struct gnInstanceInfo_t info);
|
gnReturnCode gnCreateInstance(gnInstanceHandle* instance, struct gnInstanceInfo_t info);
|
||||||
void gnInstanceAttachDebugger(gnInstanceHandle istance, struct gnDebugger_t* debugger);
|
void gnInstanceAttachDebugger(gnInstanceHandle istance, gnDebuggerHandle debugger);
|
||||||
void gnInstanceReleaseDebugger(gnInstanceHandle instance);
|
void gnInstanceReleaseDebugger(gnInstanceHandle instance);
|
||||||
void gnDestroyInstance(gnInstanceHandle instance);
|
void gnDestroyInstance(gnInstanceHandle instance);
|
||||||
|
Reference in New Issue
Block a user