fixed delayed RHI buffer deletions

This commit is contained in:
myT 2024-04-15 04:43:10 +02:00
parent 5c4cf3d720
commit c937948f8f

View file

@ -3738,6 +3738,8 @@ namespace RHI
backEnd.renderFrame = qtrue;
}
rhi.buffersToDelete.Clear();
if(!destroyWindow)
{
WaitUntilDeviceIsIdle();
@ -3918,7 +3920,7 @@ namespace RHI
for(uint32_t b = 0; b < rhi.buffersToDelete.count; )
{
if(rhi.buffersToDelete[b].beginFrameCounter >= rhi.beginFrameCounter)
if(rhi.beginFrameCounter >= rhi.buffersToDelete[b].beginFrameCounter)
{
DestroyBuffer(rhi.buffersToDelete[b].buffer);
rhi.buffersToDelete.Remove(b);
@ -4120,7 +4122,7 @@ namespace RHI
}
BufferToDelete b = {};
b.beginFrameCounter = rhi.beginFrameCounter + 2;
b.beginFrameCounter = rhi.beginFrameCounter + FrameCount + 1;
b.buffer = buffer;
rhi.buffersToDelete.Add(b);
}