From 04ca284e14412747f032030ab6b11e1b4c935fa9 Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Tue, 19 Mar 2024 22:14:17 -0400 Subject: [PATCH] Properly check for 3D --- src/Ryujinx.Graphics.Metal/Texture.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Ryujinx.Graphics.Metal/Texture.cs b/src/Ryujinx.Graphics.Metal/Texture.cs index 01513470f..8b742d2cb 100644 --- a/src/Ryujinx.Graphics.Metal/Texture.cs +++ b/src/Ryujinx.Graphics.Metal/Texture.cs @@ -175,6 +175,7 @@ namespace Ryujinx.Graphics.Metal int height = Info.Height; int depth = Info.Depth; int levels = Info.GetLevelsClamped(); + bool is3D = Info.Target == Target.Texture3D; int offset = 0; @@ -194,7 +195,7 @@ namespace Ryujinx.Graphics.Metal (ulong)offset, (ulong)Info.GetMipStride(level), (ulong)mipSize, - new MTLSize { width = (ulong)width, height = (ulong)height, depth = (ulong)depth }, + new MTLSize { width = (ulong)width, height = (ulong)height, depth = is3D ? (ulong)depth : 1 }, MTLTexture, 0, (ulong)level, @@ -205,7 +206,11 @@ namespace Ryujinx.Graphics.Metal width = Math.Max(1, width >> 1); height = Math.Max(1, height >> 1); - depth = Math.Max(1, depth >> 1); + + if (is3D) + { + depth = Math.Max(1, depth >> 1); + } } }