Allow taking screenshots in the app menu

This commit is contained in:
Henrik Rydgård committed 2024-05-10 21:10:11 +02:00
1 parent e0e96200b9
commit d21fef52ae
8 files changed
+34 -19

No files matched your search

+12 -5
View File
@@ -3076,15 +3076,22 @@ bool FramebufferManagerCommon::GetStencilbuffer(u32 fb_address, int fb_stride, G
return retval;
}
bool FramebufferManagerCommon::GetOutputFramebuffer(GPUDebugBuffer &buffer) {
bool GetOutputFramebuffer(Draw::DrawContext *draw, GPUDebugBuffer &buffer) {
int w, h;
draw_->GetFramebufferDimensions(nullptr, &w, &h);
Draw::DataFormat fmt = draw_->PreferredFramebufferReadbackFormat(nullptr);
draw->GetFramebufferDimensions(nullptr, &w, &h);
Draw::DataFormat fmt = draw->PreferredFramebufferReadbackFormat(nullptr);
// Ignore preferred formats other than BGRA.
if (fmt != Draw::DataFormat::B8G8R8A8_UNORM)
fmt = Draw::DataFormat::R8G8B8A8_UNORM;
buffer.Allocate(w, h, fmt == Draw::DataFormat::R8G8B8A8_UNORM ? GPU_DBG_FORMAT_8888 : GPU_DBG_FORMAT_8888_BGRA, false);
bool retval = draw_->CopyFramebufferToMemory(nullptr, Draw::FB_COLOR_BIT, 0, 0, w, h, fmt, buffer.GetData(), w, Draw::ReadbackMode::BLOCK, "GetOutputFramebuffer");
bool flipped = g_Config.iGPUBackend == (int)GPUBackend::OPENGL;
buffer.Allocate(w, h, fmt == Draw::DataFormat::R8G8B8A8_UNORM ? GPU_DBG_FORMAT_8888 : GPU_DBG_FORMAT_8888_BGRA, flipped);
return draw->CopyFramebufferToMemory(nullptr, Draw::FB_COLOR_BIT, 0, 0, w, h, fmt, buffer.GetData(), w, Draw::ReadbackMode::BLOCK, "GetOutputFramebuffer");
}
bool FramebufferManagerCommon::GetOutputFramebuffer(GPUDebugBuffer &buffer) {
bool retval = ::GetOutputFramebuffer(draw_, buffer);
// That may have unbound the framebuffer, rebind to avoid crashes when debugging.
RebindFramebuffer("RebindFramebuffer - GetOutputFramebuffer");
return retval;