remove gnCreateDebugger function
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
// core functionality
|
// core functionality
|
||||||
#include <core/src/instance/gryphn_instance.h>
|
#include <core/src/instance/gryphn_instance.h>
|
||||||
#include <core/src/debugger/gryphn_debugger.h>
|
|
||||||
#include <core/src/output_device/gryphn_physical_output_device.h>
|
#include <core/src/output_device/gryphn_physical_output_device.h>
|
||||||
#include <core/src/window_surface/gryphn_surface.h>
|
#include <core/src/window_surface/gryphn_surface.h>
|
||||||
#include <core/src/window_surface/gryphn_surface_create_functions.h>
|
#include <core/src/window_surface/gryphn_surface_create_functions.h>
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
#include "metal_command_buffer.h"
|
#include "metal_command_buffer.h"
|
||||||
#include "commands/command_pool/metal_command_pool.h"
|
#include "commands/command_pool/metal_command_pool.h"
|
||||||
#include "debugger/gryphn_debugger.h"
|
|
||||||
#include "instance/gryphn_instance.h"
|
#include "instance/gryphn_instance.h"
|
||||||
#import <Metal/Metal.h>
|
#import <Metal/Metal.h>
|
||||||
|
|
||||||
|
@@ -1,9 +0,0 @@
|
|||||||
#include <debugger/gryphn_debugger.h>
|
|
||||||
|
|
||||||
// these do nothing because I am too lazy to write a debugger for metal at this point in time
|
|
||||||
gnReturnCode gnCreateDebuggerFn(gnDebuggerHandle debugger, gnInstanceHandle instance, const gnDebuggerInfo info) {
|
|
||||||
return GN_SUCCESS;
|
|
||||||
}
|
|
||||||
void gnDestroyDebuggerFn(gnDebuggerHandle instance) {
|
|
||||||
|
|
||||||
}
|
|
@@ -3,7 +3,6 @@
|
|||||||
#include "metal_output_devices.h"
|
#include "metal_output_devices.h"
|
||||||
#include "instance/metal_instance.h"
|
#include "instance/metal_instance.h"
|
||||||
#include "instance/gryphn_instance.h"
|
#include "instance/gryphn_instance.h"
|
||||||
#include <debugger/gryphn_debugger.h>
|
|
||||||
|
|
||||||
gnReturnCode createMetalOutputDevice(gnOutputDeviceHandle outputDevice, gnInstanceHandle instance, gnOutputDeviceInfo deviceInfo) {
|
gnReturnCode createMetalOutputDevice(gnOutputDeviceHandle outputDevice, gnInstanceHandle instance, gnOutputDeviceInfo deviceInfo) {
|
||||||
outputDevice->outputDevice = malloc(sizeof(gnPlatformOutputDevice));
|
outputDevice->outputDevice = malloc(sizeof(gnPlatformOutputDevice));
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
#include "metal_framebuffer.h"
|
#include "metal_framebuffer.h"
|
||||||
#include "debugger/gryphn_debugger.h"
|
|
||||||
#include "texture/metal_texture.h"
|
#include "texture/metal_texture.h"
|
||||||
#include "renderpass/gryphn_render_pass_descriptor.h"
|
#include "renderpass/gryphn_render_pass_descriptor.h"
|
||||||
#include "instance/gryphn_instance.h"
|
#include "instance/gryphn_instance.h"
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
#include "metal_graphics_pipeline.h"
|
#include "metal_graphics_pipeline.h"
|
||||||
#include "devices/metal_output_devices.h"
|
#include "devices/metal_output_devices.h"
|
||||||
#include "debugger/gryphn_debugger.h"
|
|
||||||
#include "shader_module/metal_shader_module.h"
|
#include "shader_module/metal_shader_module.h"
|
||||||
#include "surface/metal_surface.h"
|
#include "surface/metal_surface.h"
|
||||||
#include "texture/metal_texture.h"
|
#include "texture/metal_texture.h"
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
#include "devices/metal_output_devices.h"
|
#include "devices/metal_output_devices.h"
|
||||||
#include "sync/semaphore/metal_semaphore.h"
|
#include "sync/semaphore/metal_semaphore.h"
|
||||||
#include "presentation_queue/metal_presentation_queue.h"
|
#include "presentation_queue/metal_presentation_queue.h"
|
||||||
#include "debugger/gryphn_debugger.h"
|
|
||||||
#include "texture/metal_texture.h"
|
#include "texture/metal_texture.h"
|
||||||
#import <QuartzCore/CAMetalLayer.h>
|
#import <QuartzCore/CAMetalLayer.h>
|
||||||
|
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
#include "metal_presentation_queue.h"
|
#include "metal_presentation_queue.h"
|
||||||
#include "surface/metal_surface.h"
|
#include "surface/metal_surface.h"
|
||||||
#include "devices/metal_output_devices.h"
|
#include "devices/metal_output_devices.h"
|
||||||
#include "debugger/gryphn_debugger.h"
|
|
||||||
#include "texture/metal_texture.h"
|
#include "texture/metal_texture.h"
|
||||||
#include "sync/semaphore/metal_semaphore.h"
|
#include "sync/semaphore/metal_semaphore.h"
|
||||||
|
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
#include "metal_shader_module.h"
|
#include "metal_shader_module.h"
|
||||||
#include "spirv_cross_c.h"
|
#include "spirv_cross_c.h"
|
||||||
#include "debugger/gryphn_debugger.h"
|
#include "instance/gryphn_debugger.h"
|
||||||
#include "devices/metal_output_devices.h"
|
#include "devices/metal_output_devices.h"
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import <Metal/Metal.h>
|
#import <Metal/Metal.h>
|
||||||
|
|
||||||
void mtlSpirVErrorCallback(void *userdata, const char *error) {
|
void mtlSpirVErrorCallback(void *userdata, const char *error) {
|
||||||
gnDebugger debugger = (gnDebugger)userdata;
|
gnDebuggerInfo debugger = *((gnDebuggerInfo*)userdata);
|
||||||
gnDebuggerSetErrorMessage(debugger, (gnMessageData){
|
gnDebuggerSetErrorMessage(debugger, (gnMessageData){
|
||||||
.message = gnCombineStrings(gnCreateString("shader compilation error MSL "), gnCreateString(error))
|
.message = gnCombineStrings(gnCreateString("shader compilation error MSL "), gnCreateString(error))
|
||||||
});
|
});
|
||||||
@@ -25,7 +25,7 @@ gnReturnCode createMetalShaderModule(gnShaderModule module, gnDevice device, gnS
|
|||||||
size_t count;
|
size_t count;
|
||||||
|
|
||||||
spvc_context_create(&context);
|
spvc_context_create(&context);
|
||||||
spvc_context_set_error_callback(context, mtlSpirVErrorCallback, module->device->instance->debugger);
|
spvc_context_set_error_callback(context, mtlSpirVErrorCallback, &module->device->instance->debugger);
|
||||||
spvc_context_parse_spirv(context, shaderModuleInfo.code, shaderModuleInfo.size / 4, &ir);
|
spvc_context_parse_spirv(context, shaderModuleInfo.code, shaderModuleInfo.size / 4, &ir);
|
||||||
spvc_context_create_compiler(context, SPVC_BACKEND_MSL, ir, SPVC_CAPTURE_MODE_COPY, &compiler);
|
spvc_context_create_compiler(context, SPVC_BACKEND_MSL, ir, SPVC_CAPTURE_MODE_COPY, &compiler);
|
||||||
|
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
#include "submit/gryphn_submit.h"
|
#include "submit/gryphn_submit.h"
|
||||||
#include "sync/semaphore/metal_semaphore.h"
|
#include "sync/semaphore/metal_semaphore.h"
|
||||||
#include "commands/command_buffer/metal_command_buffer.h"
|
#include "commands/command_buffer/metal_command_buffer.h"
|
||||||
#include "debugger/gryphn_debugger.h"
|
|
||||||
#include "commands/command_pool/metal_command_pool.h"
|
#include "commands/command_pool/metal_command_pool.h"
|
||||||
#include "synchronization/commands/gryphn_sync_submit.h"
|
#include "synchronization/commands/gryphn_sync_submit.h"
|
||||||
|
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
#include "vulkan_debugger.h"
|
// #include "vulkan_debugger.h"
|
||||||
#include <instance/vulkan_instance.h>
|
// #include <instance/vulkan_instance.h>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
// #pragma once
|
||||||
#include <vulkan/vulkan.h>
|
// #include <vulkan/vulkan.h>
|
||||||
#include <debugger/gryphn_debugger.h>
|
// #include <debugger/gryphn_debugger.h>
|
||||||
|
|
||||||
typedef struct gnPlatformDebugger_t {
|
// typedef struct gnPlatformDebugger_t {
|
||||||
VkDebugUtilsMessengerEXT debugMessenger;
|
// VkDebugUtilsMessengerEXT debugMessenger;
|
||||||
} gnPlatformDebugger;
|
// } gnPlatformDebugger;
|
||||||
|
@@ -80,8 +80,8 @@ gnReturnCode createInstance(gnInstanceHandle instance, gnInstanceInfo instanceIn
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (instanceInfo.debugger != NULL) {
|
if (instanceInfo.debugger != NULL) {
|
||||||
for (int i = 0; i < instanceInfo.debugger->info.layerCount; i++) {
|
for (int i = 0; i < instanceInfo.debugger->layerCount; i++) {
|
||||||
if (instanceInfo.debugger->info.layers[i] == GN_DEBUGGER_LAYER_PLATFORM) {
|
if (instanceInfo.debugger->layers[i] == GN_DEBUGGER_LAYER_PLATFORM) {
|
||||||
vkStringArrayListAdd(&extensions, VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
|
vkStringArrayListAdd(&extensions, VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
|
||||||
|
|
||||||
const char* validation_layers[1] = { "VK_LAYER_KHRONOS_validation" };
|
const char* validation_layers[1] = { "VK_LAYER_KHRONOS_validation" };
|
||||||
@@ -89,8 +89,8 @@ gnReturnCode createInstance(gnInstanceHandle instance, gnInstanceInfo instanceIn
|
|||||||
createInfo.ppEnabledLayerNames = (const char*[]){ "VK_LAYER_KHRONOS_validation" };
|
createInfo.ppEnabledLayerNames = (const char*[]){ "VK_LAYER_KHRONOS_validation" };
|
||||||
|
|
||||||
vkUserData* userData = malloc(sizeof(vkUserData));
|
vkUserData* userData = malloc(sizeof(vkUserData));
|
||||||
userData->debuggerCallback = instanceInfo.debugger->info.callback;
|
userData->debuggerCallback = instanceInfo.debugger->callback;
|
||||||
userData->userData = instanceInfo.debugger->info.userData;
|
userData->userData = instanceInfo.debugger->userData;
|
||||||
|
|
||||||
VkDebugUtilsMessengerCreateInfoEXT debugCreateInfo = {
|
VkDebugUtilsMessengerCreateInfoEXT debugCreateInfo = {
|
||||||
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT,
|
.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT,
|
||||||
|
@@ -34,7 +34,7 @@ gnReturnCode createOutputDevice(gnOutputDeviceHandle outputDevice, gnInstanceHan
|
|||||||
for (int i = 0; i < deviceCreateInfo.enabledExtensionCount; i++)
|
for (int i = 0; i < deviceCreateInfo.enabledExtensionCount; i++)
|
||||||
if (strcmp(deviceCreateInfo.ppEnabledExtensionNames[i], VK_NV_DESCRIPTOR_POOL_OVERALLOCATION_EXTENSION_NAME) == 0) outputDevice->outputDevice->enabledOversizedDescriptorPools = gnTrue;
|
if (strcmp(deviceCreateInfo.ppEnabledExtensionNames[i], VK_NV_DESCRIPTOR_POOL_OVERALLOCATION_EXTENSION_NAME) == 0) outputDevice->outputDevice->enabledOversizedDescriptorPools = gnTrue;
|
||||||
|
|
||||||
if (instance->debugger == NULL)
|
if (instance->hasDebugger)
|
||||||
deviceCreateInfo.enabledLayerCount = 0;
|
deviceCreateInfo.enabledLayerCount = 0;
|
||||||
else {
|
else {
|
||||||
const char* validation_layers[1] = { "VK_LAYER_KHRONOS_validation" };
|
const char* validation_layers[1] = { "VK_LAYER_KHRONOS_validation" };
|
||||||
|
@@ -1,8 +0,0 @@
|
|||||||
#include "gryphn_debugger.h"
|
|
||||||
|
|
||||||
gnReturnCode gnCreateDebugger(gnDebuggerHandle* debugger, const gnDebuggerInfo info) {
|
|
||||||
*debugger = malloc(sizeof(struct gnDebugger_t));
|
|
||||||
(*debugger)->info = info;
|
|
||||||
return GN_SUCCESS;
|
|
||||||
}
|
|
||||||
void gnDestroyDebugger(gnDebuggerHandle debugger) {}
|
|
@@ -1,8 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
#include "utils/gryphn_string.h"
|
#include "utils/gryphn_string.h"
|
||||||
#include "utils/gryphn_error_code.h"
|
|
||||||
#include "gryphn_handles.h"
|
|
||||||
|
|
||||||
struct gnPlatformDebugger_t;
|
struct gnPlatformDebugger_t;
|
||||||
|
|
||||||
@@ -43,24 +41,14 @@ typedef struct gnDebuggerInfo {
|
|||||||
} gnDebuggerInfo;
|
} gnDebuggerInfo;
|
||||||
|
|
||||||
#ifdef GN_REVEAL_IMPL
|
#ifdef GN_REVEAL_IMPL
|
||||||
|
// struct gnDebugger_t { gnDebuggerInfo info; };
|
||||||
struct gnDebugger_t {
|
static void gnDebuggerSetErrorMessage(gnDebuggerInfo debugger, gnMessageData data) {
|
||||||
gnDebuggerInfo info;
|
// if (debugger == NULL) return;
|
||||||
};
|
debugger.callback(
|
||||||
#endif
|
|
||||||
|
|
||||||
gnReturnCode gnCreateDebugger(gnDebuggerHandle* debugger, const gnDebuggerInfo info);
|
|
||||||
void gnDestroyDebugger(gnDebuggerHandle debugger);
|
|
||||||
|
|
||||||
#ifdef GN_REVEAL_IMPL
|
|
||||||
static void gnDebuggerSetErrorMessage(gnDebuggerHandle debugger, gnMessageData data) {
|
|
||||||
if (debugger == NULL) return;
|
|
||||||
|
|
||||||
debugger->info.callback(
|
|
||||||
GN_MESSAGE_ERROR,
|
GN_MESSAGE_ERROR,
|
||||||
GN_DEBUG_MESSAGE_VALIDATION,
|
GN_DEBUG_MESSAGE_VALIDATION,
|
||||||
data,
|
data,
|
||||||
debugger->info.userData
|
debugger.userData
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
@@ -2,11 +2,11 @@
|
|||||||
#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"
|
|
||||||
#include "loader/src/gryphn_loader.h"
|
#include "loader/src/gryphn_loader.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));
|
||||||
|
(*instance)->hasDebugger = gnFalse;
|
||||||
|
|
||||||
(*instance)->layers = loaderLayerArrayListCreate();
|
(*instance)->layers = loaderLayerArrayListCreate();
|
||||||
loaderLayerArrayListAdd(&(*instance)->layers, loadLayer((loaderInfo){
|
loaderLayerArrayListAdd(&(*instance)->layers, loadLayer((loaderInfo){
|
||||||
@@ -20,8 +20,12 @@ gnReturnCode gnCreateInstance(gnInstanceHandle* instance, gnInstanceInfo info) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gnBool loaderFunctionChecker = gnFalse;
|
gnBool loaderFunctionChecker = gnFalse;
|
||||||
for (int i = 0; i < info.debugger->info.layerCount; i++) {
|
if (info.debugger != NULL) {
|
||||||
if (info.debugger->info.layers[i] == GN_DEBUGGER_LAYER_FUNCTIONS) loaderFunctionChecker = gnTrue;
|
for (int i = 0; i < info.debugger->layerCount; i++) {
|
||||||
|
if (info.debugger->layers[i] == GN_DEBUGGER_LAYER_FUNCTIONS) loaderFunctionChecker = gnTrue;
|
||||||
|
}
|
||||||
|
(*instance)->debugger = *info.debugger;
|
||||||
|
(*instance)->hasDebugger = gnTrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (loaderFunctionChecker) {
|
if (loaderFunctionChecker) {
|
||||||
@@ -36,7 +40,6 @@ gnReturnCode gnCreateInstance(gnInstanceHandle* instance, gnInstanceInfo info) {
|
|||||||
|
|
||||||
// i hate this line of code but im not fixing it
|
// i hate this line of code but im not fixing it
|
||||||
(*instance)->callingLayer = &(*instance)->layers.data[(*instance)->layers.count - 1];
|
(*instance)->callingLayer = &(*instance)->layers.data[(*instance)->layers.count - 1];
|
||||||
(*instance)->debugger = info.debugger;
|
|
||||||
return (*instance)->callingLayer->instanceFunctions._gnCreateInstance((*instance), info);
|
return (*instance)->callingLayer->instanceFunctions._gnCreateInstance((*instance), info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
#include "core/src/gryphn_handles.h"
|
#include "core/src/gryphn_handles.h"
|
||||||
#include "utils/gryphn_version.h"
|
#include "utils/gryphn_version.h"
|
||||||
#include "utils/gryphn_error_code.h"
|
#include "utils/gryphn_error_code.h"
|
||||||
|
#include "core/src/instance/gryphn_debugger.h"
|
||||||
#include <gryphn_extensions.h>
|
#include <gryphn_extensions.h>
|
||||||
|
|
||||||
typedef struct gnInstanceInfo {
|
typedef struct gnInstanceInfo {
|
||||||
@@ -13,7 +14,7 @@ typedef struct gnInstanceInfo {
|
|||||||
gnVersion engineVersion;
|
gnVersion engineVersion;
|
||||||
|
|
||||||
gnRenderingAPI renderingAPI;
|
gnRenderingAPI renderingAPI;
|
||||||
gnDebuggerHandle debugger;
|
gnDebuggerInfo* debugger;
|
||||||
|
|
||||||
uint32_t extensionCount;
|
uint32_t extensionCount;
|
||||||
gnExtension* extensions;
|
gnExtension* extensions;
|
||||||
@@ -29,7 +30,8 @@ struct gnInstance_t {
|
|||||||
loaderLayer* callingLayer;
|
loaderLayer* callingLayer;
|
||||||
uint32_t currentLayer;
|
uint32_t currentLayer;
|
||||||
|
|
||||||
gnDebuggerHandle debugger;
|
gnBool hasDebugger;
|
||||||
|
gnDebuggerInfo debugger;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#include "sync_functions.h"
|
#include "sync_functions.h"
|
||||||
#include "loader_utils.h"
|
#include "loader_utils.h"
|
||||||
#include "core/src/presentation_queue/gryphn_presentation_queue.h"
|
#include "core/src/presentation_queue/gryphn_presentation_queue.h"
|
||||||
#include <core/src/debugger/gryphn_debugger.h>
|
#include <core/src/instance/gryphn_debugger.h>
|
||||||
#include "synchronization/semaphore/gryphn_semaphore.h"
|
#include "synchronization/semaphore/gryphn_semaphore.h"
|
||||||
#include "synchronization/fence/gryphn_fence.h"
|
#include "synchronization/fence/gryphn_fence.h"
|
||||||
#include "synchronization/commands/gryphn_sync_submit.h"
|
#include "synchronization/commands/gryphn_sync_submit.h"
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
#include "core/src/command/command_pool/gryphn_command_pool.h"
|
#include "core/src/command/command_pool/gryphn_command_pool.h"
|
||||||
#include "core/src/command/command_buffer/gryphn_command_buffer.h"
|
#include "core/src/command/command_buffer/gryphn_command_buffer.h"
|
||||||
#include "core/src/output_device/gryphn_output_device.h"
|
#include "core/src/output_device/gryphn_output_device.h"
|
||||||
#include <core/src/debugger/gryphn_debugger.h>
|
#include <core/src/instance/gryphn_debugger.h>
|
||||||
#include <core/src/instance/gryphn_instance.h>
|
#include <core/src/instance/gryphn_instance.h>
|
||||||
#include "core/src/renderpass/gryphn_render_pass.h"
|
#include "core/src/renderpass/gryphn_render_pass.h"
|
||||||
#include "core/src/pipelines/graphics_pipeline/gryphn_graphics_pipeline.h"
|
#include "core/src/pipelines/graphics_pipeline/gryphn_graphics_pipeline.h"
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#include "device_functions.h"
|
#include "device_functions.h"
|
||||||
#include "loader_utils.h"
|
#include "loader_utils.h"
|
||||||
#include <core/src/debugger/gryphn_debugger.h>
|
#include <core/src/instance/gryphn_debugger.h>
|
||||||
#include "core/src/presentation_queue/gryphn_presentation_queue.h"
|
#include "core/src/presentation_queue/gryphn_presentation_queue.h"
|
||||||
#include "core/src/shader_module/gryphn_shader_module.h"
|
#include "core/src/shader_module/gryphn_shader_module.h"
|
||||||
#include "core/src/renderpass/gryphn_render_pass_descriptor.h"
|
#include "core/src/renderpass/gryphn_render_pass_descriptor.h"
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#include "instance_functions.h"
|
#include "instance_functions.h"
|
||||||
#include "../loader_utils.h"
|
#include "../loader_utils.h"
|
||||||
#include <core/src/debugger/gryphn_debugger.h>
|
#include <core/src/instance/gryphn_debugger.h>
|
||||||
#include "core/src/output_device/gryphn_output_device.h"
|
#include "core/src/output_device/gryphn_output_device.h"
|
||||||
#include "core/src/window_surface/gryphn_surface.h"
|
#include "core/src/window_surface/gryphn_surface.h"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user