Renderer: RenderWindow now requires a RenderDevice

This commit is contained in:
Lynix
2021-05-16 23:13:00 +02:00
parent 40772f2137
commit 13feaf4aab
30 changed files with 132 additions and 107 deletions

View File

@@ -40,7 +40,16 @@ namespace Nz
bool VulkanRenderer::Prepare(const ParameterList& parameters)
{
return Vulkan::Initialize(APIVersion, parameters);
if (!Vulkan::Initialize(APIVersion, parameters))
return false;
const auto& physDevices = Vulkan::GetPhysicalDevices();
m_deviceInfos.reserve(physDevices.size());
for (const Vk::PhysicalDevice& physDevice : physDevices)
m_deviceInfos.push_back(Vulkan::BuildRenderDeviceInfo(physDevice));
return true;
}
RenderAPI VulkanRenderer::QueryAPI() const
@@ -61,16 +70,8 @@ namespace Nz
return APIVersion;
}
std::vector<RenderDeviceInfo> VulkanRenderer::QueryRenderDevices() const
const std::vector<RenderDeviceInfo>& VulkanRenderer::QueryRenderDevices() const
{
const auto& physDevices = Vulkan::GetPhysicalDevices();
std::vector<RenderDeviceInfo> devices;
devices.reserve(physDevices.size());
for (const Vk::PhysicalDevice& physDevice : physDevices)
devices.push_back(Vulkan::BuildRenderDeviceInfo(physDevice));
return devices;
return m_deviceInfos;
}
}