more work on vulkan queues
This commit is contained in:
parent
48ae687191
commit
3768dfabfc
|
@ -24,10 +24,23 @@ struct VulkanSurfaceCapabilities {
|
|||
bool is_format_unorm_bgra32 = false;
|
||||
};
|
||||
|
||||
struct VulkanQueueInfo {
|
||||
u32 family = 0;
|
||||
u32 index = 0;
|
||||
bool is_graphics = false;
|
||||
bool is_compute = false;
|
||||
bool is_transfer = false;
|
||||
bool is_present = false;
|
||||
};
|
||||
|
||||
struct VulkanQueues {
|
||||
u32 family_count = 0;
|
||||
std::vector<VulkanQueueInfo> available;
|
||||
std::vector<VulkanQueueInfo> graphics;
|
||||
std::vector<u32> family_used;
|
||||
};
|
||||
|
||||
|
||||
struct WindowCtx {
|
||||
HLE::Libs::Graphics::GraphicCtx m_graphic_ctx;
|
||||
Lib::Mutex m_mutex;
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
#include <SDL_vulkan.h>
|
||||
#include <Util/log.h>
|
||||
#include <debug.h>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
#include <vulkan/vk_enum_string_helper.h>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
|
||||
constexpr bool log_file_vulkanutil = true; // disable it to disable logging
|
||||
|
||||
|
@ -104,7 +104,6 @@ void Graphics::Vulkan::vulkanFindCompatiblePhysicalDevice(VkInstance instance, V
|
|||
Emulator::VulkanQueues found_best_queues;
|
||||
|
||||
for (const auto& device : devices) {
|
||||
|
||||
VkPhysicalDeviceProperties device_properties{};
|
||||
VkPhysicalDeviceFeatures2 device_features2{};
|
||||
|
||||
|
@ -143,14 +142,28 @@ Emulator::VulkanQueues Graphics::Vulkan::vulkanFindQueues(VkPhysicalDevice devic
|
|||
|
||||
LOG_INFO_IF(log_file_vulkanutil, "queue family: {}, count = {}, present = {}\n", string_VkQueueFlags(f.queueFlags).c_str(), f.queueCount,
|
||||
(presentation_supported == VK_TRUE ? "true" : "false"));
|
||||
for (uint32_t i = 0; i < f.queueCount; i++) {
|
||||
Emulator::VulkanQueueInfo info;
|
||||
info.family = family;
|
||||
info.index = i;
|
||||
info.is_graphics = (f.queueFlags & VK_QUEUE_GRAPHICS_BIT) != 0;
|
||||
info.is_compute = (f.queueFlags & VK_QUEUE_COMPUTE_BIT) != 0;
|
||||
info.is_transfer = (f.queueFlags & VK_QUEUE_TRANSFER_BIT) != 0;
|
||||
info.is_present = (presentation_supported == VK_TRUE);
|
||||
|
||||
qs.available.push_back(info);
|
||||
}
|
||||
|
||||
qs.family_used.push_back(0);
|
||||
|
||||
family++;
|
||||
}
|
||||
|
||||
// TODO finish it
|
||||
return qs;
|
||||
}
|
||||
|
||||
void Graphics::Vulkan::vulkanGetSurfaceCapabilities(VkPhysicalDevice physical_device, VkSurfaceKHR surface, Emulator::VulkanSurfaceCapabilities* surfaceCap) {
|
||||
void Graphics::Vulkan::vulkanGetSurfaceCapabilities(VkPhysicalDevice physical_device, VkSurfaceKHR surface,
|
||||
Emulator::VulkanSurfaceCapabilities* surfaceCap) {
|
||||
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physical_device, surface, &surfaceCap->capabilities);
|
||||
|
||||
uint32_t formats_count = 0;
|
||||
|
@ -162,7 +175,6 @@ void Graphics::Vulkan::vulkanGetSurfaceCapabilities(VkPhysicalDevice physical_de
|
|||
uint32_t present_modes_count = 0;
|
||||
vkGetPhysicalDeviceSurfacePresentModesKHR(physical_device, surface, &present_modes_count, nullptr);
|
||||
|
||||
|
||||
surfaceCap->present_modes = std::vector<VkPresentModeKHR>(present_modes_count);
|
||||
vkGetPhysicalDeviceSurfacePresentModesKHR(physical_device, surface, &present_modes_count, surfaceCap->present_modes.data());
|
||||
|
||||
|
|
|
@ -8,11 +8,17 @@
|
|||
|
||||
namespace Graphics::Vulkan {
|
||||
|
||||
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;
|
||||
|
||||
void vulkanCreate(Emulator::WindowCtx* ctx);
|
||||
void vulkanGetInstanceExtensions(Emulator::VulkanExt* ext);
|
||||
void vulkanFindCompatiblePhysicalDevice(VkInstance instance, VkSurfaceKHR surface, const std::vector<const char*>& device_extensions,
|
||||
Emulator::VulkanSurfaceCapabilities* out_capabilities, VkPhysicalDevice* out_device, Emulator::VulkanQueues* out_queues);
|
||||
Emulator::VulkanSurfaceCapabilities* out_capabilities, VkPhysicalDevice* out_device,
|
||||
Emulator::VulkanQueues* out_queues);
|
||||
Emulator::VulkanQueues vulkanFindQueues(VkPhysicalDevice device, VkSurfaceKHR surface);
|
||||
void vulkanGetSurfaceCapabilities(VkPhysicalDevice physical_device, VkSurfaceKHR surface,
|
||||
Emulator::VulkanSurfaceCapabilities* surfaceCap);
|
||||
void vulkanGetSurfaceCapabilities(VkPhysicalDevice physical_device, VkSurfaceKHR surface, Emulator::VulkanSurfaceCapabilities* surfaceCap);
|
||||
}; // namespace Graphics::Vulkan
|
Loading…
Reference in New Issue