From ed4f7a5602534baeddecdb9fe126b7865d38a03b Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Sat, 29 Jun 2024 22:54:28 +0100 Subject: [PATCH] Stop depth/stencil blits from crashing everything --- src/Ryujinx.Graphics.Metal/Pipeline.cs | 13 +++++++++++-- src/Ryujinx.Graphics.Metal/Texture.cs | 5 ++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Ryujinx.Graphics.Metal/Pipeline.cs b/src/Ryujinx.Graphics.Metal/Pipeline.cs index f410c789c..44608e208 100644 --- a/src/Ryujinx.Graphics.Metal/Pipeline.cs +++ b/src/Ryujinx.Graphics.Metal/Pipeline.cs @@ -254,14 +254,23 @@ namespace Ryujinx.Graphics.Metal _renderer.RegisterFlush(); } - public void BlitColor( + public void Blit( ITexture src, ITexture dst, Extents2D srcRegion, Extents2D dstRegion, + bool isDepthOrStencil, bool linearFilter) { - _renderer.HelperShader.BlitColor(Cbs, src, dst, srcRegion, dstRegion, linearFilter); + if (isDepthOrStencil) + { + // TODO: Depth & stencil blit! + Logger.Warning?.PrintMsg(LogClass.Gpu, "Requested a depth or stencil blit!"); + } + else + { + _renderer.HelperShader.BlitColor(Cbs, src, dst, srcRegion, dstRegion, linearFilter); + } } public void Barrier() diff --git a/src/Ryujinx.Graphics.Metal/Texture.cs b/src/Ryujinx.Graphics.Metal/Texture.cs index fdff81f0d..9c4fed5c9 100644 --- a/src/Ryujinx.Graphics.Metal/Texture.cs +++ b/src/Ryujinx.Graphics.Metal/Texture.cs @@ -162,7 +162,10 @@ namespace Ryujinx.Graphics.Metal public void CopyTo(ITexture destination, Extents2D srcRegion, Extents2D dstRegion, bool linearFilter) { - _pipeline.BlitColor(this, destination, srcRegion, dstRegion, linearFilter); + var dst = (Texture)destination; + bool isDepthOrStencil = dst.Info.Format.IsDepthOrStencil(); + + _pipeline.Blit(this, destination, srcRegion, dstRegion, isDepthOrStencil, linearFilter); } public void CopyTo(BufferRange range, int layer, int level, int stride)