Added KRDevice::graphicsUpload
This commit is contained in:
@@ -739,6 +739,21 @@ void KRDevice::streamUpload(void* data, size_t size, VkBuffer destination)
|
||||
m_streamingStagingBuffer.usage += size;
|
||||
}
|
||||
|
||||
void KRDevice::graphicsUpload(void* data, size_t size, VkBuffer destination)
|
||||
{
|
||||
memcpy((uint8_t*)m_graphicsStagingBuffer.data + m_graphicsStagingBuffer.usage, data, size);
|
||||
|
||||
// TODO - Beneficial to batch many regions in a single call?
|
||||
VkBufferCopy copyRegion{};
|
||||
copyRegion.srcOffset = m_graphicsStagingBuffer.usage;
|
||||
copyRegion.dstOffset = 0; // Optional
|
||||
copyRegion.size = size;
|
||||
vkCmdCopyBuffer(m_graphicsCommandBuffers[0], m_graphicsStagingBuffer.buffer, destination, 1, ©Region);
|
||||
|
||||
// TODO - Assert on any needed alignment?
|
||||
m_graphicsStagingBuffer.usage += size;
|
||||
}
|
||||
|
||||
void KRDevice::streamUpload(void* data, size_t size, Vector2i dimensions, VkImage destination)
|
||||
{
|
||||
checkFlushStreamBuffer(size);
|
||||
|
||||
@@ -80,6 +80,8 @@ public:
|
||||
void streamUpload(void* data, size_t size, Vector2i dimensions, VkImage destination);
|
||||
void streamEnd();
|
||||
|
||||
void graphicsUpload(void* data, size_t size, VkBuffer destination);
|
||||
|
||||
VkPhysicalDevice m_device;
|
||||
VkDevice m_logicalDevice;
|
||||
VkPhysicalDeviceProperties m_deviceProperties;
|
||||
|
||||
Reference in New Issue
Block a user