// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) // This file is part of the "Nazara Engine - Vulkan renderer" // For conditions of distribution and use, see copyright notice in Config.hpp #include #include #include #include #include #include #include #include #include #include namespace Nz { VulkanRenderer::~VulkanRenderer() { Vulkan::Uninitialize(); } std::unique_ptr VulkanRenderer::CreateRenderSurfaceImpl() { return std::make_unique(); } std::unique_ptr VulkanRenderer::CreateRenderWindowImpl(RenderWindow& owner) { return std::make_unique(owner); } std::shared_ptr VulkanRenderer::InstanciateRenderDevice(std::size_t deviceIndex, const RenderDeviceFeatures& enabledFeatures) { const auto& physDevices = Vulkan::GetPhysicalDevices(); assert(deviceIndex < physDevices.size()); return Vulkan::CreateDevice(physDevices[deviceIndex], enabledFeatures); } bool VulkanRenderer::Prepare(const ParameterList& 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 { return RenderAPI::Vulkan; } std::string VulkanRenderer::QueryAPIString() const { std::ostringstream ss; ss << "Vulkan renderer " << VK_VERSION_MAJOR(APIVersion) << '.' << VK_VERSION_MINOR(APIVersion) << '.' << VK_VERSION_PATCH(APIVersion); return ss.str(); } UInt32 VulkanRenderer::QueryAPIVersion() const { return APIVersion; } const std::vector& VulkanRenderer::QueryRenderDevices() const { return m_deviceInfos; } } #if defined(NAZARA_PLATFORM_WINDOWS) #include #endif