Renderer: Add pipeline and texture sampler info validation
This commit is contained in:
@@ -32,6 +32,7 @@ namespace Nz
|
||||
std::unique_ptr<GL::Context> CreateContext(const GL::ContextParams& params, WindowHandle handle) const;
|
||||
|
||||
const RenderDeviceInfo& GetDeviceInfo() const override;
|
||||
const RenderDeviceFeatures& GetEnabledFeatures() const override;
|
||||
inline const GL::Context& GetReferenceContext() const;
|
||||
|
||||
std::shared_ptr<AbstractBuffer> InstantiateBuffer(BufferType type) override;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Nz
|
||||
class NAZARA_OPENGLRENDERER_API OpenGLTextureSampler : public TextureSampler
|
||||
{
|
||||
public:
|
||||
OpenGLTextureSampler(OpenGLDevice& device, const TextureSamplerInfo& samplerInfo);
|
||||
OpenGLTextureSampler(OpenGLDevice& device, TextureSamplerInfo samplerInfo);
|
||||
OpenGLTextureSampler(const OpenGLTextureSampler&) = delete;
|
||||
OpenGLTextureSampler(OpenGLTextureSampler&&) = delete;
|
||||
~OpenGLTextureSampler() = default;
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace Nz
|
||||
virtual ~RenderDevice();
|
||||
|
||||
virtual const RenderDeviceInfo& GetDeviceInfo() const = 0;
|
||||
virtual const RenderDeviceFeatures& GetEnabledFeatures() const = 0;
|
||||
|
||||
virtual std::shared_ptr<AbstractBuffer> InstantiateBuffer(BufferType type) = 0;
|
||||
virtual std::shared_ptr<CommandPool> InstantiateCommandPool(QueueType queueType) = 0;
|
||||
@@ -50,6 +51,8 @@ namespace Nz
|
||||
virtual std::shared_ptr<TextureSampler> InstantiateTextureSampler(const TextureSamplerInfo& params) = 0;
|
||||
|
||||
virtual bool IsTextureFormatSupported(PixelFormat format, TextureUsage usage) const = 0;
|
||||
|
||||
static void ValidateFeatures(const RenderDeviceFeatures& supportedFeatures, RenderDeviceFeatures& enabledFeatures);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ namespace Nz
|
||||
inline bool operator!=(const TextureSamplerInfo& samplerInfo) const;
|
||||
};
|
||||
|
||||
class RenderDevice;
|
||||
|
||||
class NAZARA_RENDERER_API TextureSampler
|
||||
{
|
||||
public:
|
||||
@@ -38,6 +40,9 @@ namespace Nz
|
||||
|
||||
TextureSampler& operator=(const TextureSampler&) = delete;
|
||||
TextureSampler& operator=(TextureSampler&&) = delete;
|
||||
|
||||
protected:
|
||||
static void ValidateSamplerInfo(const RenderDevice& device, TextureSamplerInfo& samplerInfo);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -18,12 +18,13 @@ namespace Nz
|
||||
class NAZARA_VULKANRENDERER_API VulkanDevice : public RenderDevice, public Vk::Device
|
||||
{
|
||||
public:
|
||||
inline VulkanDevice(Vk::Instance& instance, RenderDeviceInfo renderDeviceInfo);
|
||||
inline VulkanDevice(Vk::Instance& instance, const RenderDeviceFeatures& enabledFeatures, RenderDeviceInfo renderDeviceInfo);
|
||||
VulkanDevice(const VulkanDevice&) = delete;
|
||||
VulkanDevice(VulkanDevice&&) = delete; ///TODO?
|
||||
~VulkanDevice();
|
||||
|
||||
const RenderDeviceInfo& GetDeviceInfo() const override;
|
||||
const RenderDeviceFeatures& GetEnabledFeatures() const override;
|
||||
|
||||
std::shared_ptr<AbstractBuffer> InstantiateBuffer(BufferType type) override;
|
||||
std::shared_ptr<CommandPool> InstantiateCommandPool(QueueType queueType) override;
|
||||
@@ -42,6 +43,7 @@ namespace Nz
|
||||
VulkanDevice& operator=(VulkanDevice&&) = delete; ///TODO?
|
||||
|
||||
private:
|
||||
RenderDeviceFeatures m_enabledFeatures;
|
||||
RenderDeviceInfo m_renderDeviceInfo;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline VulkanDevice::VulkanDevice(Vk::Instance& instance, RenderDeviceInfo renderDeviceInfo) :
|
||||
inline VulkanDevice::VulkanDevice(Vk::Instance& instance, const RenderDeviceFeatures& enabledFeatures, RenderDeviceInfo renderDeviceInfo) :
|
||||
Device(instance),
|
||||
m_enabledFeatures(enabledFeatures),
|
||||
m_renderDeviceInfo(std::move(renderDeviceInfo))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -19,12 +19,14 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class VulkanDevice;
|
||||
|
||||
class NAZARA_VULKANRENDERER_API VulkanRenderPipeline : public RenderPipeline
|
||||
{
|
||||
public:
|
||||
struct CreateInfo;
|
||||
|
||||
VulkanRenderPipeline(Vk::Device& device, RenderPipelineInfo pipelineInfo);
|
||||
VulkanRenderPipeline(VulkanDevice& device, RenderPipelineInfo pipelineInfo);
|
||||
~VulkanRenderPipeline() = default;
|
||||
|
||||
VkPipeline Get(const VulkanRenderPass& renderPass, std::size_t subpassIndex) const;
|
||||
|
||||
@@ -13,10 +13,12 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class VulkanDevice;
|
||||
|
||||
class NAZARA_VULKANRENDERER_API VulkanTextureSampler : public TextureSampler
|
||||
{
|
||||
public:
|
||||
VulkanTextureSampler(Vk::Device& device, TextureSamplerInfo samplerInfo);
|
||||
VulkanTextureSampler(VulkanDevice& device, TextureSamplerInfo samplerInfo);
|
||||
VulkanTextureSampler(const VulkanTextureSampler&) = delete;
|
||||
VulkanTextureSampler(VulkanTextureSampler&&) = delete;
|
||||
~VulkanTextureSampler() = default;
|
||||
|
||||
Reference in New Issue
Block a user