VulkanRenderer: Move all the initialization back to the Vulkan static class

This commit is contained in:
Lynix
2016-10-28 22:30:22 +02:00
parent 5eefbdeb60
commit a1352b8823
5 changed files with 53 additions and 239 deletions

View File

@@ -33,14 +33,12 @@ namespace Nz
static const std::vector<Vk::PhysicalDevice>& GetPhysicalDevices();
static const Vk::PhysicalDevice& GetPhysicalDeviceInfo(VkPhysicalDevice physDevice);
static bool Initialize();
static bool Initialize(UInt32 apiVersion, const ParameterList& parameters);
static bool IsInitialized();
static Vk::DeviceHandle SelectDevice(VkPhysicalDevice gpu, const Vk::Surface& surface, UInt32* presentableFamilyQueue);
static void SetParameters(const ParameterList& parameters);
static void Uninitialize();
private:
@@ -48,7 +46,6 @@ namespace Nz
static std::vector<Vk::PhysicalDevice> s_physDevices;
static Vk::Instance s_instance;
static ParameterList s_initializationParameters;
static unsigned int s_moduleReferenceCounter;
};
}

View File

@@ -10,8 +10,12 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Renderer/RendererImpl.hpp>
#include <Nazara/VulkanRenderer/Config.hpp>
#include <Nazara/VulkanRenderer/VkDevice.hpp>
#include <Nazara/VulkanRenderer/VkInstance.hpp>
#include <Nazara/VulkanRenderer/VkPhysicalDevice.hpp>
#include <Nazara/VulkanRenderer/VkSurface.hpp>
#include <list>
#include <vector>
namespace Nz
{
@@ -19,7 +23,7 @@ namespace Nz
{
public:
VulkanRenderer() = default;
~VulkanRenderer() = default;
~VulkanRenderer();
std::unique_ptr<RenderWindowImpl> CreateRenderWindowImpl() override;
@@ -35,10 +39,14 @@ namespace Nz
static constexpr UInt32 APIVersion = VK_API_VERSION_1_0;
private:
Vk::Instance m_instance;
std::list<Vk::Device> m_devices;
std::vector<Vk::PhysicalDevice> m_physDevices;
ParameterList m_initializationParameters;
Vk::Instance m_instance;
UInt32 m_apiVersion;
};
}
#include <Nazara/VulkanRenderer/VulkanRenderer.inl>
#endif // NAZARA_VULKANRENDERER_HPP

View File

@@ -0,0 +1,12 @@
// Copyright (C) 2016 Jérôme Leclercq
// This file is part of the "Nazara Engine - Vulkan Renderer"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/VulkanRenderer/VulkanRenderer.hpp>
#include <Nazara/VulkanRenderer/Debug.hpp>
namespace Nz
{
}
#include <Nazara/VulkanRenderer/DebugOff.hpp>