implement occlusion query flush

This commit is contained in:
Samuliak 2024-11-05 17:42:02 +01:00
parent ea0a30b564
commit 552c4901b9
No known key found for this signature in database
2 changed files with 11 additions and 2 deletions

View File

@ -1232,7 +1232,7 @@ void MetalRenderer::draw_updateVertexBuffersDirectAccess()
MPTR bufferAddress = LatteGPUState.contextRegister[bufferBaseRegisterIndex + 0];
if (bufferAddress == MPTR_NULL) [[unlikely]]
bufferAddress = 0x10000000; // TODO: really?
bufferAddress = m_memoryManager->GetImportedMemBaseAddress();
m_state.m_vertexBufferOffsets[bufferIndex] = bufferAddress - m_memoryManager->GetImportedMemBaseAddress();
}
@ -1317,7 +1317,9 @@ void MetalRenderer::occlusionQuery_destroy(LatteQueryObject* queryObj) {
}
void MetalRenderer::occlusionQuery_flush() {
// TODO: implement
// TODO: wait for all command buffers with occlusion queries?
if (m_occlusionQuery.m_lastCommandBuffer)
m_occlusionQuery.m_lastCommandBuffer->waitUntilCompleted();
}
void MetalRenderer::occlusionQuery_updateState() {

View File

@ -429,6 +429,12 @@ public:
void EndOcclusionQuery()
{
m_occlusionQuery.m_active = false;
if (m_occlusionQuery.m_lastCommandBuffer)
m_occlusionQuery.m_lastCommandBuffer->release();
if (IsCommandBufferActive())
m_occlusionQuery.m_lastCommandBuffer = GetCurrentCommandBuffer()->retain();
else
m_occlusionQuery.m_lastCommandBuffer = nullptr;
}
private:
@ -480,6 +486,7 @@ private:
uint64* m_resultsPtr;
uint32 m_currentIndex = 0;
bool m_active = false;
MTL::CommandBuffer* m_lastCommandBuffer = nullptr;
} m_occlusionQuery;
// Active objects