2023-09-17 19:01:29 +02:00
|
|
|
#pragma once
|
|
|
|
#include <SDL.h>
|
|
|
|
#include <src/video/khronos/vulkan/vulkan_core.h>
|
|
|
|
|
2023-09-18 13:52:16 +02:00
|
|
|
#include <vector>
|
2023-09-17 19:01:29 +02:00
|
|
|
|
2023-09-18 13:52:16 +02:00
|
|
|
#include "emulator.h"
|
2023-09-17 19:01:29 +02:00
|
|
|
|
2023-09-18 13:52:16 +02:00
|
|
|
namespace Graphics::Vulkan {
|
2023-09-17 19:01:29 +02:00
|
|
|
|
2023-09-20 13:19:20 +02:00
|
|
|
constexpr int VULKAN_QUEUES_NUM = 11; // Total of the above
|
|
|
|
constexpr int VULKAN_QUEUE_GRAPHICS_NUM = 1;
|
|
|
|
constexpr int VULKAN_QUEUE_TRANSFER_NUM = 1;
|
|
|
|
constexpr int VULKAN_QUEUE_PRESENT_NUM = 1;
|
|
|
|
constexpr int VULKAN_QUEUE_COMPUTE_NUM = 8;
|
|
|
|
|
2023-09-21 17:20:13 +02:00
|
|
|
constexpr int VULKAN_QUEUE_GFX = 8;
|
|
|
|
constexpr int VULKAN_QUEUE_UTIL = 9;
|
|
|
|
constexpr int VULKAN_QUEUE_PRESENT = 10;
|
|
|
|
|
2023-09-21 23:05:00 +02:00
|
|
|
template <typename T>
|
|
|
|
const T& clamp(const T& x, const T& min, const T& max) {
|
|
|
|
if (x < min) return min;
|
|
|
|
if (x > max) return max;
|
|
|
|
return x;
|
|
|
|
}
|
2023-09-21 17:20:13 +02:00
|
|
|
|
2023-09-18 13:52:16 +02:00
|
|
|
void vulkanCreate(Emulator::WindowCtx* ctx);
|
|
|
|
void vulkanGetInstanceExtensions(Emulator::VulkanExt* ext);
|
|
|
|
void vulkanFindCompatiblePhysicalDevice(VkInstance instance, VkSurfaceKHR surface, const std::vector<const char*>& device_extensions,
|
2023-09-20 13:19:20 +02:00
|
|
|
Emulator::VulkanSurfaceCapabilities* out_capabilities, VkPhysicalDevice* out_device,
|
|
|
|
Emulator::VulkanQueues* out_queues);
|
2023-09-21 11:59:48 +02:00
|
|
|
VkDevice vulkanCreateDevice(VkPhysicalDevice physical_device, VkSurfaceKHR surface, const Emulator::VulkanExt* r,
|
|
|
|
const Emulator::VulkanQueues& queues, const std::vector<const char*>& device_extensions);
|
2023-09-19 08:15:59 +02:00
|
|
|
Emulator::VulkanQueues vulkanFindQueues(VkPhysicalDevice device, VkSurfaceKHR surface);
|
2023-09-20 13:19:20 +02:00
|
|
|
void vulkanGetSurfaceCapabilities(VkPhysicalDevice physical_device, VkSurfaceKHR surface, Emulator::VulkanSurfaceCapabilities* surfaceCap);
|
2023-09-21 17:20:13 +02:00
|
|
|
void vulkanCreateQueues(HLE::Libs::Graphics::GraphicCtx* ctx, const Emulator::VulkanQueues& queues);
|
2023-09-21 22:48:16 +02:00
|
|
|
Emulator::VulkanSwapchain* vulkanCreateSwapchain(HLE::Libs::Graphics::GraphicCtx* ctx, u32 image_count);
|
2023-09-18 13:52:16 +02:00
|
|
|
}; // namespace Graphics::Vulkan
|