2023-05-09 20:04:34 +02:00
|
|
|
/*
|
|
|
|
|
* Vulkan examples debug wrapper
|
|
|
|
|
*
|
2025-05-29 19:32:50 +02:00
|
|
|
* Copyright (C) 2016-2025 by Sascha Willems - www.saschawillems.de
|
2023-05-09 20:04:34 +02:00
|
|
|
*
|
|
|
|
|
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
|
|
|
|
*/
|
|
|
|
|
|
2016-02-16 15:07:25 +01:00
|
|
|
#pragma once
|
|
|
|
|
#include "vulkan/vulkan.h"
|
|
|
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <cstring>
|
|
|
|
|
#include <fstream>
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <vector>
|
2017-03-12 17:46:50 +01:00
|
|
|
#include <sstream>
|
2016-02-16 15:07:25 +01:00
|
|
|
#ifdef _WIN32
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
#include <io.h>
|
2016-03-05 11:45:35 +01:00
|
|
|
#endif
|
|
|
|
|
#ifdef __ANDROID__
|
2017-03-25 12:09:45 +01:00
|
|
|
#include "VulkanAndroid.h"
|
2016-02-16 15:07:25 +01:00
|
|
|
#endif
|
2016-05-28 12:00:43 +02:00
|
|
|
#define GLM_FORCE_RADIANS
|
|
|
|
|
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
|
|
|
|
|
#include <glm/glm.hpp>
|
2016-02-16 15:07:25 +01:00
|
|
|
|
2017-02-12 11:33:04 +01:00
|
|
|
namespace vks
|
2016-02-16 15:07:25 +01:00
|
|
|
{
|
2017-02-12 11:33:04 +01:00
|
|
|
namespace debug
|
|
|
|
|
{
|
2025-05-29 19:32:50 +02:00
|
|
|
extern bool logToFile;
|
|
|
|
|
|
2017-02-12 11:33:04 +01:00
|
|
|
// Default debug callback
|
2024-01-21 05:07:35 -08:00
|
|
|
VKAPI_ATTR VkBool32 VKAPI_CALL debugUtilsMessageCallback(
|
|
|
|
|
VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,
|
|
|
|
|
VkDebugUtilsMessageTypeFlagsEXT messageType,
|
|
|
|
|
const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData,
|
2017-02-12 11:33:04 +01:00
|
|
|
void* pUserData);
|
2016-02-16 15:07:25 +01:00
|
|
|
|
2017-02-12 11:33:04 +01:00
|
|
|
// Load debug function pointers and set debug callback
|
2023-01-22 10:07:29 +01:00
|
|
|
void setupDebugging(VkInstance instance);
|
2017-02-12 11:33:04 +01:00
|
|
|
// Clear debug callback
|
|
|
|
|
void freeDebugCallback(VkInstance instance);
|
2024-01-21 05:07:35 -08:00
|
|
|
// Used to populate a VkDebugUtilsMessengerCreateInfoEXT with our example messenger function and desired flags
|
|
|
|
|
void setupDebugingMessengerCreateInfo(VkDebugUtilsMessengerCreateInfoEXT& debugUtilsMessengerCI);
|
2017-02-12 11:33:04 +01:00
|
|
|
}
|
2016-05-07 14:05:56 +02:00
|
|
|
|
2023-05-09 20:04:34 +02:00
|
|
|
// Wrapper for the VK_EXT_debug_utils extension
|
|
|
|
|
// These can be used to name Vulkan objects for debugging tools like RenderDoc
|
|
|
|
|
namespace debugutils
|
2016-05-22 20:29:03 +02:00
|
|
|
{
|
2023-05-09 20:04:34 +02:00
|
|
|
void setup(VkInstance instance);
|
|
|
|
|
void cmdBeginLabel(VkCommandBuffer cmdbuffer, std::string caption, glm::vec4 color);
|
|
|
|
|
void cmdEndLabel(VkCommandBuffer cmdbuffer);
|
|
|
|
|
}
|
2016-02-16 15:07:25 +01:00
|
|
|
}
|