From 0860e208b2b18e85d0ecf3f8e42e00feaaa15093 Mon Sep 17 00:00:00 2001 From: gdk Date: Tue, 14 Jun 2022 16:19:59 -0300 Subject: [PATCH] Add missing clear layer parameter after rebase --- Ryujinx.Graphics.Vulkan/FramebufferParams.cs | 4 ++-- Ryujinx.Graphics.Vulkan/HelperShader.cs | 2 +- Ryujinx.Graphics.Vulkan/PipelineBase.cs | 8 ++++---- Ryujinx.Graphics.Vulkan/PipelineFull.cs | 5 +++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Ryujinx.Graphics.Vulkan/FramebufferParams.cs b/Ryujinx.Graphics.Vulkan/FramebufferParams.cs index 06c0aec71..3844abcd5 100644 --- a/Ryujinx.Graphics.Vulkan/FramebufferParams.cs +++ b/Ryujinx.Graphics.Vulkan/FramebufferParams.cs @@ -149,14 +149,14 @@ namespace Ryujinx.Graphics.Vulkan return texture is TextureView view && view.Valid; } - public ClearRect GetClearRect(Rectangle scissor) + public ClearRect GetClearRect(Rectangle scissor, int layer) { int x = scissor.X; int y = scissor.Y; int width = Math.Min((int)Width - scissor.X, scissor.Width); int height = Math.Min((int)Height - scissor.Y, scissor.Height); - return new ClearRect(new Rect2D(new Offset2D(x, y), new Extent2D((uint)width, (uint)height)), 0, Layers); + return new ClearRect(new Rect2D(new Offset2D(x, y), new Extent2D((uint)width, (uint)height)), (uint)layer, 1); } public unsafe Auto Create(Vk api, CommandBufferScoped cbs, Auto renderPass) diff --git a/Ryujinx.Graphics.Vulkan/HelperShader.cs b/Ryujinx.Graphics.Vulkan/HelperShader.cs index 50107f911..cb5e0037b 100644 --- a/Ryujinx.Graphics.Vulkan/HelperShader.cs +++ b/Ryujinx.Graphics.Vulkan/HelperShader.cs @@ -178,7 +178,7 @@ namespace Ryujinx.Graphics.Vulkan if (clearAlpha) { - _pipeline.ClearRenderTargetColor(0, new ColorF(0f, 0f, 0f, 1f)); + _pipeline.ClearRenderTargetColor(0, 0, new ColorF(0f, 0f, 0f, 1f)); } _pipeline.SetViewports(0, viewports, false); diff --git a/Ryujinx.Graphics.Vulkan/PipelineBase.cs b/Ryujinx.Graphics.Vulkan/PipelineBase.cs index 62f84b5c3..c20a85fb6 100644 --- a/Ryujinx.Graphics.Vulkan/PipelineBase.cs +++ b/Ryujinx.Graphics.Vulkan/PipelineBase.cs @@ -159,7 +159,7 @@ namespace Ryujinx.Graphics.Vulkan size); } - public unsafe void ClearRenderTargetColor(int index, ColorF color) + public unsafe void ClearRenderTargetColor(int index, int layer, ColorF color) { if (FramebufferParams == null || !FramebufferParams.IsVaidColorAttachment(index)) { @@ -175,12 +175,12 @@ namespace Ryujinx.Graphics.Vulkan var clearValue = new ClearValue(new ClearColorValue(color.Red, color.Green, color.Blue, color.Alpha)); var attachment = new ClearAttachment(ImageAspectFlags.ImageAspectColorBit, (uint)index, clearValue); - var clearRect = FramebufferParams?.GetClearRect(ClearScissor) ?? default; + var clearRect = FramebufferParams?.GetClearRect(ClearScissor, layer) ?? default; Gd.Api.CmdClearAttachments(CommandBuffer, 1, &attachment, 1, &clearRect); } - public unsafe void ClearRenderTargetDepthStencil(float depthValue, bool depthMask, int stencilValue, int stencilMask) + public unsafe void ClearRenderTargetDepthStencil(int layer, float depthValue, bool depthMask, int stencilValue, int stencilMask) { // TODO: Use stencilMask (fully) @@ -205,7 +205,7 @@ namespace Ryujinx.Graphics.Vulkan } var attachment = new ClearAttachment(flags, 0, clearValue); - var clearRect = FramebufferParams?.GetClearRect(ClearScissor) ?? default; + var clearRect = FramebufferParams?.GetClearRect(ClearScissor, layer) ?? default; Gd.Api.CmdClearAttachments(CommandBuffer, 1, &attachment, 1, &clearRect); } diff --git a/Ryujinx.Graphics.Vulkan/PipelineFull.cs b/Ryujinx.Graphics.Vulkan/PipelineFull.cs index bea8d2593..1b8b12880 100644 --- a/Ryujinx.Graphics.Vulkan/PipelineFull.cs +++ b/Ryujinx.Graphics.Vulkan/PipelineFull.cs @@ -45,7 +45,7 @@ namespace Ryujinx.Graphics.Vulkan _pendingQueryCopies.Clear(); } - public void ClearRenderTargetColor(int index, uint componentMask, ColorF color) + public void ClearRenderTargetColor(int index, int layer, uint componentMask, ColorF color) { if (FramebufferParams == null) { @@ -68,6 +68,7 @@ namespace Ryujinx.Graphics.Vulkan clearColor[2] = color.Blue; clearColor[3] = color.Alpha; + // TODO: Clear only the specified layer. Gd.HelperShader.Clear( Gd, dstTexture, @@ -80,7 +81,7 @@ namespace Ryujinx.Graphics.Vulkan } else { - ClearRenderTargetColor(index, color); + ClearRenderTargetColor(index, layer, color); } }