SpiecsEngine
 
Loading...
Searching...
No Matches

◆ WriteFromBuffer()

void Spices::VulkanBuffer::WriteFromBuffer ( void * data,
VkDeviceSize size = VK_WHOLE_SIZE,
VkDeviceSize offset = 0 )

Write data from buffer.

Parameters
[in]dataThe data copy to.
[in]sizeThe buffer size.
[in]offsetThe buffer video memory offset.

Maped memory inside.

Maped memory inside.

Definition at line 174 of file VulkanBuffer.cpp.

175 {
177
178#if VMA_ALLOCATOR
179
183 if (size == VK_WHOLE_SIZE)
184 {
185 VK_CHECK(vmaCopyAllocationToMemory(m_VulkanState.m_VmaAllocator, m_Alloc, offset, data, m_DeviceSize))
186 }
187 else
188 {
189 VK_CHECK(vmaCopyAllocationToMemory(m_VulkanState.m_VmaAllocator, m_Alloc, offset, data, size))
190 }
191
192#else
193
194 if (!m_LocalMemory) { Map(); }
195
199 if (size == VK_WHOLE_SIZE)
200 {
201 memcpy(data, m_LocalMemory, m_DeviceSize);
202 }
203 else {
204 char* memOffset = static_cast<char*>(m_LocalMemory);
205 memOffset += offset;
206 memcpy(data, memOffset, size);
207 }
208
209#endif
210
211 }
#define SPICES_PROFILE_ZONE
#define VK_CHECK(expr)
Vulkan Check macro. Verify Vulkan API Effectiveness.
Definition VulkanUtils.h:68
VmaAllocation m_Alloc
VMA allocation.
VkDeviceSize m_DeviceSize
The buffer size.
void Map(VkDeviceSize size=VK_WHOLE_SIZE, VkDeviceSize offset=0)
Map buffer video memory to a local memory.
VulkanState & m_VulkanState
The global VulkanState Referenced from VulkanRenderBackend.
VmaAllocator m_VmaAllocator
Definition VulkanUtils.h:97