diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-26 07:52:33 +0200 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-29 03:46:08 +0200 |
commit | 7ac99bb127fe6c09794b7e7ebe4d1c518817f40a (patch) | |
tree | 7ed5381e6e328611773754fb8a800559c7e0b692 /src | |
parent | renderer_vulkan: Implement screenshots (diff) | |
download | yuzu-7ac99bb127fe6c09794b7e7ebe4d1c518817f40a.tar yuzu-7ac99bb127fe6c09794b7e7ebe4d1c518817f40a.tar.gz yuzu-7ac99bb127fe6c09794b7e7ebe4d1c518817f40a.tar.bz2 yuzu-7ac99bb127fe6c09794b7e7ebe4d1c518817f40a.tar.lz yuzu-7ac99bb127fe6c09794b7e7ebe4d1c518817f40a.tar.xz yuzu-7ac99bb127fe6c09794b7e7ebe4d1c518817f40a.tar.zst yuzu-7ac99bb127fe6c09794b7e7ebe4d1c518817f40a.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/video_core/renderer_base.cpp | 2 | ||||
-rw-r--r-- | src/video_core/renderer_base.h | 4 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 2 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/renderer_vulkan.cpp | 2 | ||||
-rw-r--r-- | src/yuzu/bootmanager.cpp | 4 |
5 files changed, 7 insertions, 7 deletions
diff --git a/src/video_core/renderer_base.cpp b/src/video_core/renderer_base.cpp index 3ea72fda9..a99c33c37 100644 --- a/src/video_core/renderer_base.cpp +++ b/src/video_core/renderer_base.cpp @@ -27,7 +27,7 @@ void RendererBase::UpdateCurrentFramebufferLayout() { render_window.UpdateCurrentFramebufferLayout(layout.width, layout.height); } -void RendererBase::RequestScreenshot(void* data, std::function<void()> callback, +void RendererBase::RequestScreenshot(void* data, std::function<void(bool)> callback, const Layout::FramebufferLayout& layout) { if (renderer_settings.screenshot_requested) { LOG_ERROR(Render, "A screenshot is already requested or in progress, ignoring the request"); diff --git a/src/video_core/renderer_base.h b/src/video_core/renderer_base.h index 22b80c328..bb204454e 100644 --- a/src/video_core/renderer_base.h +++ b/src/video_core/renderer_base.h @@ -24,7 +24,7 @@ struct RendererSettings { // Screenshot std::atomic<bool> screenshot_requested{false}; void* screenshot_bits{}; - std::function<void()> screenshot_complete_callback; + std::function<void(bool)> screenshot_complete_callback; Layout::FramebufferLayout screenshot_framebuffer_layout; }; @@ -80,7 +80,7 @@ public: void RefreshBaseSettings(); /// Request a screenshot of the next frame - void RequestScreenshot(void* data, std::function<void()> callback, + void RequestScreenshot(void* data, std::function<void(bool)> callback, const Layout::FramebufferLayout& layout); protected: diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index f1b00c24c..7d7cba69c 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -486,7 +486,7 @@ void RendererOpenGL::RenderScreenshot() { glBindFramebuffer(GL_READ_FRAMEBUFFER, old_read_fb); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, old_draw_fb); - renderer_settings.screenshot_complete_callback(); + renderer_settings.screenshot_complete_callback(true); renderer_settings.screenshot_requested = false; } diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp index c92718a1f..7c9b0d6db 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp +++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp @@ -339,7 +339,7 @@ void Vulkan::RendererVulkan::RenderScreenshot(const Tegra::FramebufferConfig& fr // Copy backing image data to the QImage screenshot buffer const auto dst_memory_map = dst_buffer_memory.Map(); std::memcpy(renderer_settings.screenshot_bits, dst_memory_map.data(), dst_memory_map.size()); - renderer_settings.screenshot_complete_callback(); + renderer_settings.screenshot_complete_callback(false); renderer_settings.screenshot_requested = false; } diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 25b658b2a..2e0ade815 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -632,9 +632,9 @@ void GRenderWindow::CaptureScreenshot(u32 res_scale, const QString& screenshot_p screenshot_image = QImage(QSize(layout.width, layout.height), QImage::Format_RGB32); renderer.RequestScreenshot( screenshot_image.bits(), - [=, this] { + [=, this](bool invert_y) { const std::string std_screenshot_path = screenshot_path.toStdString(); - if (screenshot_image.mirrored(false, true).save(screenshot_path)) { + if (screenshot_image.mirrored(false, invert_y).save(screenshot_path)) { LOG_INFO(Frontend, "Screenshot saved to \"{}\"", std_screenshot_path); } else { LOG_ERROR(Frontend, "Failed to save screenshot to \"{}\"", std_screenshot_path); |