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

Method Map

libs/drape/vulkan/vulkan_gpu_buffer_impl.cpp:31–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31void * VulkanGPUBuffer::Map(ref_ptr<VulkanBaseContext> context, uint32_t elementOffset, uint32_t elementCount)
32{
33 CHECK(m_objectManager != nullptr, ());
34
35 uint32_t const elementSize = GetElementSize();
36 uint32_t const mappingSizeInBytes = elementCount * elementSize;
37 m_mappingByteOffset = elementOffset * elementSize;
38 m_mappingByteOffsetMin = std::numeric_limits<uint32_t>::max();
39 m_mappingByteOffsetMax = std::numeric_limits<uint32_t>::min();
40
41 VkCommandBuffer commandBuffer = context->GetCurrentMemoryCommandBuffer();
42 CHECK(commandBuffer != nullptr, ());
43
44 // Copy to default or temporary staging buffer.
45 m_stagingBufferRef = context->GetDefaultStagingBuffer();
46 if (!m_stagingBufferRef->HasEnoughSpace(mappingSizeInBytes))
47 {
48 m_ownStagingBuffer = make_unique_dp<VulkanStagingBuffer>(m_objectManager, mappingSizeInBytes);
49 ASSERT(m_ownStagingBuffer->HasEnoughSpace(mappingSizeInBytes), ());
50 m_stagingBufferRef = make_ref(m_ownStagingBuffer);
51 }
52
53 VulkanStagingBuffer::StagingData data;
54 m_reservationId = m_stagingBufferRef->ReserveWithId(mappingSizeInBytes, data);
55 return data.m_pointer;
56}
57
58void VulkanGPUBuffer::UpdateData(void * gpuPtr, void const * data, uint32_t elementOffset, uint32_t elementCount)
59{

Callers

nothing calls this directly

Calls 6

ASSERTFunction · 0.85
make_refFunction · 0.85
ReserveWithIdMethod · 0.80
HasEnoughSpaceMethod · 0.45

Tested by

no test coverage detected