MCPcopy Create free account
hub / github.com/comaps/comaps / BatchData

Method BatchData

libs/drape/batcher_helpers.cpp:259–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

257{}
258
259void TriangleListBatch::BatchData(ref_ptr<GraphicsContext> context, ref_ptr<AttributeProvider> streams)
260{
261 while (streams->IsDataExists())
262 {
263 if (IsBufferFilled(GetAvailableVertexCount(), GetAvailableIndexCount()))
264 ChangeBuffer(context);
265
266 uint32_t avVertex = GetAvailableVertexCount();
267 uint32_t avIndex = GetAvailableIndexCount();
268 uint32_t vertexCount = streams->GetVertexCount();
269
270 if (CanDivideStreams())
271 {
272 vertexCount = std::min(vertexCount, avVertex);
273 vertexCount = std::min(vertexCount, avIndex);
274 ASSERT(vertexCount >= 3, ());
275 vertexCount -= vertexCount % 3;
276 }
277 else if (!IsEnoughMemory(avVertex, vertexCount, avIndex, vertexCount))
278 {
279 ChangeBuffer(context);
280 avVertex = GetAvailableVertexCount();
281 avIndex = GetAvailableIndexCount();
282 ASSERT(IsEnoughMemory(avVertex, vertexCount, avIndex, vertexCount), ());
283 ASSERT(vertexCount % 3 == 0, ());
284 }
285
286 uint32_t startIndex = 0;
287 void * indicesStorage = GetIndexStorage(vertexCount, startIndex);
288 GenerateIndices<ListIndexGenerator>(indicesStorage, vertexCount, startIndex);
289 SubmitIndices(context);
290
291 FlushData(context, streams, vertexCount);
292 streams->Advance(vertexCount);
293 }
294}
295
296LineStripBatch::LineStripBatch(BatchCallbacks & callbacks)
297 : TBase(callbacks, 2 /* minVerticesCount */, 2 /* minIndicesCount */)

Callers 1

InsertPrimitivesMethod · 0.80

Calls 15

ASSERTFunction · 0.85
IsEnoughMemoryFunction · 0.85
GenerateIndicesFunction · 0.85
IsDataExistsMethod · 0.80
GetVertexCountMethod · 0.80
GetStreamCountMethod · 0.80
backMethod · 0.80
AdvanceMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
UploadDataMethod · 0.45

Tested by

no test coverage detected