mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-01-08 08:00:44 +01:00
handle occlusion queries with no draws
This commit is contained in:
parent
fd16488e4c
commit
934b1f8b55
@ -4,12 +4,16 @@
|
|||||||
|
|
||||||
bool LatteQueryObjectMtl::getResult(uint64& numSamplesPassed)
|
bool LatteQueryObjectMtl::getResult(uint64& numSamplesPassed)
|
||||||
{
|
{
|
||||||
|
if (!m_commandBuffer)
|
||||||
|
{
|
||||||
|
numSamplesPassed = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!CommandBufferCompleted(m_commandBuffer))
|
if (!CommandBufferCompleted(m_commandBuffer))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
numSamplesPassed = m_mtlr->GetOcclusionQueryResultsPtr()[m_queryIndex];
|
numSamplesPassed = m_mtlr->GetOcclusionQueryResultsPtr()[m_queryIndex];
|
||||||
printf("Num samples: %llu\n", numSamplesPassed);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +32,10 @@ void LatteQueryObjectMtl::begin()
|
|||||||
void LatteQueryObjectMtl::end()
|
void LatteQueryObjectMtl::end()
|
||||||
{
|
{
|
||||||
m_mtlr->SetActiveOcclusionQueryIndex(INVALID_UINT32);
|
m_mtlr->SetActiveOcclusionQueryIndex(INVALID_UINT32);
|
||||||
m_commandBuffer = m_mtlr->GetCurrentCommandBuffer();
|
if (m_mtlr->IsCommandBufferActive())
|
||||||
// TODO: request soon submit instead?
|
{
|
||||||
m_mtlr->CommitCommandBuffer();
|
m_commandBuffer = m_mtlr->GetCurrentCommandBuffer();
|
||||||
|
// TODO: request soon submit instead?
|
||||||
|
m_mtlr->CommitCommandBuffer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,5 +19,5 @@ private:
|
|||||||
|
|
||||||
uint32 m_queryIndex = INVALID_UINT32;
|
uint32 m_queryIndex = INVALID_UINT32;
|
||||||
// TODO: make this a list of command buffers
|
// TODO: make this a list of command buffers
|
||||||
MTL::CommandBuffer* m_commandBuffer;
|
MTL::CommandBuffer* m_commandBuffer = nullptr;
|
||||||
};
|
};
|
||||||
|
@ -279,6 +279,11 @@ public:
|
|||||||
// Helpers
|
// Helpers
|
||||||
MetalPerformanceMonitor& GetPerformanceMonitor() { return m_performanceMonitor; }
|
MetalPerformanceMonitor& GetPerformanceMonitor() { return m_performanceMonitor; }
|
||||||
|
|
||||||
|
bool IsCommandBufferActive() const
|
||||||
|
{
|
||||||
|
return (m_commandBuffers.size() != 0);
|
||||||
|
}
|
||||||
|
|
||||||
MTL::CommandBuffer* GetCurrentCommandBuffer()
|
MTL::CommandBuffer* GetCurrentCommandBuffer()
|
||||||
{
|
{
|
||||||
cemu_assert_debug(m_commandBuffers.size() != 0);
|
cemu_assert_debug(m_commandBuffers.size() != 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user