Renderer: Replace unique_ptr by shared_ptr

This commit is contained in:
Jérôme Leclercq
2020-09-20 15:56:58 +02:00
parent 77b46e4811
commit f15709c8a3
13 changed files with 55 additions and 55 deletions

View File

@@ -32,13 +32,13 @@ namespace Nz
inline const GL::Context& GetReferenceContext() const;
std::unique_ptr<AbstractBuffer> InstantiateBuffer(BufferType type) override;
std::unique_ptr<CommandPool> InstantiateCommandPool(QueueType queueType) override;
std::unique_ptr<RenderPipeline> InstantiateRenderPipeline(RenderPipelineInfo pipelineInfo) override;
std::shared_ptr<AbstractBuffer> InstantiateBuffer(BufferType type) override;
std::shared_ptr<CommandPool> InstantiateCommandPool(QueueType queueType) override;
std::shared_ptr<RenderPipeline> InstantiateRenderPipeline(RenderPipelineInfo pipelineInfo) override;
std::shared_ptr<RenderPipelineLayout> InstantiateRenderPipelineLayout(RenderPipelineLayoutInfo pipelineLayoutInfo) override;
std::shared_ptr<ShaderStageImpl> InstantiateShaderStage(ShaderStageType type, ShaderLanguage lang, const void* source, std::size_t sourceSize) override;
std::unique_ptr<Texture> InstantiateTexture(const TextureInfo& params) override;
std::unique_ptr<TextureSampler> InstantiateTextureSampler(const TextureSamplerInfo& params) override;
std::shared_ptr<Texture> InstantiateTexture(const TextureInfo& params) override;
std::shared_ptr<TextureSampler> InstantiateTextureSampler(const TextureSamplerInfo& params) override;
inline void NotifyBufferDestruction(GLuint buffer) const;
inline void NotifyProgramDestruction(GLuint program) const;

View File

@@ -31,7 +31,7 @@ namespace Nz
RenderFrame Acquire() override;
bool Create(RendererImpl* renderer, RenderSurface* surface, const RenderWindowParameters& parameters) override;
std::unique_ptr<CommandPool> CreateCommandPool(QueueType queueType) override;
std::shared_ptr<CommandPool> CreateCommandPool(QueueType queueType) override;
inline GL::Context& GetContext();
const OpenGLFramebuffer& GetFramebuffer() const override;

View File

@@ -51,7 +51,7 @@ namespace Nz
struct HardwareBuffer
{
std::unique_ptr<AbstractBuffer> buffer;
std::shared_ptr<AbstractBuffer> buffer;
bool synchronized = false;
};

View File

@@ -29,14 +29,14 @@ namespace Nz
RenderDevice() = default;
virtual ~RenderDevice();
virtual std::unique_ptr<AbstractBuffer> InstantiateBuffer(BufferType type) = 0;
virtual std::unique_ptr<CommandPool> InstantiateCommandPool(QueueType queueType) = 0;
virtual std::unique_ptr<RenderPipeline> InstantiateRenderPipeline(RenderPipelineInfo pipelineInfo) = 0;
virtual std::shared_ptr<AbstractBuffer> InstantiateBuffer(BufferType type) = 0;
virtual std::shared_ptr<CommandPool> InstantiateCommandPool(QueueType queueType) = 0;
virtual std::shared_ptr<RenderPipeline> InstantiateRenderPipeline(RenderPipelineInfo pipelineInfo) = 0;
virtual std::shared_ptr<RenderPipelineLayout> InstantiateRenderPipelineLayout(RenderPipelineLayoutInfo pipelineLayoutInfo) = 0;
virtual std::shared_ptr<ShaderStageImpl> InstantiateShaderStage(ShaderStageType type, ShaderLanguage lang, const void* source, std::size_t sourceSize) = 0;
std::shared_ptr<ShaderStageImpl> InstantiateShaderStage(ShaderStageType type, ShaderLanguage lang, const std::filesystem::path& sourcePath);
virtual std::unique_ptr<Texture> InstantiateTexture(const TextureInfo& params) = 0;
virtual std::unique_ptr<TextureSampler> InstantiateTextureSampler(const TextureSamplerInfo& params) = 0;
virtual std::shared_ptr<Texture> InstantiateTexture(const TextureInfo& params) = 0;
virtual std::shared_ptr<TextureSampler> InstantiateTextureSampler(const TextureSamplerInfo& params) = 0;
};
}

View File

@@ -32,7 +32,7 @@ namespace Nz
virtual RenderFrame Acquire() = 0;
virtual bool Create(RendererImpl* renderer, RenderSurface* surface, const RenderWindowParameters& parameters) = 0;
virtual std::unique_ptr<CommandPool> CreateCommandPool(QueueType queueType) = 0;
virtual std::shared_ptr<CommandPool> CreateCommandPool(QueueType queueType) = 0;
virtual const Framebuffer& GetFramebuffer() const = 0;
virtual std::shared_ptr<RenderDevice> GetRenderDevice() = 0;

View File

@@ -46,7 +46,7 @@ namespace Nz
bool Create(RendererImpl* renderer, RenderSurface* surface, const RenderWindowParameters& parameters) override;
std::unique_ptr<CommandPool> CreateCommandPool(QueueType queueType) override;
std::shared_ptr<CommandPool> CreateCommandPool(QueueType queueType) override;
inline const VulkanMultipleFramebuffer& GetFramebuffer() const override;
inline VulkanDevice& GetDevice();

View File

@@ -23,13 +23,13 @@ namespace Nz
VulkanDevice(VulkanDevice&&) = delete; ///TODO?
~VulkanDevice();
std::unique_ptr<AbstractBuffer> InstantiateBuffer(BufferType type) override;
std::unique_ptr<CommandPool> InstantiateCommandPool(QueueType queueType) override;
std::unique_ptr<RenderPipeline> InstantiateRenderPipeline(RenderPipelineInfo pipelineInfo) override;
std::shared_ptr<AbstractBuffer> InstantiateBuffer(BufferType type) override;
std::shared_ptr<CommandPool> InstantiateCommandPool(QueueType queueType) override;
std::shared_ptr<RenderPipeline> InstantiateRenderPipeline(RenderPipelineInfo pipelineInfo) override;
std::shared_ptr<RenderPipelineLayout> InstantiateRenderPipelineLayout(RenderPipelineLayoutInfo pipelineLayoutInfo) override;
std::shared_ptr<ShaderStageImpl> InstantiateShaderStage(ShaderStageType type, ShaderLanguage lang, const void* source, std::size_t sourceSize) override;
std::unique_ptr<Texture> InstantiateTexture(const TextureInfo& params) override;
std::unique_ptr<TextureSampler> InstantiateTextureSampler(const TextureSamplerInfo& params) override;
std::shared_ptr<Texture> InstantiateTexture(const TextureInfo& params) override;
std::shared_ptr<TextureSampler> InstantiateTextureSampler(const TextureSamplerInfo& params) override;
VulkanDevice& operator=(const VulkanDevice&) = delete;
VulkanDevice& operator=(VulkanDevice&&) = delete; ///TODO?