Cleanup device creation/selection

This commit is contained in:
Lynix
2020-03-18 13:48:53 +01:00
parent 4ede9f1cfe
commit 07fa581525
8 changed files with 51 additions and 54 deletions

View File

@@ -58,13 +58,12 @@ namespace Nz
private:
bool SetupDepthBuffer(const Vector2ui& size);
bool SetupRenderPass();
bool SetupSwapchain(Vk::Surface& surface, const Vector2ui& size);
bool SetupSwapchain(const Vk::PhysicalDevice& deviceInfo, Vk::Surface& surface, const Vector2ui& size);
Clock m_clock;
VkColorSpaceKHR m_colorSpace;
VkFormat m_colorFormat;
VkFormat m_depthStencilFormat;
VkPhysicalDevice m_physicalDevice;
std::shared_ptr<VulkanDevice> m_device;
std::vector<Vk::Framebuffer> m_frameBuffers;
Vk::DeviceMemory m_depthBufferMemory;

View File

@@ -35,9 +35,9 @@ namespace Nz
Vulkan() = delete;
~Vulkan() = delete;
static std::shared_ptr<VulkanDevice> CreateDevice(VkPhysicalDevice gpu);
static std::shared_ptr<VulkanDevice> CreateDevice(VkPhysicalDevice gpu, const Vk::Surface& surface, UInt32* presentableFamilyQueue);
static std::shared_ptr<VulkanDevice> CreateDevice(VkPhysicalDevice gpu, const QueueFamily* queueFamilies, std::size_t queueFamilyCount);
static std::shared_ptr<VulkanDevice> CreateDevice(const Vk::PhysicalDevice& deviceInfo);
static std::shared_ptr<VulkanDevice> CreateDevice(const Vk::PhysicalDevice& deviceInfo, const Vk::Surface& surface, UInt32* presentableFamilyQueue);
static std::shared_ptr<VulkanDevice> CreateDevice(const Vk::PhysicalDevice& deviceInfo, const QueueFamily* queueFamilies, std::size_t queueFamilyCount);
static Vk::Instance& GetInstance();
@@ -48,8 +48,8 @@ namespace Nz
static bool IsInitialized();
static std::shared_ptr<VulkanDevice> SelectDevice(VkPhysicalDevice gpu);
static std::shared_ptr<VulkanDevice> SelectDevice(VkPhysicalDevice gpu, const Vk::Surface& surface, UInt32* presentableFamilyQueue);
static std::shared_ptr<VulkanDevice> SelectDevice(const Vk::PhysicalDevice& deviceInfo);
static std::shared_ptr<VulkanDevice> SelectDevice(const Vk::PhysicalDevice& deviceInfo, const Vk::Surface& surface, UInt32* presentableFamilyQueue);
static void Uninitialize();

View File

@@ -41,7 +41,7 @@ namespace Nz
inline VkPhysicalDevice Device::GetPhysicalDevice() const
{
return m_physicalDevice->device;
return m_physicalDevice->physDevice;
}
inline const Vk::PhysicalDevice& Device::GetPhysicalDeviceInfo() const

View File

@@ -8,6 +8,7 @@
#define NAZARA_VULKANRENDERER_VKPHYSICALDEVICE_HPP
#include <vulkan/vulkan.h>
#include <unordered_set>
#include <vector>
namespace Nz
@@ -16,11 +17,11 @@ namespace Nz
{
struct PhysicalDevice
{
VkPhysicalDevice device;
VkPhysicalDevice physDevice;
VkPhysicalDeviceFeatures features;
VkPhysicalDeviceMemoryProperties memoryProperties;
VkPhysicalDeviceProperties properties;
std::vector<VkQueueFamilyProperties> queues;
std::vector<VkQueueFamilyProperties> queueFamilies;
};
}
}