MCPcopy Create free account
hub / github.com/comaps/comaps / Batcher::CallbacksWrapper

Class Batcher::CallbacksWrapper

libs/drape/batcher.cpp:14–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12namespace dp
13{
14class Batcher::CallbacksWrapper : public BatchCallbacks
15{
16public:
17 CallbacksWrapper(RenderState const & state, ref_ptr<OverlayHandle> overlay, ref_ptr<Batcher> batcher)
18 : m_state(state)
19 , m_overlay(overlay)
20 , m_batcher(batcher)
21 {}
22
23 void SetVAO(ref_ptr<VertexArrayBuffer> buffer)
24 {
25 // Invocation with non-null VAO will cause to invalid range of indices.
26 // It means that VAO has been changed during batching.
27 if (m_buffer != nullptr)
28 m_vaoChanged = true;
29
30 m_buffer = buffer;
31 m_indicesRange.m_idxStart = m_buffer->GetIndexCount();
32 }
33
34 void FlushData(ref_ptr<GraphicsContext> context, BindingInfo const & info, void const * data, uint32_t count) override
35 {
36 if (m_overlay != nullptr && info.IsDynamic())
37 {
38 uint32_t offset = m_buffer->GetDynamicBufferOffset(info);
39 m_overlay->AddDynamicAttribute(info, offset, count);
40 }
41 m_buffer->UploadData(context, info, data, count);
42 }
43
44 void * GetIndexStorage(uint32_t size, uint32_t & startIndex) override
45 {
46 startIndex = m_buffer->GetStartIndexValue();
47 if (m_overlay == nullptr || !m_overlay->IndexesRequired())
48 {
49 m_indexStorage.Resize(size);
50 return m_indexStorage.GetRaw();
51 }
52 else
53 {
54 return m_overlay->IndexStorage(size);
55 }
56 }
57
58 void SubmitIndices(ref_ptr<GraphicsContext> context) override
59 {
60 if (m_overlay == nullptr || !m_overlay->IndexesRequired())
61 m_buffer->UploadIndices(context, m_indexStorage.GetRawConst(), m_indexStorage.Size());
62 }
63
64 uint32_t GetAvailableVertexCount() const override { return m_buffer->GetAvailableVertexCount(); }
65
66 uint32_t GetAvailableIndexCount() const override { return m_buffer->GetAvailableIndexCount(); }
67
68 void ChangeBuffer(ref_ptr<GraphicsContext> context) override { m_batcher->ChangeBuffer(context, make_ref(this)); }
69
70 RenderState const & GetState() const { return m_state; }
71

Callers

nothing calls this directly

Calls 2

IndicesRangeClass · 0.85
GetIndexCountMethod · 0.45

Tested by

no test coverage detected