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

Method MoveToGPU

libs/drape/data_buffer.cpp:19–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19void DataBuffer::MoveToGPU(ref_ptr<GraphicsContext> context, GPUBuffer::Target target, uint64_t batcherHash)
20{
21 // If currentSize is 0 buffer hasn't been filled on preparation stage, let it be filled further.
22 uint32_t const currentSize = m_impl->GetCurrentSize();
23
24 auto const apiVersion = context->GetApiVersion();
25 if (apiVersion == dp::ApiVersion::OpenGLES3)
26 {
27 if (currentSize != 0)
28 {
29 m_impl =
30 make_unique_dp<GpuBufferImpl>(target, m_impl->Data(), m_impl->GetElementSize(), currentSize, batcherHash);
31 }
32 else
33 {
34 m_impl = make_unique_dp<GpuBufferImpl>(target, nullptr, m_impl->GetElementSize(), m_impl->GetAvailableSize(),
35 batcherHash);
36 }
37 }
38 else if (apiVersion == dp::ApiVersion::Metal)
39 {
40#if defined(OMIM_METAL_AVAILABLE)
41 if (currentSize != 0)
42 m_impl = CreateImplForMetal(context, m_impl->Data(), m_impl->GetElementSize(), currentSize);
43 else
44 m_impl = CreateImplForMetal(context, nullptr, m_impl->GetElementSize(), m_impl->GetAvailableSize());
45#endif
46 }
47 else if (apiVersion == dp::ApiVersion::Vulkan)
48 {
49 if (currentSize != 0)
50 m_impl = CreateImplForVulkan(context, m_impl->Data(), m_impl->GetElementSize(), currentSize, batcherHash);
51 else
52 m_impl = CreateImplForVulkan(context, nullptr, m_impl->GetElementSize(), m_impl->GetAvailableSize(), batcherHash);
53 }
54 else
55 {
56 CHECK(false, ("Unsupported API version."));
57 }
58}
59
60DataBufferMapper::DataBufferMapper(ref_ptr<GraphicsContext> context, ref_ptr<DataBuffer> buffer, uint32_t elementOffset,
61 uint32_t elementCount)

Callers 3

PreflushImplMethod · 0.80
ApplyMutationMethod · 0.80
UNIT_TESTFunction · 0.80

Calls 5

GetCurrentSizeMethod · 0.45
GetApiVersionMethod · 0.45
DataMethod · 0.45
GetElementSizeMethod · 0.45
GetAvailableSizeMethod · 0.45

Tested by 1

UNIT_TESTFunction · 0.64