Turned DataStorage enum into flags

Allowing for example hybrid buffer implementation


Former-commit-id: 74af1ba5b11b945abdfa6b46d0c11d600eca6d7c
This commit is contained in:
Lynix
2015-01-06 13:36:58 +01:00
parent fc1e75d379
commit 5cbdd8832c
8 changed files with 35 additions and 34 deletions

View File

@@ -28,19 +28,19 @@ class NAZARA_API NzBuffer : public NzResource, NzNonCopyable
using BufferFactory = NzAbstractBuffer* (*)(NzBuffer* parent, nzBufferType type);
NzBuffer(nzBufferType type);
NzBuffer(nzBufferType type, unsigned int size, nzDataStorage storage = nzDataStorage_Software, nzBufferUsage usage = nzBufferUsage_Static);
NzBuffer(nzBufferType type, unsigned int size, nzUInt32 storage = nzDataStorage_Software, nzBufferUsage usage = nzBufferUsage_Static);
~NzBuffer();
bool CopyContent(const NzBuffer& buffer);
bool Create(unsigned int size, nzDataStorage storage = nzDataStorage_Software, nzBufferUsage usage = nzBufferUsage_Static);
bool Create(unsigned int size, nzUInt32 storage = nzDataStorage_Software, nzBufferUsage usage = nzBufferUsage_Static);
void Destroy();
bool Fill(const void* data, unsigned int offset, unsigned int size, bool forceDiscard = false);
NzAbstractBuffer* GetImpl() const;
unsigned int GetSize() const;
nzDataStorage GetStorage() const;
nzUInt32 GetStorage() const;
nzBufferType GetType() const;
nzBufferUsage GetUsage() const;
@@ -50,12 +50,12 @@ class NAZARA_API NzBuffer : public NzResource, NzNonCopyable
void* Map(nzBufferAccess access, unsigned int offset = 0, unsigned int size = 0);
void* Map(nzBufferAccess access, unsigned int offset = 0, unsigned int size = 0) const;
bool SetStorage(nzDataStorage storage);
bool SetStorage(nzUInt32 storage);
void Unmap() const;
static bool IsStorageSupported(nzDataStorage storage);
static void SetBufferFactory(nzDataStorage storage, BufferFactory func);
static bool IsStorageSupported(nzUInt32 storage);
static void SetBufferFactory(nzUInt32 storage, BufferFactory func);
private:
static bool Initialize();
@@ -63,7 +63,7 @@ class NAZARA_API NzBuffer : public NzResource, NzNonCopyable
nzBufferType m_type;
nzBufferUsage m_usage;
nzDataStorage m_storage;
nzUInt32 m_storage;
NzAbstractBuffer* m_impl;
unsigned int m_size;