diff options
author | Kelebek1 <eeeedddccc@hotmail.co.uk> | 2023-08-19 02:11:45 +0200 |
---|---|---|
committer | Kelebek1 <eeeedddccc@hotmail.co.uk> | 2023-08-19 04:29:46 +0200 |
commit | f2f99a8c315ef9abfea63c14faf844296794b498 (patch) | |
tree | 5390c22be68674fd964b49a745c495f13cf71e0d /src/video_core/renderer_vulkan/vk_rasterizer.cpp | |
parent | Merge pull request #11278 from Kelebek1/dma_sync (diff) | |
download | yuzu-f2f99a8c315ef9abfea63c14faf844296794b498.tar yuzu-f2f99a8c315ef9abfea63c14faf844296794b498.tar.gz yuzu-f2f99a8c315ef9abfea63c14faf844296794b498.tar.bz2 yuzu-f2f99a8c315ef9abfea63c14faf844296794b498.tar.lz yuzu-f2f99a8c315ef9abfea63c14faf844296794b498.tar.xz yuzu-f2f99a8c315ef9abfea63c14faf844296794b498.tar.zst yuzu-f2f99a8c315ef9abfea63c14faf844296794b498.zip |
Diffstat (limited to 'src/video_core/renderer_vulkan/vk_rasterizer.cpp')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.cpp | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 89aa243d2..032f694bc 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -428,15 +428,27 @@ void RasterizerVulkan::Clear(u32 layer_count) { if (aspect_flags == 0) { return; } - scheduler.Record([clear_depth = regs.clear_depth, clear_stencil = regs.clear_stencil, - clear_rect, aspect_flags](vk::CommandBuffer cmdbuf) { - VkClearAttachment attachment; - attachment.aspectMask = aspect_flags; - attachment.colorAttachment = 0; - attachment.clearValue.depthStencil.depth = clear_depth; - attachment.clearValue.depthStencil.stencil = clear_stencil; - cmdbuf.ClearAttachments(attachment, clear_rect); - }); + + if (use_stencil && regs.stencil_front_mask != 0xFF && regs.stencil_front_mask != 0) { + Region2D dst_region = { + Offset2D{.x = clear_rect.rect.offset.x, .y = clear_rect.rect.offset.y}, + Offset2D{.x = clear_rect.rect.offset.x + static_cast<s32>(clear_rect.rect.extent.width), + .y = clear_rect.rect.offset.y + + static_cast<s32>(clear_rect.rect.extent.height)}}; + blit_image.ClearDepthStencil(framebuffer, use_depth, regs.clear_depth, + static_cast<u8>(regs.stencil_front_mask), regs.clear_stencil, + regs.stencil_front_func_mask, dst_region); + } else { + scheduler.Record([clear_depth = regs.clear_depth, clear_stencil = regs.clear_stencil, + clear_rect, aspect_flags](vk::CommandBuffer cmdbuf) { + VkClearAttachment attachment; + attachment.aspectMask = aspect_flags; + attachment.colorAttachment = 0; + attachment.clearValue.depthStencil.depth = clear_depth; + attachment.clearValue.depthStencil.stencil = clear_stencil; + cmdbuf.ClearAttachments(attachment, clear_rect); + }); + } } void RasterizerVulkan::DispatchCompute() { |