Renderer: Add RenderDevice::GetDeviceInfo()
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <Nazara/OpenGLRenderer/Config.hpp>
|
||||
#include <Nazara/OpenGLRenderer/Wrapper/Context.hpp>
|
||||
#include <Nazara/Renderer/RenderDevice.hpp>
|
||||
#include <Nazara/Renderer/RenderDeviceInfo.hpp>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
@@ -30,6 +31,7 @@ namespace Nz
|
||||
std::unique_ptr<GL::Context> CreateContext(const GL::ContextParams& params) const;
|
||||
std::unique_ptr<GL::Context> CreateContext(const GL::ContextParams& params, WindowHandle handle) const;
|
||||
|
||||
const RenderDeviceInfo& GetDeviceInfo() const override;
|
||||
inline const GL::Context& GetReferenceContext() const;
|
||||
|
||||
std::shared_ptr<AbstractBuffer> InstantiateBuffer(BufferType type) override;
|
||||
@@ -57,6 +59,7 @@ namespace Nz
|
||||
|
||||
std::unique_ptr<GL::Context> m_referenceContext;
|
||||
mutable std::unordered_set<const GL::Context*> m_contexts;
|
||||
RenderDeviceInfo m_deviceInfo;
|
||||
GL::Loader& m_loader;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <Nazara/Renderer/Config.hpp>
|
||||
#include <Nazara/Renderer/Enums.hpp>
|
||||
#include <Nazara/Renderer/Framebuffer.hpp>
|
||||
#include <Nazara/Renderer/RenderDeviceInfo.hpp>
|
||||
#include <Nazara/Renderer/RenderPass.hpp>
|
||||
#include <Nazara/Renderer/RenderPipeline.hpp>
|
||||
#include <Nazara/Renderer/RenderPipelineLayout.hpp>
|
||||
@@ -33,6 +34,8 @@ namespace Nz
|
||||
RenderDevice() = default;
|
||||
virtual ~RenderDevice();
|
||||
|
||||
virtual const RenderDeviceInfo& GetDeviceInfo() const = 0;
|
||||
|
||||
virtual std::shared_ptr<AbstractBuffer> InstantiateBuffer(BufferType type) = 0;
|
||||
virtual std::shared_ptr<CommandPool> InstantiateCommandPool(QueueType queueType) = 0;
|
||||
virtual std::shared_ptr<Framebuffer> InstantiateFramebuffer(unsigned int width, unsigned int height, const std::shared_ptr<RenderPass>& renderPass, const std::vector<std::shared_ptr<Texture>>& attachments) = 0;
|
||||
|
||||
@@ -9,11 +9,18 @@
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Renderer/Enums.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
struct RenderDeviceLimits
|
||||
{
|
||||
UInt64 minUniformBufferOffsetAlignment;
|
||||
};
|
||||
|
||||
struct RenderDeviceInfo
|
||||
{
|
||||
RenderDeviceLimits limits;
|
||||
RenderDeviceType type;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/Initializer.hpp>
|
||||
#include <Nazara/Core/ParameterList.hpp>
|
||||
#include <Nazara/Renderer/RenderDeviceInfo.hpp>
|
||||
#include <Nazara/VulkanRenderer/Config.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/Device.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/Instance.hpp>
|
||||
@@ -35,6 +36,8 @@ namespace Nz
|
||||
Vulkan() = delete;
|
||||
~Vulkan() = delete;
|
||||
|
||||
static RenderDeviceInfo BuildRenderDeviceInfo(const Vk::PhysicalDevice& physDevice);
|
||||
|
||||
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* graphicsFamilyIndex, UInt32* presentableFamilyIndex, UInt32* transferFamilyIndex);
|
||||
static std::shared_ptr<VulkanDevice> CreateDevice(const Vk::PhysicalDevice& deviceInfo, const QueueFamily* queueFamilies, std::size_t queueFamilyCount);
|
||||
@@ -43,7 +46,7 @@ namespace Nz
|
||||
|
||||
static const std::vector<Vk::PhysicalDevice>& GetPhysicalDevices();
|
||||
static const Vk::PhysicalDevice& GetPhysicalDeviceInfo(VkPhysicalDevice physDevice);
|
||||
|
||||
|
||||
static bool Initialize(UInt32 targetApiVersion, const ParameterList& parameters);
|
||||
|
||||
static bool IsInitialized();
|
||||
|
||||
@@ -18,11 +18,13 @@ namespace Nz
|
||||
class NAZARA_VULKANRENDERER_API VulkanDevice : public RenderDevice, public Vk::Device
|
||||
{
|
||||
public:
|
||||
using Device::Device;
|
||||
inline VulkanDevice(Vk::Instance& instance, RenderDeviceInfo renderDeviceInfo);
|
||||
VulkanDevice(const VulkanDevice&) = delete;
|
||||
VulkanDevice(VulkanDevice&&) = delete; ///TODO?
|
||||
~VulkanDevice();
|
||||
|
||||
const RenderDeviceInfo& GetDeviceInfo() const override;
|
||||
|
||||
std::shared_ptr<AbstractBuffer> InstantiateBuffer(BufferType type) override;
|
||||
std::shared_ptr<CommandPool> InstantiateCommandPool(QueueType queueType) override;
|
||||
std::shared_ptr<Framebuffer> InstantiateFramebuffer(unsigned int width, unsigned int height, const std::shared_ptr<RenderPass>& renderPass, const std::vector<std::shared_ptr<Texture>>& attachments) override;
|
||||
@@ -36,6 +38,9 @@ namespace Nz
|
||||
|
||||
VulkanDevice& operator=(const VulkanDevice&) = delete;
|
||||
VulkanDevice& operator=(VulkanDevice&&) = delete; ///TODO?
|
||||
|
||||
private:
|
||||
RenderDeviceInfo m_renderDeviceInfo;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,11 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline VulkanDevice::VulkanDevice(Vk::Instance& instance, RenderDeviceInfo renderDeviceInfo) :
|
||||
Device(instance),
|
||||
m_renderDeviceInfo(std::move(renderDeviceInfo))
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/VulkanRenderer/DebugOff.hpp>
|
||||
|
||||
@@ -11,20 +11,17 @@
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
namespace Nz
|
||||
namespace Nz::Vk
|
||||
{
|
||||
namespace Vk
|
||||
struct PhysicalDevice
|
||||
{
|
||||
struct PhysicalDevice
|
||||
{
|
||||
VkPhysicalDevice physDevice;
|
||||
VkPhysicalDeviceFeatures features;
|
||||
VkPhysicalDeviceMemoryProperties memoryProperties;
|
||||
VkPhysicalDeviceProperties properties;
|
||||
std::unordered_set<std::string> extensions;
|
||||
std::vector<VkQueueFamilyProperties> queueFamilies;
|
||||
};
|
||||
}
|
||||
VkPhysicalDevice physDevice;
|
||||
VkPhysicalDeviceFeatures features;
|
||||
VkPhysicalDeviceMemoryProperties memoryProperties;
|
||||
VkPhysicalDeviceProperties properties;
|
||||
std::unordered_set<std::string> extensions;
|
||||
std::vector<VkQueueFamilyProperties> queueFamilies;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // NAZARA_VULKANRENDERER_VKPHYSICALDEVICE_HPP
|
||||
|
||||
Reference in New Issue
Block a user