Panda3DS/include/renderer_vk/vk_debug.hpp
Wunkolo 4976671ef0 Rename vulkan_api.hpp to vk_api.hpp
Consistant with other vulkan header patterns.
This header in particular is to configure our Vulkan API usage.
2023-08-20 23:01:43 -07:00

48 lines
No EOL
1.7 KiB
C++

#pragma once
#include <span>
#include <type_traits>
#include <utility>
#include "vk_api.hpp"
namespace Vulkan {
VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageCallback(
VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageType,
const VkDebugUtilsMessengerCallbackDataEXT* callbackData, void* userData
);
void setObjectName(vk::Device device, vk::ObjectType objectType, const void* objectHandle, const char* format, ...);
template <typename T, typename = std::enable_if_t<vk::isVulkanHandleType<T>::value == true>, typename... ArgsT>
inline void setObjectName(vk::Device device, const T objectHandle, const char* format, ArgsT&&... args) {
setObjectName(device, T::objectType, objectHandle, format, std::forward<ArgsT>(args)...);
}
void beginDebugLabel(vk::CommandBuffer commandBuffer, std::span<const float, 4> color, const char* format, ...);
void insertDebugLabel(vk::CommandBuffer commandBuffer, std::span<const float, 4> color, const char* format, ...);
void endDebugLabel(vk::CommandBuffer commandBuffer);
class DebugLabelScope {
private:
const vk::CommandBuffer commandBuffer;
public:
template <typename... ArgsT>
DebugLabelScope(vk::CommandBuffer targetCommandBuffer, std::span<const float, 4> color, const char* format, ArgsT&&... args)
: commandBuffer(targetCommandBuffer) {
beginDebugLabel(commandBuffer, color, format, std::forward<ArgsT>(args)...);
}
template <typename... ArgsT>
void operator()(std::span<const float, 4> color, const char* format, ArgsT&&... args) const {
insertDebugLabel(commandBuffer, color, format, std::forward<ArgsT>(args)...);
}
~DebugLabelScope() { endDebugLabel(commandBuffer); }
};
} // namespace Vulkan