From 851f56b08a0c3b420f91143b6c6c007b429174a8 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Tue, 14 Jun 2022 13:30:39 -0300 Subject: Support Array/3D depth-stencil render target, and single layer clears (#3400) * Support Array/3D depth-stencil render target, and single layer clears * Alignment --- Ryujinx.Graphics.Gpu/Image/TextureCache.cs | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'Ryujinx.Graphics.Gpu/Image') diff --git a/Ryujinx.Graphics.Gpu/Image/TextureCache.cs b/Ryujinx.Graphics.Gpu/Image/TextureCache.cs index 04541057..ba863a1e 100644 --- a/Ryujinx.Graphics.Gpu/Image/TextureCache.cs +++ b/Ryujinx.Graphics.Gpu/Image/TextureCache.cs @@ -349,6 +349,7 @@ namespace Ryujinx.Graphics.Gpu.Image /// GPU memory manager where the texture is mapped /// Depth-stencil buffer texture to find or create /// Size of the depth-stencil texture + /// Indicates if the texture might be accessed with a non-zero layer index /// Number of samples in the X direction, for MSAA /// Number of samples in the Y direction, for MSAA /// A hint indicating the minimum used size for the texture @@ -357,6 +358,7 @@ namespace Ryujinx.Graphics.Gpu.Image MemoryManager memoryManager, RtDepthStencilState dsState, Size3D size, + bool layered, int samplesInX, int samplesInY, Size sizeHint) @@ -364,9 +366,24 @@ namespace Ryujinx.Graphics.Gpu.Image int gobBlocksInY = dsState.MemoryLayout.UnpackGobBlocksInY(); int gobBlocksInZ = dsState.MemoryLayout.UnpackGobBlocksInZ(); - Target target = (samplesInX | samplesInY) != 1 - ? Target.Texture2DMultisample - : Target.Texture2D; + Target target; + + if (dsState.MemoryLayout.UnpackIsTarget3D()) + { + target = Target.Texture3D; + } + else if ((samplesInX | samplesInY) != 1) + { + target = size.Depth > 1 && layered + ? Target.Texture2DMultisampleArray + : Target.Texture2DMultisample; + } + else + { + target = size.Depth > 1 && layered + ? Target.Texture2DArray + : Target.Texture2D; + } FormatInfo formatInfo = dsState.Format.Convert(); -- cgit v1.2.3