Fix command buffer memory leak
parent
e6402cbb14
commit
94c2d15895
|
@ -2483,8 +2483,6 @@ static void D3D11_Submit(
|
||||||
renderer->submittedCommandBuffers[renderer->submittedCommandBufferCount] = d3d11CommandBuffer;
|
renderer->submittedCommandBuffers[renderer->submittedCommandBufferCount] = d3d11CommandBuffer;
|
||||||
renderer->submittedCommandBufferCount += 1;
|
renderer->submittedCommandBufferCount += 1;
|
||||||
|
|
||||||
SDL_UnlockMutex(renderer->contextLock);
|
|
||||||
|
|
||||||
/* Present, if applicable */
|
/* Present, if applicable */
|
||||||
if (d3d11CommandBuffer->swapchainData)
|
if (d3d11CommandBuffer->swapchainData)
|
||||||
{
|
{
|
||||||
|
@ -2495,6 +2493,27 @@ static void D3D11_Submit(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if we can perform any cleanups */
|
||||||
|
for (int32_t i = renderer->submittedCommandBufferCount - 1; i >= 0; i -= 1)
|
||||||
|
{
|
||||||
|
BOOL queryData;
|
||||||
|
|
||||||
|
res = ID3D11DeviceContext_GetData(
|
||||||
|
renderer->immediateContext,
|
||||||
|
(ID3D11Asynchronous*) renderer->submittedCommandBuffers[i]->completionQuery,
|
||||||
|
&queryData,
|
||||||
|
sizeof(queryData),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
if (res == S_OK)
|
||||||
|
{
|
||||||
|
D3D11_INTERNAL_CleanCommandBuffer(
|
||||||
|
renderer,
|
||||||
|
renderer->submittedCommandBuffers[i]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SDL_UnlockMutex(renderer->contextLock);
|
SDL_UnlockMutex(renderer->contextLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue