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

@@ -17,40 +17,34 @@ namespace Nz
public:
IndexBuffer() = default;
IndexBuffer(bool largeIndices, std::shared_ptr<Buffer> buffer);
IndexBuffer(bool largeIndices, std::shared_ptr<Buffer> buffer, std::size_t offset, std::size_t size);
IndexBuffer(bool largeIndices, std::size_t length, DataStorage storage, BufferUsageFlags usage);
IndexBuffer(bool largeIndices, std::shared_ptr<Buffer> buffer, UInt64 offset, UInt64 size);
IndexBuffer(bool largeIndices, UInt64 indexCount, BufferUsageFlags usage, const BufferFactory& bufferFactory, const void* initialData = nullptr);
IndexBuffer(const IndexBuffer&) = default;
IndexBuffer(IndexBuffer&&) noexcept = default;
~IndexBuffer() = default;
unsigned int ComputeCacheMissCount() const;
unsigned int ComputeCacheMissCount();
bool Fill(const void* data, std::size_t startIndex, std::size_t length);
bool FillRaw(const void* data, std::size_t offset, std::size_t size);
bool Fill(const void* data, UInt64 startIndex, UInt64 length);
bool FillRaw(const void* data, UInt64 offset, UInt64 size);
inline const std::shared_ptr<Buffer>& GetBuffer() const;
inline std::size_t GetEndOffset() const;
inline std::size_t GetIndexCount() const;
inline std::size_t GetStride() const;
inline std::size_t GetStartOffset() const;
inline UInt64 GetEndOffset() const;
inline UInt64 GetIndexCount() const;
inline UInt64 GetStride() const;
inline UInt64 GetStartOffset() const;
inline bool HasLargeIndices() const;
inline bool IsValid() const;
inline void* Map(BufferAccess access, std::size_t startVertex = 0, std::size_t length = 0);
inline void* Map(BufferAccess access, std::size_t startVertex = 0, std::size_t length = 0) const;
void* MapRaw(BufferAccess access, std::size_t offset = 0, std::size_t size = 0);
void* MapRaw(BufferAccess access, std::size_t offset = 0, std::size_t size = 0) const;
inline void* Map(UInt64 startIndex, UInt64 length);
inline void* Map(UInt64 startIndex, UInt64 length) const;
void* MapRaw(UInt64 offset, UInt64 size);
void* MapRaw(UInt64 offset, UInt64 size) const;
void Optimize();
void Reset();
void Reset(bool largeIndices, std::shared_ptr<Buffer> buffer);
void Reset(bool largeIndices, std::shared_ptr<Buffer> buffer, std::size_t offset, std::size_t size);
void Reset(bool largeIndices, std::size_t length, DataStorage storage, BufferUsageFlags usage);
void Reset(const IndexBuffer& indexBuffer);
void Unmap() const;
IndexBuffer& operator=(const IndexBuffer&) = default;
@@ -58,9 +52,9 @@ namespace Nz
private:
std::shared_ptr<Buffer> m_buffer;
std::size_t m_endOffset;
std::size_t m_indexCount;
std::size_t m_startOffset;
UInt64 m_endOffset;
UInt64 m_indexCount;
UInt64 m_startOffset;
bool m_largeIndices;
};
}