Limit texture upload transfer buffers to roughly 64 MB

This commit is contained in:
Magnus Norddahl 2021-09-13 21:58:44 +02:00 committed by Christoph Oelckers
commit 796890bb98
3 changed files with 38 additions and 19 deletions

View file

@ -209,15 +209,21 @@ void VulkanFrameBuffer::Update()
Super::Update();
}
void VulkanFrameBuffer::DeleteFrameObjects()
void VulkanFrameBuffer::DeleteFrameObjects(bool uploadOnly)
{
FrameDeleteList.Images.clear();
FrameDeleteList.ImageViews.clear();
FrameDeleteList.Framebuffers.clear();
FrameDeleteList.Buffers.clear();
FrameDeleteList.Descriptors.clear();
FrameDeleteList.DescriptorPools.clear();
FrameDeleteList.CommandBuffers.clear();
FrameTextureUpload.Buffers.clear();
FrameTextureUpload.TotalSize = 0;
if (!uploadOnly)
{
FrameDeleteList.Images.clear();
FrameDeleteList.ImageViews.clear();
FrameDeleteList.Framebuffers.clear();
FrameDeleteList.Buffers.clear();
FrameDeleteList.Descriptors.clear();
FrameDeleteList.DescriptorPools.clear();
FrameDeleteList.CommandBuffers.clear();
}
}
void VulkanFrameBuffer::FlushCommands(VulkanCommandBuffer **commands, size_t count, bool finish, bool lastsubmit)
@ -251,11 +257,12 @@ void VulkanFrameBuffer::FlushCommands(VulkanCommandBuffer **commands, size_t cou
mNextSubmit++;
}
void VulkanFrameBuffer::FlushCommands(bool finish, bool lastsubmit)
void VulkanFrameBuffer::FlushCommands(bool finish, bool lastsubmit, bool uploadOnly)
{
mRenderState->EndRenderPass();
if (!uploadOnly)
mRenderState->EndRenderPass();
if (mDrawCommands || mTransferCommands)
if ((!uploadOnly && mDrawCommands) || mTransferCommands)
{
VulkanCommandBuffer *commands[2];
size_t count = 0;
@ -267,7 +274,7 @@ void VulkanFrameBuffer::FlushCommands(bool finish, bool lastsubmit)
FrameDeleteList.CommandBuffers.push_back(std::move(mTransferCommands));
}
if (mDrawCommands)
if (!uploadOnly && mDrawCommands)
{
mDrawCommands->end();
commands[count++] = mDrawCommands.get();
@ -280,7 +287,7 @@ void VulkanFrameBuffer::FlushCommands(bool finish, bool lastsubmit)
}
}
void VulkanFrameBuffer::WaitForCommands(bool finish)
void VulkanFrameBuffer::WaitForCommands(bool finish, bool uploadOnly)
{
if (finish)
{
@ -292,7 +299,7 @@ void VulkanFrameBuffer::WaitForCommands(bool finish)
mPostprocess->DrawPresentTexture(mOutputLetterbox, true, false);
}
FlushCommands(finish, true);
FlushCommands(finish, true, uploadOnly);
if (finish)
{
@ -310,7 +317,7 @@ void VulkanFrameBuffer::WaitForCommands(bool finish)
vkResetFences(device->device, numWaitFences, mSubmitWaitFences);
}
DeleteFrameObjects();
DeleteFrameObjects(uploadOnly);
mNextSubmit = 0;
if (finish)