Add missing clear layer parameter after rebase

This commit is contained in:
gdk 2022-06-14 16:19:59 -03:00 committed by riperiperi
parent 0e06449f90
commit 0860e208b2
4 changed files with 10 additions and 9 deletions

View file

@ -149,14 +149,14 @@ namespace Ryujinx.Graphics.Vulkan
return texture is TextureView view && view.Valid; return texture is TextureView view && view.Valid;
} }
public ClearRect GetClearRect(Rectangle<int> scissor) public ClearRect GetClearRect(Rectangle<int> scissor, int layer)
{ {
int x = scissor.X; int x = scissor.X;
int y = scissor.Y; int y = scissor.Y;
int width = Math.Min((int)Width - scissor.X, scissor.Width); int width = Math.Min((int)Width - scissor.X, scissor.Width);
int height = Math.Min((int)Height - scissor.Y, scissor.Height); 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<DisposableFramebuffer> Create(Vk api, CommandBufferScoped cbs, Auto<DisposableRenderPass> renderPass) public unsafe Auto<DisposableFramebuffer> Create(Vk api, CommandBufferScoped cbs, Auto<DisposableRenderPass> renderPass)

View file

@ -178,7 +178,7 @@ namespace Ryujinx.Graphics.Vulkan
if (clearAlpha) 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); _pipeline.SetViewports(0, viewports, false);

View file

@ -159,7 +159,7 @@ namespace Ryujinx.Graphics.Vulkan
size); 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)) 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 clearValue = new ClearValue(new ClearColorValue(color.Red, color.Green, color.Blue, color.Alpha));
var attachment = new ClearAttachment(ImageAspectFlags.ImageAspectColorBit, (uint)index, clearValue); 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); 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) // TODO: Use stencilMask (fully)
@ -205,7 +205,7 @@ namespace Ryujinx.Graphics.Vulkan
} }
var attachment = new ClearAttachment(flags, 0, clearValue); 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); Gd.Api.CmdClearAttachments(CommandBuffer, 1, &attachment, 1, &clearRect);
} }

View file

@ -45,7 +45,7 @@ namespace Ryujinx.Graphics.Vulkan
_pendingQueryCopies.Clear(); _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) if (FramebufferParams == null)
{ {
@ -68,6 +68,7 @@ namespace Ryujinx.Graphics.Vulkan
clearColor[2] = color.Blue; clearColor[2] = color.Blue;
clearColor[3] = color.Alpha; clearColor[3] = color.Alpha;
// TODO: Clear only the specified layer.
Gd.HelperShader.Clear( Gd.HelperShader.Clear(
Gd, Gd,
dstTexture, dstTexture,
@ -80,7 +81,7 @@ namespace Ryujinx.Graphics.Vulkan
} }
else else
{ {
ClearRenderTargetColor(index, color); ClearRenderTargetColor(index, layer, color);
} }
} }