summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends
diff options
context:
space:
mode:
authorAnthony <Helios747@users.noreply.github.com>2017-09-07 00:34:03 -0700
committerGitHub <noreply@github.com>2017-09-07 00:34:03 -0700
commite52d8ef638919348ae8fc71bfb8f5d1de5e4737b (patch)
treec716692ce96e73f065050abd726ab2f9569bf6a5 /Source/Core/VideoBackends
parent5d6dac54104295f2c594c91006d2ee2de486c528 (diff)
parent134daf3b00d1bf46a3ad4b57405f8844b809bb4f (diff)
Merge pull request #6011 from stenzek/nvidia-vk-clears
Vulkan: Extend the NVIDIA MSAA bug to render-pass based clears
Diffstat (limited to 'Source/Core/VideoBackends')
-rw-r--r--Source/Core/VideoBackends/Vulkan/Renderer.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.cpp b/Source/Core/VideoBackends/Vulkan/Renderer.cpp
index bb8b36481a..7a94572b1e 100644
--- a/Source/Core/VideoBackends/Vulkan/Renderer.cpp
+++ b/Source/Core/VideoBackends/Vulkan/Renderer.cpp
@@ -375,18 +375,23 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool color_enable, bool alpha
// If we're not in a render pass (start of the frame), we can use a clear render pass
// to discard the data, rather than loading and then clearing.
- bool use_clear_render_pass = (color_enable && alpha_enable && z_enable);
- if (DriverDetails::HasBug(DriverDetails::BUG_BROKEN_CLEAR_LOADOP_RENDERPASS))
+ bool use_clear_attachments = (color_enable && alpha_enable) || z_enable;
+ bool use_clear_render_pass =
+ !StateTracker::GetInstance()->InRenderPass() && color_enable && alpha_enable && z_enable;
+
+ // The NVIDIA Vulkan driver causes the GPU to lock up, or throw exceptions if MSAA is enabled,
+ // a non-full clear rect is specified, and a clear loadop or vkCmdClearAttachments is used.
+ if (g_ActiveConfig.iMultisamples > 1 &&
+ DriverDetails::HasBug(DriverDetails::BUG_BROKEN_MSAA_CLEAR))
{
- // This path cannot be used if the driver implementation doesn't guarantee pixels with no drawn
- // geomerty in "this" renderpass won't be cleared
use_clear_render_pass = false;
+ use_clear_attachments = false;
}
- if (StateTracker::GetInstance()->InRenderPass())
- {
- // Prefer not to end a render pass just to do a clear.
+
+ // This path cannot be used if the driver implementation doesn't guarantee pixels with no drawn
+ // geometry in "this" renderpass won't be cleared
+ if (DriverDetails::HasBug(DriverDetails::BUG_BROKEN_CLEAR_LOADOP_RENDERPASS))
use_clear_render_pass = false;
- }
// Fastest path: Use a render pass to clear the buffers.
if (use_clear_render_pass)
@@ -398,8 +403,7 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool color_enable, bool alpha
// Fast path: Use vkCmdClearAttachments to clear the buffers within a render path
// We can't use this when preserving alpha but clearing color.
- if (g_ActiveConfig.iMultisamples == 1 ||
- !DriverDetails::HasBug(DriverDetails::BUG_BROKEN_MSAA_VKCMDCLEARATTACHMENTS))
+ if (use_clear_attachments)
{
VkClearAttachment clear_attachments[2];
uint32_t num_clear_attachments = 0;