Add getRealSize to GEVulkanDynamicBuffer

This commit is contained in:
Benau 2022-07-04 14:51:59 +08:00
parent 0875db0db6
commit defd58a465
2 changed files with 5 additions and 2 deletions

View File

@ -17,7 +17,7 @@ GEVulkanDynamicBuffer::GEVulkanDynamicBuffer(GEVulkanDynamicBufferType t,
{
m_type = t;
m_usage = usage;
m_size = initial_size;
m_size = m_real_size = initial_size;
m_buffer = new VkBuffer[GEVulkanDriver::getMaxFrameInFlight()];
m_memory = new VkDeviceMemory[GEVulkanDriver::getMaxFrameInFlight()];
@ -206,6 +206,7 @@ void GEVulkanDynamicBuffer::setCurrentData(void* data, size_t size)
for (unsigned i = 0; i < GEVulkanDriver::getMaxFrameInFlight(); i++)
initPerFrame(i);
}
m_real_size = size;
if (m_mapped_addr[cur_frame] == NULL)
return;
memcpy(m_mapped_addr[cur_frame], data, size);

View File

@ -31,7 +31,7 @@ private:
static VkMemoryPropertyFlags m_host_flag;
size_t m_size;
size_t m_size, m_real_size;
// ------------------------------------------------------------------------
void initPerFrame(unsigned frame);
@ -49,6 +49,8 @@ public:
void setCurrentData(void* data, size_t size);
// ------------------------------------------------------------------------
VkBuffer getCurrentBuffer() const;
// ------------------------------------------------------------------------
size_t getRealSize() const { return m_real_size; }
}; // GEVulkanDynamicBuffer
}