rework the command buffer system

This commit is contained in:
Samuliak 2024-11-16 15:28:23 +01:00
parent 2890819118
commit 8a8037377f
No known key found for this signature in database
5 changed files with 66 additions and 54 deletions

View file

@ -3,13 +3,7 @@
bool LatteQueryObjectMtl::getResult(uint64& numSamplesPassed)
{
if (!m_commandBuffer)
{
numSamplesPassed = 0;
return true;
}
if (!CommandBufferCompleted(m_commandBuffer))
if (m_commandBuffer && !CommandBufferCompleted(m_commandBuffer))
return false;
uint64* resultPtr = m_mtlr->GetOcclusionQueryResultsPtr();
@ -38,7 +32,7 @@ void LatteQueryObjectMtl::end()
m_range.end = m_mtlr->GetOcclusionQueryIndex();
m_mtlr->EndOcclusionQuery();
m_commandBuffer = m_mtlr->GetCurrentCommandBuffer()->retain();
if (m_mtlr->IsCommandBufferActive())
m_commandBuffer = m_mtlr->GetAndRetainCurrentCommandBufferIfNotCompleted();
if (m_commandBuffer)
m_mtlr->RequestSoonCommit();
}