some vulkan queue work

This commit is contained in:
georgemoralis 2023-09-19 09:15:59 +03:00
parent 78bafe88fa
commit faf9a03437
3 changed files with 42 additions and 2 deletions

View File

@ -2,8 +2,8 @@
#include <Core/PS4/HLE/Graphics/graphics_ctx.h> #include <Core/PS4/HLE/Graphics/graphics_ctx.h>
#include <Lib/Threads.h> #include <Lib/Threads.h>
#include <SDL.h> #include <SDL.h>
#include <vector>
#include <vector>
namespace Emulator { namespace Emulator {
@ -18,7 +18,9 @@ struct VulkanExt {
struct VulkanSurfaceCapabilities {}; struct VulkanSurfaceCapabilities {};
struct VulkanQueues {}; struct VulkanQueues {
u32 family_count = 0;
};
struct WindowCtx { struct WindowCtx {
HLE::Libs::Graphics::GraphicCtx m_graphic_ctx; HLE::Libs::Graphics::GraphicCtx m_graphic_ctx;

View File

@ -4,6 +4,7 @@
#include <Util/log.h> #include <Util/log.h>
#include <debug.h> #include <debug.h>
#include <vulkan/vulkan_core.h> #include <vulkan/vulkan_core.h>
#include <vulkan/vk_enum_string_helper.h>
constexpr bool log_file_vulkanutil = true; // disable it to disable logging constexpr bool log_file_vulkanutil = true; // disable it to disable logging
@ -103,5 +104,41 @@ void Graphics::Vulkan::vulkanFindCompatiblePhysicalDevice(VkInstance instance, V
Emulator::VulkanQueues found_best_queues; Emulator::VulkanQueues found_best_queues;
for (const auto& device : devices) { for (const auto& device : devices) {
VkPhysicalDeviceProperties device_properties{};
VkPhysicalDeviceFeatures2 device_features2{};
vkGetPhysicalDeviceProperties(device, &device_properties);
vkGetPhysicalDeviceFeatures2(device, &device_features2);
if (device_properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU) {
continue; // we don't want integrated gpu for now .Later we will check the requirements and see what we can support (TODO fix me)
}
LOG_INFO_IF(log_file_vulkanutil,"Vulkan device: {}\n", device_properties.deviceName);
auto qs = vulkanFindQueues(device, surface);
} }
} }
Emulator::VulkanQueues Graphics::Vulkan::vulkanFindQueues(VkPhysicalDevice device, VkSurfaceKHR surface) {
Emulator::VulkanQueues qs;
u32 queue_family_count = 0;
vkGetPhysicalDeviceQueueFamilyProperties(device, &queue_family_count, nullptr);
std::vector<VkQueueFamilyProperties> queue_families(queue_family_count);
vkGetPhysicalDeviceQueueFamilyProperties(device, &queue_family_count, queue_families.data());
qs.family_count = queue_family_count;
u32 family = 0;
for (auto& f : queue_families) {
VkBool32 presentation_supported = VK_FALSE;
vkGetPhysicalDeviceSurfaceSupportKHR(device, family, surface, &presentation_supported);
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"));
family++;
}
return qs;
}

View File

@ -12,4 +12,5 @@ void vulkanCreate(Emulator::WindowCtx* ctx);
void vulkanGetInstanceExtensions(Emulator::VulkanExt* ext); void vulkanGetInstanceExtensions(Emulator::VulkanExt* ext);
void vulkanFindCompatiblePhysicalDevice(VkInstance instance, VkSurfaceKHR surface, const std::vector<const char*>& device_extensions, 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);
}; // namespace Graphics::Vulkan }; // namespace Graphics::Vulkan