Add internal code for temporary buffers.

This commit is contained in:
Alex Szpakowski
2022-05-30 21:46:55 -03:00
parent a533982cb4
commit fb450b1df4
4 changed files with 134 additions and 36 deletions
+2 -16
View File
@@ -501,10 +501,7 @@ void Graphics::unSetMode()
submitCommandBuffer(SUBMIT_DONE);
for (auto temp : temporaryTextures)
temp.texture->release();
temporaryTextures.clear();
clearTemporaryResources();
created = false;
metalLayer = nil;
@@ -1620,18 +1617,7 @@ void Graphics::present(void *screenshotCallbackData)
renderTargetSwitchCount = 0;
drawCallsBatched = 0;
// This assumes temporary canvases will only be used within a render pass.
for (int i = (int) temporaryTextures.size() - 1; i >= 0; i--)
{
if (temporaryTextures[i].framesSinceUse >= MAX_TEMPORARY_TEXTURE_UNUSED_FRAMES)
{
temporaryTextures[i].texture->release();
temporaryTextures[i] = temporaryTextures.back();
temporaryTextures.pop_back();
}
else
temporaryTextures[i].framesSinceUse++;
}
updateTemporaryResources();
}}
int Graphics::getRequestedBackbufferMSAA() const