more error hunting
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "vulkan_instance.h"
|
||||
#include "vulkan_result_converter.h"
|
||||
GN_ARRAY_LIST_DEFINITION(vkString)
|
||||
|
||||
|
||||
static VKAPI_ATTR VkBool32 VKAPI_CALL vk_debuggerDebugCallback(
|
||||
VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
|
||||
@@ -14,18 +16,24 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL vk_debuggerDebugCallback(
|
||||
};
|
||||
|
||||
switch (messageSeverity) {
|
||||
default: break;
|
||||
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT: severity = GN_MESSAGE_VERBOSE; break;
|
||||
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT: severity = GN_MESSAGE_INFO; break;
|
||||
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT: severity = GN_MESSAGE_WARNING; break;
|
||||
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT: severity = GN_MESSAGE_ERROR; break;
|
||||
case VK_DEBUG_UTILS_MESSAGE_SEVERITY_FLAG_BITS_MAX_ENUM_EXT: {
|
||||
VkDebugUtilsMessengerCallbackDataEXT callbackData = {
|
||||
.pMessage = "Error triggered with VK_DEBUG_UTILS_MESSAGE_SEVERITY_FLAG_BITS_MAX_ENUM_EXT, this indicates a big within vulkan"
|
||||
};
|
||||
vk_debuggerDebugCallback(VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT, VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT, &callbackData, pUserData);
|
||||
severity = GN_MESSAGE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
switch (messageType) {
|
||||
default: break;
|
||||
case VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT: type = GN_DEBUG_MESSAGE_GENERAL; break;
|
||||
case VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT: type = GN_DEBUG_MESSAGE_VALIDATION; break;
|
||||
case VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT: type = GN_DEBUG_MESSAGE_PERFORMANCE; break;
|
||||
case VK_DEBUG_UTILS_MESSAGE_TYPE_DEVICE_ADDRESS_BINDING_BIT_EXT: type = GN_DEBUG_MESSAGE_PERFORMANCE; break;
|
||||
}
|
||||
|
||||
vkUserData* userData = (vkUserData*)pUserData;
|
||||
@@ -36,20 +44,21 @@ static VKAPI_ATTR VkBool32 VKAPI_CALL vk_debuggerDebugCallback(
|
||||
}
|
||||
|
||||
gnReturnCode vulkanCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* instanceInfo, gryphnInstanceFunctionLayers* next) {
|
||||
if (next != NULL) { return GN_SUCCESS; }
|
||||
instance->instance = malloc(sizeof(gnPlatformInstance));
|
||||
|
||||
vkStringArrayList extensions = vkStringArrayListCreate();
|
||||
vkStringArrayListAdd(&extensions, "VK_KHR_surface");
|
||||
vkStringArrayListReserve(&extensions, 5);
|
||||
vkStringArrayListAdd(extensions, "VK_KHR_surface");
|
||||
vkStringArrayListReserve(extensions, 5);
|
||||
|
||||
#ifdef GN_PLATFORM_MACOS
|
||||
vkStringArrayListAdd(&extensions, "VK_EXT_metal_surface");
|
||||
vkStringArrayListAdd(&extensions, "VK_KHR_portability_enumeration");
|
||||
vkStringArrayListAdd(extensions, "VK_EXT_metal_surface");
|
||||
vkStringArrayListAdd(extensions, "VK_KHR_portability_enumeration");
|
||||
#elif GN_PLATFORM_WINDOWS
|
||||
vkStringArrayListAdd(&extensions, "VK_KHR_win32_surface");
|
||||
vkStringArrayListAdd(extensions, "VK_KHR_win32_surface");
|
||||
#elif GN_PLATFORM_LINUX
|
||||
#ifdef GN_WINDOW_X11
|
||||
vkStringArrayListAdd(&extensions, "VK_KHR_xlib_surface");
|
||||
vkStringArrayListAdd(extensions, "VK_KHR_xlib_surface");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -74,9 +83,7 @@ gnReturnCode vulkanCreateInstance(gnInstanceHandle instance, gnInstanceCreateInf
|
||||
#endif
|
||||
|
||||
if (instance->enabledLayerCounts[GN_DEBUGGER_LAYER_PLATFORM] > 0) {
|
||||
vkStringArrayListAdd(&extensions, VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
|
||||
|
||||
const char* validation_layers[1] = { "VK_LAYER_KHRONOS_validation" };
|
||||
vkStringArrayListAdd(extensions, VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
|
||||
createInfo.enabledLayerCount = 1;
|
||||
createInfo.ppEnabledLayerNames = (const char*[]){ "VK_LAYER_KHRONOS_validation" };
|
||||
|
||||
@@ -94,11 +101,12 @@ gnReturnCode vulkanCreateInstance(gnInstanceHandle instance, gnInstanceCreateInf
|
||||
}
|
||||
|
||||
|
||||
createInfo.enabledExtensionCount = extensions.count;
|
||||
createInfo.ppEnabledExtensionNames = extensions.data;
|
||||
createInfo.enabledExtensionCount = vkStringArrayListCount(extensions);
|
||||
createInfo.ppEnabledExtensionNames = vkStringArrayListData(extensions);
|
||||
return VkResultToGnReturnCode(vkCreateInstance(&createInfo, NULL, &instance->instance->vk_instance));
|
||||
}
|
||||
|
||||
void vulkanDestroyInstance(gnInstanceHandle instance, gryphnInstanceFunctionLayers* next) {
|
||||
if (next != NULL) { return; }
|
||||
vkDestroyInstance(instance->instance->vk_instance, NULL);
|
||||
}
|
||||
|
@@ -18,4 +18,4 @@ gnReturnCode vulkanCreateInstance(gnInstanceHandle instance, gnInstanceCreateInf
|
||||
void vulkanDestroyInstance(gnInstanceHandle instance, gryphnInstanceFunctionLayers* next);
|
||||
|
||||
typedef const char* vkString;
|
||||
GN_ARRAY_LIST(vkString);
|
||||
GN_ARRAY_LIST_HEADER(vkString);
|
||||
|
@@ -2,6 +2,9 @@
|
||||
#include "output_device/gryphn_output_device.h"
|
||||
#include "instance/gryphn_instance.h"
|
||||
|
||||
GN_ARRAY_LIST_DEFINITION(gnBuffer)
|
||||
GN_ARRAY_LIST_DEFINITION(gnBufferMemory)
|
||||
|
||||
gnReturnCode gnCreateBuffer(gnBufferHandle* buffer, gnOutputDeviceHandle device, gnBufferInfo info) {
|
||||
*buffer = malloc(sizeof(struct gnBuffer_t));
|
||||
(*buffer)->device = device;
|
||||
|
@@ -37,8 +37,8 @@ struct gnBuffer_t {
|
||||
};
|
||||
#endif
|
||||
typedef void* gnBufferMemory;
|
||||
GN_ARRAY_LIST(gnBuffer);
|
||||
GN_ARRAY_LIST(gnBufferMemory);
|
||||
GN_ARRAY_LIST_HEADER(gnBuffer);
|
||||
GN_ARRAY_LIST_HEADER(gnBufferMemory);
|
||||
|
||||
gnReturnCode gnCreateBuffer(gnBufferHandle* buffer, gnOutputDeviceHandle device, gnBufferInfo info);
|
||||
void gnBufferData(gnBufferHandle buffer, size_t dataSize, gnBufferMemory data);
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include "instance/gryphn_instance.h"
|
||||
|
||||
gnReturnCode gnCommandPoolAllocateCommandBuffersFromPointer(gnCommandBufferHandle* buffers, uint32_t count, gnCommandPoolHandle commandPool) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
buffers[i] = malloc(sizeof(struct gnCommandBuffer_t));
|
||||
buffers[i]->commandPool = commandPool;
|
||||
buffers[i]->instance = commandPool->instance;
|
||||
@@ -12,15 +12,11 @@ gnReturnCode gnCommandPoolAllocateCommandBuffersFromPointer(gnCommandBufferHandl
|
||||
}
|
||||
|
||||
gnReturnCode gnCommandPoolAllocateCommandBuffersFromList(gnCommandBufferArrayList buffers, uint32_t count, gnCommandPoolHandle commandPool) {
|
||||
// if (buffers.count < count) {
|
||||
// gnCommandBufferArrayListExpand(&buffers, buffers.count - count);
|
||||
// }
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
buffers.data[i] = malloc(sizeof(struct gnCommandBuffer_t));
|
||||
buffers.data[i]->commandPool = commandPool;
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
gnCommandBufferArrayListAt(buffers, i)->commandBuffer = malloc(sizeof(struct gnCommandBuffer_t));
|
||||
gnCommandBufferArrayListAt(buffers, i)->commandPool = commandPool;
|
||||
}
|
||||
return gnCommandPoolAllocateCommandBuffersFromPointer(buffers.data, count, commandPool);
|
||||
return gnCommandPoolAllocateCommandBuffersFromPointer(gnCommandBufferArrayListData(buffers), count, commandPool);
|
||||
}
|
||||
|
||||
void gnResetCommandBuffer(gnCommandBufferHandle commandBuffer) {
|
||||
@@ -38,3 +34,6 @@ gnReturnCode gnEndCommandBuffer(gnCommandBufferHandle commandBuffer) {
|
||||
void gnDestroyCommandBuffer(gnCommandBufferHandle commandBuffer) {
|
||||
commandBuffer->commandPool->instance->callingLayer->commandFunctions._gnDestroyCommandBuffer(commandBuffer);
|
||||
}
|
||||
|
||||
|
||||
GN_ARRAY_LIST_DEFINITION(gnCommandBuffer)
|
||||
|
@@ -12,10 +12,9 @@ struct gnCommandBuffer_t {
|
||||
};
|
||||
#endif
|
||||
|
||||
GN_ARRAY_LIST(gnCommandBuffer);
|
||||
GN_ARRAY_LIST_HEADER(gnCommandBuffer);
|
||||
|
||||
gnReturnCode gnCommandPoolAllocateCommandBuffersFromPointer(gnCommandBufferHandle* buffers, uint32_t count, gnCommandPoolHandle commandPool);
|
||||
// will reserve the space for ${count} number of elements
|
||||
gnReturnCode gnCommandPoolAllocateCommandBuffersFromList(gnCommandBufferArrayList buffers, uint32_t count, gnCommandPoolHandle commandPool);
|
||||
|
||||
#define gnCommandPoolAllocateCommandBuffers(buffers, count, commandPool) \
|
||||
|
@@ -42,8 +42,7 @@ typedef struct gnDebuggerCreateInfo {
|
||||
} gnDebuggerCreateInfo;
|
||||
|
||||
#ifdef GN_REVEAL_IMPL
|
||||
// struct gnDebugger_t { gnDebuggerInfo info; };
|
||||
static void gnDebuggerSetErrorMessage(gnDebuggerCreateInfo debugger, gnMessageData data) {
|
||||
static inline void gnDebuggerSetErrorMessage(gnDebuggerCreateInfo debugger, gnMessageData data) {
|
||||
// if (debugger == NULL) return;
|
||||
debugger.callback(
|
||||
GN_MESSAGE_ERROR,
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <core/gryphn_return_code.h>
|
||||
|
||||
typedef struct gnOutputDeviceEnabledFeatures {
|
||||
|
||||
gnBool warningAvioder; // this is here just to stop this from producing a warning
|
||||
} gnOutputDeviceEnabledFeatures;
|
||||
|
||||
typedef struct gnDeviceQueueInfo {
|
||||
|
@@ -14,3 +14,6 @@ void gnUpdateStorageUniform(gnUniform uniform, gnStorageUniformInfo storageInfo)
|
||||
void gnUpdateImageUniform(gnUniform uniform, gnImageUniformInfo imageInfo) {
|
||||
uniform->pool->device->instance->callingLayer->deviceFunctions._gnUpdateImageUniform(uniform, &imageInfo);
|
||||
}
|
||||
|
||||
|
||||
GN_ARRAY_LIST_DEFINITION(gnUniform)
|
||||
|
@@ -30,7 +30,7 @@ struct gnUniform_t {
|
||||
gnUniformPool pool;
|
||||
};
|
||||
#endif
|
||||
GN_ARRAY_LIST(gnUniform);
|
||||
GN_ARRAY_LIST_HEADER(gnUniform);
|
||||
|
||||
void gnUpdateBufferUniform(gnUniform uniform, gnBufferUniformInfo bufferInfo);
|
||||
void gnUpdateStorageUniform(gnUniform uniform, gnStorageUniformInfo storageInfo);
|
||||
|
@@ -1,5 +1,3 @@
|
||||
// #ifdef GN_EXT_GN_EXT_SYNCHRONIZATION
|
||||
|
||||
#include "gryphn_fence.h"
|
||||
#include "output_device/gryphn_output_device.h"
|
||||
#include "instance/gryphn_instance.h"
|
||||
@@ -25,4 +23,4 @@ void gnDestroyFence(gnFenceHandle fence) {
|
||||
fence->device->instance->callingLayer->syncFunctions._gnDestroyFence(fence);
|
||||
}
|
||||
|
||||
// #endif
|
||||
GN_ARRAY_LIST_DEFINITION(gnFence)
|
||||
|
@@ -11,10 +11,12 @@ struct gnFence_t {
|
||||
gnBool signaled;
|
||||
};
|
||||
#endif
|
||||
GN_ARRAY_LIST(gnFence);
|
||||
|
||||
gnReturnCode gnCreateFence(gnFenceHandle* fence, gnOutputDeviceHandle device);
|
||||
void gnSignalFence(gnFenceHandle fence);
|
||||
void gnWaitForFence(gnFenceHandle fence, uint64_t timeout);
|
||||
void gnResetFence(gnFenceHandle fence);
|
||||
void gnDestroyFence(gnFenceHandle fence);
|
||||
|
||||
|
||||
GN_ARRAY_LIST_HEADER(gnFence);
|
||||
|
@@ -12,5 +12,4 @@ gnReturnCode gnCreateSemaphore(gnSemaphore* semaphore, struct gnOutputDevice_t*
|
||||
void gnDestroySemaphore(struct gnSemaphore_t* semaphore) {
|
||||
semaphore->device->instance->callingLayer->syncFunctions._gnDestroySemaphore(semaphore);
|
||||
}
|
||||
|
||||
// #endif
|
||||
GN_ARRAY_LIST_DEFINITION(gnSemaphore)
|
||||
|
@@ -9,7 +9,7 @@ struct gnSemaphore_t {
|
||||
gnOutputDeviceHandle device;
|
||||
};
|
||||
#endif
|
||||
GN_ARRAY_LIST(gnSemaphore);
|
||||
|
||||
gnReturnCode gnCreateSemaphore(gnSemaphore* semaphore, struct gnOutputDevice_t* device);
|
||||
void gnDestroySemaphore(gnSemaphore semaphore);
|
||||
GN_ARRAY_LIST_HEADER(gnSemaphore);
|
||||
|
@@ -3,12 +3,12 @@
|
||||
#include "core/gryphn_return_code.h"
|
||||
#include "gryphn_handles.h"
|
||||
|
||||
#include <core/src/buffers/gryphn_buffer.h>
|
||||
|
||||
typedef struct gnRenderPassInfo gnRenderPassInfo;
|
||||
typedef struct gnViewport gnViewport;
|
||||
typedef struct gnScissor gnScissor;
|
||||
typedef struct gnPushConstantLayout gnPushConstantLayout;
|
||||
typedef enum gnBufferType gnBufferType;
|
||||
typedef enum gnIndexType gnIndexType;
|
||||
|
||||
typedef struct gnCommandFunctions_t {
|
||||
gnReturnCode (*_gnCommandPoolAllocateCommandBuffers)(gnCommandBufferHandle* commandBuffers, uint32_t count, gnCommandPoolHandle pool);
|
||||
|
@@ -175,3 +175,6 @@ loaderLayer* loaderGetNextLayer(gnInstance instance) {
|
||||
void resetLayer(gnInstance instance) {
|
||||
instance->currentLayer = (instance->layers.count - 1);
|
||||
}
|
||||
|
||||
|
||||
GN_ARRAY_LIST_DEFINITION(loaderLayer)
|
||||
|
@@ -38,7 +38,7 @@ typedef struct loaderLayer {
|
||||
} loaderLayer;
|
||||
|
||||
loaderLayer loadLayer(loaderInfo info);
|
||||
GN_ARRAY_LIST(loaderLayer);
|
||||
GN_ARRAY_LIST_HEADER(loaderLayer);
|
||||
|
||||
loaderLayer* loaderGetNextLayer(gnInstance instance);
|
||||
void resetLayer(gnInstance instance);
|
||||
|
Submodule projects/utils updated: a9aa97be63...203928aa81
@@ -5,14 +5,14 @@
|
||||
#include "extensions/sync_functions.h"
|
||||
#include "extensions/queue_functions.h"
|
||||
|
||||
gryphnInstanceFunctionLayers checkerLoadInstanceFunctions() {
|
||||
gryphnInstanceFunctionLayers checkerLoadInstanceFunctions(void) {
|
||||
return (gryphnInstanceFunctionLayers) {
|
||||
.createInstance = checkCreateInstance,
|
||||
.destroyInstance = checkDestroyInstance
|
||||
};
|
||||
}
|
||||
|
||||
gnInstanceFunctions loadFunctionLoaderInstanceFunctions() {
|
||||
gnInstanceFunctions loadFunctionLoaderInstanceFunctions(void) {
|
||||
return (gnInstanceFunctions){
|
||||
._gnGetPhysicalDevices = checkGetPhysicalDevices,
|
||||
._gnPhysicalDeviceCanPresentToSurface = checkCanDevicePresent,
|
||||
@@ -43,7 +43,7 @@ gnInstanceFunctions loadFunctionLoaderInstanceFunctions() {
|
||||
._gnGetSurfaceDetails = checkGetSurfaceDetails
|
||||
};
|
||||
}
|
||||
gnDeviceFunctions loadFunctionLoaderDeviceFunctions() {
|
||||
gnDeviceFunctions loadFunctionLoaderDeviceFunctions(void) {
|
||||
return (gnDeviceFunctions){
|
||||
._gnCreatePresentationQueue = checkCreatePresentationQueue,
|
||||
._gnPresentationQueueGetImage = checkPresentationQueueGetImage,
|
||||
@@ -88,7 +88,7 @@ gnDeviceFunctions loadFunctionLoaderDeviceFunctions() {
|
||||
._gnWaitForDevice = checkWaitForDevice
|
||||
};
|
||||
}
|
||||
gnCommandFunctions loadFunctionLoaderCommandFunctions() {
|
||||
gnCommandFunctions loadFunctionLoaderCommandFunctions(void) {
|
||||
return (gnCommandFunctions){
|
||||
._gnCommandPoolAllocateCommandBuffers = checkCommandPoolAllocateCommandBuffers,
|
||||
._gnBeginCommandBuffer = checkBeginCommandBuffer,
|
||||
@@ -110,7 +110,7 @@ gnCommandFunctions loadFunctionLoaderCommandFunctions() {
|
||||
};
|
||||
}
|
||||
|
||||
gnSyncExtFunctions loadFunctionLoaderSyncExtFunctions() {
|
||||
gnSyncExtFunctions loadFunctionLoaderSyncExtFunctions(void) {
|
||||
return (gnSyncExtFunctions) {
|
||||
._gnPresentationQueueGetImageAsync = checkPresentationQueueGetImageAsync,
|
||||
|
||||
@@ -127,7 +127,7 @@ gnSyncExtFunctions loadFunctionLoaderSyncExtFunctions() {
|
||||
};
|
||||
}
|
||||
|
||||
gnQueueExtFunctions loadFunctionLoaderQueueExtFunctions() {
|
||||
gnQueueExtFunctions loadFunctionLoaderQueueExtFunctions(void) {
|
||||
return (gnQueueExtFunctions){
|
||||
._gnGetPhysicalDeviceQueueProperties = checkGetPhysicalDeviceQueueProperties,
|
||||
._gnGetDeviceQueue = checkGetDeviceQueue,
|
||||
|
Reference in New Issue
Block a user