summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan/TextureCache.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@users.noreply.github.com>2017-04-18 21:58:14 +1000
committerGitHub <noreply@github.com>2017-04-18 21:58:14 +1000
commit16a947a88b6fee5ce96373550140bcb4b3911565 (patch)
tree9cb794bc0aab5c2812f9a48ad2a048457c320276 /Source/Core/VideoBackends/Vulkan/TextureCache.cpp
parent936910163aaddf63dc439b8206cb09951a158353 (diff)
parent3fd1e6c2f69f83d8c818c5a253a161502868a355 (diff)
Merge pull request #5270 from stenzek/vulkan-aa
Vulkan: MSAA and frame dumping fixes
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/TextureCache.cpp')
-rw-r--r--Source/Core/VideoBackends/Vulkan/TextureCache.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/TextureCache.cpp b/Source/Core/VideoBackends/Vulkan/TextureCache.cpp
index 23cc06abff..08c370b48f 100644
--- a/Source/Core/VideoBackends/Vulkan/TextureCache.cpp
+++ b/Source/Core/VideoBackends/Vulkan/TextureCache.cpp
@@ -96,11 +96,14 @@ void TextureCache::CopyEFB(u8* dst, const EFBCopyFormat& format, u32 native_widt
FramebufferManager::GetInstance()->FlushEFBPokes();
// MSAA case where we need to resolve first.
- // TODO: Do in one pass.
+ // An out-of-bounds source region is valid here, and fine for the draw (since it is converted
+ // to texture coordinates), but it's not valid to resolve an out-of-range rectangle.
TargetRectangle scaled_src_rect = g_renderer->ConvertEFBRectangle(src_rect);
VkRect2D region = {{scaled_src_rect.left, scaled_src_rect.top},
{static_cast<u32>(scaled_src_rect.GetWidth()),
static_cast<u32>(scaled_src_rect.GetHeight())}};
+ region = Util::ClampRect2D(region, FramebufferManager::GetInstance()->GetEFBWidth(),
+ FramebufferManager::GetInstance()->GetEFBHeight());
Texture2D* src_texture;
if (is_depth_copy)
src_texture = FramebufferManager::GetInstance()->ResolveEFBDepthTexture(region);
@@ -465,10 +468,14 @@ void TextureCache::TCacheEntry::FromRenderTarget(bool is_depth_copy, const EFBRe
VkCommandBuffer command_buffer = g_command_buffer_mgr->GetCurrentCommandBuffer();
StateTracker::GetInstance()->EndRenderPass();
- // Transition EFB to shader resource before binding
+ // Transition EFB to shader resource before binding.
+ // An out-of-bounds source region is valid here, and fine for the draw (since it is converted
+ // to texture coordinates), but it's not valid to resolve an out-of-range rectangle.
VkRect2D region = {{scaled_src_rect.left, scaled_src_rect.top},
{static_cast<u32>(scaled_src_rect.GetWidth()),
static_cast<u32>(scaled_src_rect.GetHeight())}};
+ region = Util::ClampRect2D(region, FramebufferManager::GetInstance()->GetEFBWidth(),
+ FramebufferManager::GetInstance()->GetEFBHeight());
Texture2D* src_texture;
if (is_depth_copy)
src_texture = FramebufferManager::GetInstance()->ResolveEFBDepthTexture(region);