OpenGL: Implement buffers

This commit is contained in:
Lynix
2020-04-26 18:20:36 +02:00
parent 494801282d
commit 0b05feb7e3
13 changed files with 213 additions and 209 deletions

View File

@@ -10,9 +10,8 @@
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Utility/AbstractBuffer.hpp>
#include <Nazara/OpenGLRenderer/Config.hpp>
#include <Nazara/OpenGLRenderer/OpenGLDevice.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/Buffer.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/DeviceMemory.hpp>
#include <Nazara/OpenGLRenderer/Wrapper/Fence.hpp>
#include <memory>
#include <vector>
@@ -21,34 +20,31 @@ namespace Nz
class NAZARA_OPENGLRENDERER_API OpenGLBuffer : public AbstractBuffer
{
public:
inline OpenGLBuffer(Vk::Device& device, BufferType type);
OpenGLBuffer(OpenGLDevice& device, BufferType type);
OpenGLBuffer(const OpenGLBuffer&) = delete;
OpenGLBuffer(OpenGLBuffer&&) = delete; ///TODO
virtual ~OpenGLBuffer();
OpenGLBuffer(OpenGLBuffer&&) = delete;
~OpenGLBuffer() = default;
bool Fill(const void* data, UInt64 offset, UInt64 size) override;
bool Initialize(UInt64 size, BufferUsageFlags usage) override;
inline VkBuffer GetBuffer();
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;
bool Unmap() override;
OpenGLBuffer& operator=(const OpenGLBuffer&) = delete;
OpenGLBuffer& operator=(OpenGLBuffer&&) = delete; ///TODO
OpenGLBuffer& operator=(OpenGLBuffer&&) = delete;
private:
GL::Buffer m_buffer;
BufferType m_type;
BufferUsageFlags m_usage;
UInt64 m_size;
VkBuffer m_buffer;
VkBuffer m_stagingBuffer;
VmaAllocation m_allocation;
VmaAllocation m_stagingAllocation;
Vk::Device& m_device;
};
}