Skip to content

Commit

Permalink
Merge pull request #19608 from hrydgard/screenshot-fix
Browse files Browse the repository at this point in the history
Fix for error taking screenshots in Vulkan on many devices
  • Loading branch information
hrydgard authored Nov 7, 2024
2 parents 6fcb75c + f5a4669 commit ff6a10a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
13 changes: 4 additions & 9 deletions Common/GPU/Vulkan/VulkanContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1491,16 +1491,11 @@ bool VulkanContext::InitSwapchain() {

presentMode_ = swapchainPresentMode;

// Don't ask for TRANSFER_DST for the swapchain image, we don't use that.
// if (surfCapabilities_.supportedUsageFlags & VK_IMAGE_USAGE_TRANSFER_DST_BIT)
// swap_chain_info.imageUsage |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;

#ifndef ANDROID
// We don't support screenshots on Android
// Add more usage flags if they're supported.
if (surfCapabilities_.supportedUsageFlags & VK_IMAGE_USAGE_TRANSFER_SRC_BIT)
// We don't support screenshots on Android if TRANSFER_SRC usage flag is not supported.
if (surfCapabilities_.supportedUsageFlags & VK_IMAGE_USAGE_TRANSFER_SRC_BIT) {
INFO_LOG(Log::G3D, "Swapchain supports TRANSFER_SRC");
swap_chain_info.imageUsage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
#endif
}

swap_chain_info.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
swap_chain_info.queueFamilyIndexCount = 0;
Expand Down
2 changes: 1 addition & 1 deletion Core/Screenshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ bool TakeGameScreenshot(Draw::DrawContext *draw, const Path &filename, Screensho
} else if (g_display.rotation != DisplayRotation::ROTATE_0) {
_dbg_assert_(draw);
GPUDebugBuffer temp;
success = ::GetOutputFramebuffer(draw, buf);
success = ::GetOutputFramebuffer(draw, temp);
if (success) {
buf = ApplyRotation(temp, g_display.rotation);
}
Expand Down

0 comments on commit ff6a10a

Please sign in to comment.