summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMai M <mathew1800@gmail.com>2022-04-21 10:20:57 +0200
committerGitHub <noreply@github.com>2022-04-21 10:20:57 +0200
commitb0878863050f0bcfc23684cc3a58e8ecdb581854 (patch)
treef85fe3b6853d742ef6c947e2b09f9b2a8569f82e
parentMerge pull request #8232 from liamwhite/backtrace (diff)
parentbootmanager: Don't create another screenshot request if previous one is not done yet (diff)
downloadyuzu-b0878863050f0bcfc23684cc3a58e8ecdb581854.tar
yuzu-b0878863050f0bcfc23684cc3a58e8ecdb581854.tar.gz
yuzu-b0878863050f0bcfc23684cc3a58e8ecdb581854.tar.bz2
yuzu-b0878863050f0bcfc23684cc3a58e8ecdb581854.tar.lz
yuzu-b0878863050f0bcfc23684cc3a58e8ecdb581854.tar.xz
yuzu-b0878863050f0bcfc23684cc3a58e8ecdb581854.tar.zst
yuzu-b0878863050f0bcfc23684cc3a58e8ecdb581854.zip
-rw-r--r--src/video_core/renderer_base.cpp4
-rw-r--r--src/video_core/renderer_base.h3
-rw-r--r--src/yuzu/bootmanager.cpp6
3 files changed, 13 insertions, 0 deletions
diff --git a/src/video_core/renderer_base.cpp b/src/video_core/renderer_base.cpp
index c9627cffd..9756a81d6 100644
--- a/src/video_core/renderer_base.cpp
+++ b/src/video_core/renderer_base.cpp
@@ -26,6 +26,10 @@ void RendererBase::UpdateCurrentFramebufferLayout() {
render_window.UpdateCurrentFramebufferLayout(layout.width, layout.height);
}
+bool RendererBase::IsScreenshotPending() const {
+ return renderer_settings.screenshot_requested;
+}
+
void RendererBase::RequestScreenshot(void* data, std::function<void(bool)> callback,
const Layout::FramebufferLayout& layout) {
if (renderer_settings.screenshot_requested) {
diff --git a/src/video_core/renderer_base.h b/src/video_core/renderer_base.h
index c5f974080..30d19b178 100644
--- a/src/video_core/renderer_base.h
+++ b/src/video_core/renderer_base.h
@@ -83,6 +83,9 @@ public:
/// Refreshes the settings common to all renderers
void RefreshBaseSettings();
+ /// Returns true if a screenshot is being processed
+ bool IsScreenshotPending() const;
+
/// Request a screenshot of the next frame
void RequestScreenshot(void* data, std::function<void(bool)> callback,
const Layout::FramebufferLayout& layout);
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index 27b0300d2..a1b819ae0 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -933,6 +933,12 @@ void GRenderWindow::CaptureScreenshot(const QString& screenshot_path) {
auto& renderer = system.Renderer();
const f32 res_scale = Settings::values.resolution_info.up_factor;
+ if (renderer.IsScreenshotPending()) {
+ LOG_WARNING(Render,
+ "A screenshot is already requested or in progress, ignoring the request");
+ return;
+ }
+
const Layout::FramebufferLayout layout{Layout::FrameLayoutFromResolutionScale(res_scale)};
screenshot_image = QImage(QSize(layout.width, layout.height), QImage::Format_RGB32);
renderer.RequestScreenshot(