Temporary vertex data is now uploaded synchronously in the presentation thread with the graphics command buffer.
This commit is contained in:
@@ -711,6 +711,13 @@ void KRDevice::streamUpload(KRDataBlock& data, VkBuffer destination)
|
||||
data.unlock();
|
||||
}
|
||||
|
||||
void KRDevice::graphicsUpload(KRDataBlock& data, VkBuffer destination)
|
||||
{
|
||||
data.lock();
|
||||
graphicsUpload(data.getStart(), data.getSize(), destination);
|
||||
data.unlock();
|
||||
}
|
||||
|
||||
void KRDevice::checkFlushStreamBuffer(size_t size)
|
||||
{
|
||||
// Flush the buffers if we would run out of space
|
||||
|
||||
@@ -80,6 +80,7 @@ public:
|
||||
void streamUpload(void* data, size_t size, Vector2i dimensions, VkImage destination);
|
||||
void streamEnd();
|
||||
|
||||
void graphicsUpload(KRDataBlock& data, VkBuffer destination);
|
||||
void graphicsUpload(void* data, size_t size, VkBuffer destination);
|
||||
|
||||
VkPhysicalDevice m_device;
|
||||
|
||||
@@ -577,7 +577,12 @@ void KRMeshManager::KRVBOData::load()
|
||||
, debug_label
|
||||
#endif // KRENGINE_DEBUG_GPU_LABELS
|
||||
);
|
||||
device.streamUpload(*m_data, allocation.vertex_buffer);
|
||||
if (m_type == vbo_type::TEMPORARY) {
|
||||
device.graphicsUpload(*m_data, allocation.vertex_buffer);
|
||||
} else {
|
||||
device.streamUpload(*m_data, allocation.vertex_buffer);
|
||||
}
|
||||
|
||||
|
||||
if (m_index_data->getSize() > 0) {
|
||||
#if KRENGINE_DEBUG_GPU_LABELS
|
||||
@@ -593,7 +598,11 @@ void KRMeshManager::KRVBOData::load()
|
||||
, debug_label
|
||||
#endif
|
||||
);
|
||||
device.streamUpload(*m_index_data, allocation.index_buffer);
|
||||
if (m_type == vbo_type::TEMPORARY) {
|
||||
device.graphicsUpload(*m_index_data, allocation.index_buffer);
|
||||
} else {
|
||||
device.streamUpload(*m_index_data, allocation.index_buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user