start to redo validation
This commit is contained in:
@@ -12,12 +12,7 @@ void gnBufferData(gnBufferHandle buffer, size_t dataSize, void* data) {
|
||||
buffer->device->deviceFunctions->_gnBufferData(buffer, dataSize, data);
|
||||
}
|
||||
void* gnMapBuffer(gnBufferHandle buffer) {
|
||||
if (buffer->info.usage == GN_STATIC_DRAW) {
|
||||
gnDebuggerSetErrorMessage(buffer->device->instance->debugger, (gnMessageData){
|
||||
.message = gnCreateString("Cannot map static draw buffers")
|
||||
});
|
||||
return NULL;
|
||||
}
|
||||
if (buffer->info.usage == GN_STATIC_DRAW) return NULL;
|
||||
return buffer->device->deviceFunctions->_gnMapBuffer(buffer);
|
||||
}
|
||||
void gnDestroyBuffer(gnBufferHandle buffer) {
|
||||
|
@@ -1,11 +1,9 @@
|
||||
#include "gryphn_debugger.h"
|
||||
#include <core/gryphn_platform_functions.h>
|
||||
|
||||
gnReturnCode gnCreateDebugger(gnDebuggerHandle* debugger, const struct gnDebuggerInfo_t info) {
|
||||
gnReturnCode gnCreateDebugger(gnDebuggerHandle* debugger, const gnDebuggerInfo info) {
|
||||
*debugger = malloc(sizeof(struct gnDebugger_t));
|
||||
(*debugger)->info = info;
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
void gnDestroyDebugger(gnDebuggerHandle debugger) {
|
||||
// free(debugger);
|
||||
}
|
||||
void gnDestroyDebugger(gnDebuggerHandle debugger) {}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include "stdint.h"
|
||||
#include "utils/gryphn_string.h"
|
||||
#include "utils/gryphn_error_code.h"
|
||||
#include "core/gryphn_handles.h"
|
||||
@@ -7,29 +8,18 @@ struct gnPlatformDebugger_t;
|
||||
|
||||
typedef enum gnMessageSeverity_e {
|
||||
GN_MESSAGE_VERBOSE = 0x00000001,
|
||||
GN_MESSAGE_INFO = 0x00000010,
|
||||
GN_MESSAGE_WARNING = 0x00000100,
|
||||
GN_MESSAGE_ERROR = 0x00001000,
|
||||
GN_MESSAGE_INFO = 0x00000002,
|
||||
GN_MESSAGE_WARNING = 0x00000004,
|
||||
GN_MESSAGE_ERROR = 0x00000008,
|
||||
} gnMessageSeverity;
|
||||
|
||||
typedef enum gnMessageType_e {
|
||||
GN_DEBUG_MESSAGE_GENERAL = 0x00000001,
|
||||
GN_DEBUG_MESSAGE_VALIDATION = 0x00000002,
|
||||
GN_DEBUG_MESSAGE_PERFORMANCE = 0x00000004,
|
||||
// GN_DEBUG_MESSAGE_ADDRESS_BINDING = 0x00000008, vulkan had this but imma leave it out
|
||||
} gnMessageType;
|
||||
|
||||
typedef struct gnMessageData {
|
||||
// const char* pMessageIdName;
|
||||
// int32_t messageIdNumber;
|
||||
// uint32_t queueLabelCount;
|
||||
// const VkDebugUtilsLabelEXT* pQueueLabels;
|
||||
// uint32_t cmdBufLabelCount;
|
||||
// const VkDebugUtilsLabelEXT* pCmdBufLabels;
|
||||
// uint32_t objectCount;
|
||||
// const VkDebugUtilsObjectNameInfoEXT* pObjects;
|
||||
//
|
||||
// If i ever figure out what this shit does il add it
|
||||
gnString message;
|
||||
} gnMessageData;
|
||||
|
||||
@@ -39,20 +29,26 @@ typedef gnBool (*gnDebuggerCallback)(
|
||||
gnMessageData messageData,
|
||||
void* userData);
|
||||
|
||||
typedef struct gnDebuggerInfo_t {
|
||||
typedef enum gnDebuggerLayer {
|
||||
GN_DEBUGGER_LAYER_PLATFORM // enable platform (vulkan validation) layers
|
||||
} gnDebuggerLayer;
|
||||
|
||||
typedef struct gnDebuggerInfo {
|
||||
gnDebuggerCallback callback;
|
||||
void* userData;
|
||||
|
||||
uint32_t layerCount;
|
||||
gnDebuggerLayer* layers;
|
||||
} gnDebuggerInfo;
|
||||
|
||||
#ifdef GN_REVEAL_IMPL
|
||||
|
||||
struct gnDebugger_t {
|
||||
struct gnPlatformDebugger_t* debugger;
|
||||
struct gnDebuggerInfo_t info;
|
||||
gnInstanceHandle instance;
|
||||
gnDebuggerInfo info;
|
||||
};
|
||||
#endif
|
||||
|
||||
gnReturnCode gnCreateDebugger(gnDebuggerHandle* debugger, const struct gnDebuggerInfo_t info);
|
||||
gnReturnCode gnCreateDebugger(gnDebuggerHandle* debugger, const gnDebuggerInfo info);
|
||||
void gnDestroyDebugger(gnDebuggerHandle debugger);
|
||||
|
||||
#ifdef GN_REVEAL_IMPL
|
||||
|
@@ -2,7 +2,7 @@
|
||||
// theoretically you could have multible gryphn instances running in one application,
|
||||
// why I dont know
|
||||
#include "instance/gryphn_instance.h"
|
||||
#include "debugger/gryphn_debugger.h"
|
||||
// #include "debugger/gryphn_debugger.h"
|
||||
#include "output_device/gryphn_physical_output_device.h"
|
||||
#include "output_device/gryphn_output_device.h"
|
||||
#include "window_surface/gryphn_surface.h"
|
||||
@@ -24,13 +24,9 @@ typedef struct gnFunctions_t {
|
||||
gnReturnCode (*_gnCreateInstance)(gnInstanceHandle instance, gnInstanceInfo info);
|
||||
void (*_gnDestroyInstance)(gnInstanceHandle instance);
|
||||
|
||||
gnReturnCode (*_gnCreateDebugger)(gnDebuggerHandle debugger, gnInstanceHandle instance, const gnDebuggerInfo info);
|
||||
void (*_gnDestroyDebugger)(gnDebuggerHandle debugger);
|
||||
|
||||
gnPhysicalDevice* (*_gnGetPhysicalDevices)(gnInstanceHandle instance, uint32_t* count);
|
||||
gnBool (*_gnQueueCanPresentToSurface)(const gnPhysicalDevice device, uint32_t queueIndex, const gnWindowSurfaceHandle windowSurface);
|
||||
|
||||
|
||||
gnReturnCode (*_gnCreateOutputDevoce)(gnOutputDeviceHandle device, gnInstanceHandle instance, struct gnOutputDeviceInfo_t deviceInfo);
|
||||
void (*_gnDestroyOutputDevice)(gnOutputDeviceHandle device);
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -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");
|
||||
|
@@ -1,6 +1,5 @@
|
||||
#include "gryphn_physical_output_device.h"
|
||||
#include "core/gryphn_platform_functions.h"
|
||||
#include "stdio.h"
|
||||
|
||||
gnPhysicalDevice* gnGetPhyscialDevices(gnInstanceHandle instance, uint32_t* count) {
|
||||
gnPhysicalDevice* devices = instance->functions->_gnGetPhysicalDevices(instance, count);
|
||||
@@ -11,14 +10,14 @@ gnPhysicalDevice* gnGetPhyscialDevices(gnInstanceHandle instance, uint32_t* coun
|
||||
}
|
||||
|
||||
gnBool gnQueueCanPresentToSurface(const struct gnPhysicalDevice_t device, uint32_t queueIndex, gnWindowSurfaceHandle windowSurface) {
|
||||
if (queueIndex >= device.queueProperties.queueCount) {
|
||||
gnDebuggerSetErrorMessage(device.instance->debugger,
|
||||
(gnMessageData){
|
||||
.message = gnCreateString("gnQueueCanPresentToSurface queue index passed in is large then queueProperties.queueCount")
|
||||
}
|
||||
);
|
||||
return gnFalse;
|
||||
}
|
||||
// if (queueIndex >= device.queueProperties.queueCount) {
|
||||
// gnDebuggerSetErrorMessage(device.instance->debugger,
|
||||
// (gnMessageData){
|
||||
// .message = gnCreateString("gnQueueCanPresentToSurface queue index passed in is large then queueProperties.queueCount")
|
||||
// }
|
||||
// );
|
||||
// return gnFalse;
|
||||
// }
|
||||
return device.instance->functions->_gnQueueCanPresentToSurface(device, queueIndex, windowSurface);
|
||||
}
|
||||
|
||||
@@ -46,11 +45,11 @@ int gnGetGraphicsQueueIndex(const struct gnPhysicalDevice_t device) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
gnDebuggerSetErrorMessage(device.instance->debugger,
|
||||
(gnMessageData){
|
||||
.message = gnCreateString("gnGetGraphicsQueueIndex failed no queue that support graphics on this device")
|
||||
}
|
||||
);
|
||||
// gnDebuggerSetErrorMessage(device.instance->debugger,
|
||||
// (gnMessageData){
|
||||
// .message = gnCreateString("gnGetGraphicsQueueIndex failed no queue that support graphics on this device")
|
||||
// }
|
||||
// );
|
||||
return -1;
|
||||
}
|
||||
int gnGetPresentQueueIndex(const struct gnPhysicalDevice_t device, gnWindowSurfaceHandle windowSurface) {
|
||||
@@ -60,10 +59,10 @@ int gnGetPresentQueueIndex(const struct gnPhysicalDevice_t device, gnWindowSurfa
|
||||
break;
|
||||
}
|
||||
}
|
||||
gnDebuggerSetErrorMessage(device.instance->debugger,
|
||||
(gnMessageData){
|
||||
.message = gnCreateString("gnGetPresentQueueIndex failed no queue that support presenting to this window surface")
|
||||
}
|
||||
);
|
||||
// gnDebuggerSetErrorMessage(device.instance->debugger,
|
||||
// (gnMessageData){
|
||||
// .message = gnCreateString("gnGetPresentQueueIndex failed no queue that support presenting to this window surface")
|
||||
// }
|
||||
// );
|
||||
return -1;
|
||||
}
|
||||
|
Submodule src/utils updated: 5b05fb287d...c5049bda3d
Reference in New Issue
Block a user