Big buffer refactor

Replaced RenderBuffer class, replaced AbstractBuffer by Buffer
This commit is contained in:
Jérôme Leclercq
2022-01-23 00:05:08 +01:00
parent 754a0016c7
commit 29786765c6
98 changed files with 699 additions and 1427 deletions

View File

@@ -11,30 +11,25 @@
#include <Nazara/OpenGLRenderer/Config.hpp>
#include <Nazara/OpenGLRenderer/OpenGLDevice.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/Buffer.hpp>
#include <Nazara/Utility/AbstractBuffer.hpp>
#include <Nazara/Renderer/RenderBuffer.hpp>
#include <memory>
#include <vector>
namespace Nz
{
class NAZARA_OPENGLRENDERER_API OpenGLBuffer : public AbstractBuffer
class NAZARA_OPENGLRENDERER_API OpenGLBuffer : public RenderBuffer
{
public:
OpenGLBuffer(OpenGLDevice& device, BufferType type);
OpenGLBuffer(OpenGLDevice& device, BufferType type, UInt64 size, BufferUsageFlags usage, const void* initialData = nullptr);
OpenGLBuffer(const OpenGLBuffer&) = delete;
OpenGLBuffer(OpenGLBuffer&&) = delete;
~OpenGLBuffer() = default;
bool Fill(const void* data, UInt64 offset, UInt64 size) override;
bool Initialize(UInt64 size, BufferUsageFlags usage) override;
inline const GL::Buffer& GetBuffer() const;
UInt64 GetSize() const override;
DataStorage GetStorage() const override;
inline BufferType GetType() const;
void* Map(BufferAccess access, UInt64 offset, UInt64 size) override;
void* Map(UInt64 offset, UInt64 size) override;
bool Unmap() override;
OpenGLBuffer& operator=(const OpenGLBuffer&) = delete;
@@ -42,9 +37,6 @@ namespace Nz
private:
GL::Buffer m_buffer;
BufferType m_type;
BufferUsageFlags m_usage;
UInt64 m_size;
};
}

View File

@@ -11,11 +11,6 @@ namespace Nz
{
return m_buffer;
}
inline BufferType OpenGLBuffer::GetType() const
{
return m_type;
}
}
#include <Nazara/OpenGLRenderer/DebugOff.hpp>

View File

@@ -26,11 +26,11 @@ namespace Nz
void BeginDebugRegion(const std::string_view& regionName, const Color& color) override;
void BeginRenderPass(const Framebuffer& framebuffer, const RenderPass& renderPass, const Recti& renderRect, const ClearValues* clearValues, std::size_t clearValueCount) override;
void BindIndexBuffer(const AbstractBuffer& indexBuffer, UInt64 offset = 0) override;
void BindIndexBuffer(const RenderBuffer& indexBuffer, UInt64 offset = 0) override;
void BindPipeline(const RenderPipeline& pipeline) override;
void BindShaderBinding(UInt32 set, const ShaderBinding& binding) override;
void BindShaderBinding(const RenderPipelineLayout& pipelineLayout, UInt32 set, const ShaderBinding& binding) override;
void BindVertexBuffer(UInt32 binding, const AbstractBuffer& vertexBuffer, UInt64 offset = 0) override;
void BindVertexBuffer(UInt32 binding, const RenderBuffer& vertexBuffer, UInt64 offset = 0) override;
void BlitTexture(const Texture& fromTexture, const Boxui& fromBox, TextureLayout fromLayout, const Texture& toTexture, const Boxui& toBox, TextureLayout toLayout, SamplerFilter filter) override;

View File

@@ -35,7 +35,7 @@ namespace Nz
const RenderDeviceFeatures& GetEnabledFeatures() const override;
inline const GL::Context& GetReferenceContext() const;
std::shared_ptr<AbstractBuffer> InstantiateBuffer(BufferType type) override;
std::shared_ptr<RenderBuffer> InstantiateBuffer(BufferType type, UInt64 size, BufferUsageFlags usageFlags, const void* initialData = nullptr) 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;
std::shared_ptr<RenderPass> InstantiateRenderPass(std::vector<RenderPass::Attachment> attachments, std::vector<RenderPass::SubpassDescription> subpassDescriptions, std::vector<RenderPass::SubpassDependency> subpassDependencies) override;