// Copyright 2023 Citra Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. #pragma once #include #include #include "common/common_types.h" #include "common/dynamic_library/dynamic_library.h" #include "video_core/renderer_vulkan/vk_common.h" namespace Frontend { class EmuWindow; class GraphicsContext; enum class WindowSystemType : u8; } // namespace Frontend namespace Vulkan { constexpr u32 TargetVulkanApiVersion = VK_API_VERSION_1_1; using DebugCallback = std::variant; std::shared_ptr OpenLibrary( [[maybe_unused]] Frontend::GraphicsContext* context = nullptr); vk::SurfaceKHR CreateSurface(vk::Instance instance, const Frontend::EmuWindow& emu_window); vk::UniqueInstance CreateInstance(const Common::DynamicLibrary& library, Frontend::WindowSystemType window_type, bool enable_validation, bool dump_command_buffers); DebugCallback CreateDebugCallback(vk::Instance instance, bool& debug_utils_supported); template concept VulkanHandleType = vk::isVulkanHandleType::value; template void SetObjectName(vk::Device device, const HandleType& handle, std::string_view debug_name) { const vk::DebugUtilsObjectNameInfoEXT name_info = { .objectType = HandleType::objectType, .objectHandle = reinterpret_cast(static_cast(handle)), .pObjectName = debug_name.data(), }; device.setDebugUtilsObjectNameEXT(name_info); } template void SetObjectName(vk::Device device, const HandleType& handle, const char* format, const Args&... args) { const std::string debug_name = fmt::vformat(format, fmt::make_format_args(args...)); SetObjectName(device, handle, debug_name); } } // namespace Vulkan