blob: 724cd33eb4f8d8d5f0737079ae5f616a7a3950fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#pragma once
#include "drape/pointers.hpp"
#include "drape/gpu_buffer.hpp"
namespace dp
{
class DataBufferBase
{
public:
virtual ~DataBufferBase() {}
virtual uint16_t GetCapacity() const = 0;
virtual uint16_t GetCurrentSize() const = 0;
virtual uint16_t GetAvailableSize() const = 0;
virtual uint8_t GetElementSize() const = 0;
virtual void Seek(uint16_t elementNumber) = 0;
virtual void const * Data() const = 0;
virtual void UploadData(void const * data, uint16_t elementCount) = 0;
virtual void UpdateData(void * destPtr, void const * srcPtr, uint16_t elementOffset, uint16_t elementCount) = 0;
virtual void Bind() = 0;
virtual void * Map() = 0;
virtual void Unmap() = 0;
};
class DataBuffer
{
public:
DataBuffer(uint8_t elementSize, uint16_t capacity);
virtual ~DataBuffer();
ref_ptr<DataBufferBase> GetBuffer() const;
void MoveToGPU(GPUBuffer::Target target);
private:
drape_ptr<DataBufferBase> m_impl;
};
class DataBufferMapper
{
public:
DataBufferMapper(ref_ptr<DataBuffer> buffer);
~DataBufferMapper();
void UpdateData(void const * data, uint16_t elementOffset, uint16_t elementCount);
private:
ref_ptr<DataBuffer> m_buffer;
void * m_ptr;
};
} // namespace dp
|