shadPS4/src/vulkan_util.h

52 lines
2.7 KiB
C
Raw Normal View History

2024-02-23 22:32:32 +01:00
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
2023-09-17 19:01:29 +02:00
#pragma once
2023-09-18 13:52:16 +02:00
#include <vector>
2024-02-23 22:32:32 +01:00
#include <SDL.h>
#include <vulkan/vulkan_core.h>
#include "core/PS4/HLE/Graphics/graphics_render.h"
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
constexpr int VULKAN_QUEUES_NUM = 11; // Total of the above
2023-09-20 13:19:20 +02:00
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-10-13 08:40:59 +02:00
void vulkanCreate(Emu::WindowCtx* ctx);
void vulkanGetInstanceExtensions(Emu::VulkanExt* ext);
void vulkanFindCompatiblePhysicalDevice(VkInstance instance, VkSurfaceKHR surface,
const std::vector<const char*>& device_extensions,
Emu::VulkanSurfaceCapabilities* out_capabilities,
VkPhysicalDevice* out_device,
2023-10-13 08:40:59 +02:00
Emu::VulkanQueues* out_queues);
VkDevice vulkanCreateDevice(VkPhysicalDevice physical_device, VkSurfaceKHR surface,
const Emu::VulkanExt* r, const Emu::VulkanQueues& queues,
const std::vector<const char*>& device_extensions);
2023-10-13 08:40:59 +02:00
Emu::VulkanQueues vulkanFindQueues(VkPhysicalDevice device, VkSurfaceKHR surface);
void vulkanGetSurfaceCapabilities(VkPhysicalDevice physical_device, VkSurfaceKHR surface,
Emu::VulkanSurfaceCapabilities* surfaceCap);
2023-10-13 08:40:59 +02:00
void vulkanCreateQueues(HLE::Libs::Graphics::GraphicCtx* ctx, const Emu::VulkanQueues& queues);
2023-10-26 22:38:37 +02:00
Emu::VulkanSwapchain vulkanCreateSwapchain(HLE::Libs::Graphics::GraphicCtx* ctx, u32 image_count);
void vulkanBlitImage(GPU::CommandBuffer* buffer, HLE::Libs::Graphics::VulkanImage* src_image,
Emu::VulkanSwapchain* dst_swapchain);
void vulkanFillImage(HLE::Libs::Graphics::GraphicCtx* ctx,
HLE::Libs::Graphics::VulkanImage* dst_image, const void* src_data, u64 size,
u32 src_pitch, u64 dst_layout);
void vulkanBufferToImage(GPU::CommandBuffer* buffer, HLE::Libs::Graphics::VulkanBuffer* src_buffer,
u32 src_pitch, HLE::Libs::Graphics::VulkanImage* dst_image,
u64 dst_layout);
void vulkanCreateBuffer(HLE::Libs::Graphics::GraphicCtx* ctx, u64 size,
HLE::Libs::Graphics::VulkanBuffer* buffer);
void vulkanDeleteBuffer(HLE::Libs::Graphics::GraphicCtx* ctx,
HLE::Libs::Graphics::VulkanBuffer* buffer);
}; // namespace Graphics::Vulkan