mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-07 23:41:18 +12:00
add an option to capture GPU frame
This commit is contained in:
parent
40dab1e212
commit
1d8806cf06
3 changed files with 71 additions and 0 deletions
|
@ -303,6 +303,17 @@ void MetalRenderer::SwapBuffers(bool swapTV, bool swapDRC)
|
|||
|
||||
// Debug
|
||||
m_performanceMonitor.ResetPerFrameData();
|
||||
|
||||
// GPU capture
|
||||
if (m_capturing)
|
||||
{
|
||||
EndCapture();
|
||||
}
|
||||
else if (m_captureFrame)
|
||||
{
|
||||
StartCapture();
|
||||
m_captureFrame = false;
|
||||
}
|
||||
}
|
||||
|
||||
void MetalRenderer::HandleScreenshotRequest(LatteTextureView* texView, bool padView) {
|
||||
|
@ -2161,3 +2172,27 @@ void MetalRenderer::EnsureImGuiBackend()
|
|||
//ImGui_ImplMetal_CreateFontsTexture(m_device);
|
||||
}
|
||||
}
|
||||
|
||||
void MetalRenderer::StartCapture()
|
||||
{
|
||||
auto captureManager = MTL::CaptureManager::sharedCaptureManager();
|
||||
auto desc = MTL::CaptureDescriptor::alloc()->init();
|
||||
desc->setCaptureObject(m_device);
|
||||
|
||||
NS::Error* error = nullptr;
|
||||
captureManager->startCapture(desc, &error);
|
||||
if (error)
|
||||
{
|
||||
cemuLog_log(LogType::Force, "Failed to start GPU capture: {}", error->localizedDescription()->utf8String());
|
||||
}
|
||||
|
||||
m_capturing = true;
|
||||
}
|
||||
|
||||
void MetalRenderer::EndCapture()
|
||||
{
|
||||
auto captureManager = MTL::CaptureManager::sharedCaptureManager();
|
||||
captureManager->stopCapture();
|
||||
|
||||
m_capturing = false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue