blob: d5846c849ce99bbcb596602e9564e4b7b40da389 (
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
|
#pragma once
#include "drape/pointers.hpp"
#include "drape/binding_info.hpp"
#include "base/shared_buffer_manager.hpp"
#include "std/cstdint.hpp"
#include "std/map.hpp"
namespace dp
{
struct MutateRegion
{
MutateRegion() : m_offset(0), m_count(0) {}
MutateRegion(uint16_t offset, uint16_t count) : m_offset(offset), m_count(count) {}
uint16_t m_offset; // Offset from buffer begin in "Elements" not in bytes
uint16_t m_count; // Count of "Elements".
};
struct MutateNode
{
MutateRegion m_region;
RefPointer<void> m_data;
};
class AttributeBufferMutator
{
typedef pair<SharedBufferManager::shared_buffer_ptr_t, size_t> TBufferNode;
typedef vector<TBufferNode> TBufferArray;
typedef vector<MutateNode> TMutateNodes;
typedef map<BindingInfo, TMutateNodes> TMutateData;
public:
~AttributeBufferMutator();
void AddMutation(BindingInfo const & info, MutateNode const & node);
void * AllocateMutationBuffer(uint32_t byteCount);
private:
friend class VertexArrayBuffer;
TMutateData const & GetMutateData() const { return m_data; }
private:
TMutateData m_data;
TBufferArray m_array;
};
} // namespace dp
|