summaryrefslogtreecommitdiff
path: root/src/renderer/backends/vulkan_helpers.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/renderer/backends/vulkan_helpers.h')
-rw-r--r--src/renderer/backends/vulkan_helpers.h42
1 files changed, 37 insertions, 5 deletions
diff --git a/src/renderer/backends/vulkan_helpers.h b/src/renderer/backends/vulkan_helpers.h
index 4bd02f1..baff4e7 100644
--- a/src/renderer/backends/vulkan_helpers.h
+++ b/src/renderer/backends/vulkan_helpers.h
@@ -20,16 +20,27 @@ static void plat_get_required_extension_names(cstr_darray* extensions) {
}
// TODO(omni): port to using internal assert functions
-#define VK_CHECK(vulkan_expr) \
- do { \
- VkResult res = vulkan_expr; \
- if (res != VK_SUCCESS) { \
+#define VK_CHECK(vulkan_expr) \
+ do { \
+ VkResult res = vulkan_expr; \
+ if (res != VK_SUCCESS) { \
ERROR_EXIT("Vulkan error: %u", res); \
- } \
+ } \
} while (0)
// TODO: typedef struct vk_debugger {} vk_debugger;
+typedef struct queue_family_indices {
+ u32 graphics_queue_index;
+ u32 present_queue_index;
+ u32 compute_queue_index;
+ u32 transfer_queue_index;
+ bool has_graphics;
+ bool has_present;
+ bool has_compute;
+ bool has_transfer;
+} queue_family_indices;
+
typedef struct vulkan_physical_device_requirements {
bool graphics;
bool present;
@@ -168,4 +179,25 @@ static bool physical_device_meets_requirements(
}
return false;
+}
+
+VKAPI_ATTR VkBool32 VKAPI_CALL vk_debug_callback(
+ VkDebugUtilsMessageSeverityFlagBitsEXT severity, VkDebugUtilsMessageTypeFlagsEXT flags,
+ const VkDebugUtilsMessengerCallbackDataEXT* callback_data, void* user_data) {
+ switch (severity) {
+ default:
+ case VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT:
+ ERROR("%s", callback_data->pMessage);
+ break;
+ case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT:
+ WARN("%s", callback_data->pMessage);
+ break;
+ case VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT:
+ INFO("%s", callback_data->pMessage);
+ break;
+ case VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT:
+ TRACE("%s", callback_data->pMessage);
+ break;
+ }
+ return VK_FALSE;
} \ No newline at end of file