aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Image/TextureCache.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2022-06-14 13:30:39 -0300
committerGitHub <noreply@github.com>2022-06-14 13:30:39 -0300
commit851f56b08a0c3b420f91143b6c6c007b429174a8 (patch)
treed4f331d1de9f4715a22abdc9b1b90b5ce5a3b4ae /Ryujinx.Graphics.Gpu/Image/TextureCache.cs
parentb1bd6a50b5341f444ceb31bbb0fb64f685828d75 (diff)
Support Array/3D depth-stencil render target, and single layer clears (#3400)1.1.147
* Support Array/3D depth-stencil render target, and single layer clears * Alignment
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/TextureCache.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Image/TextureCache.cs23
1 files changed, 20 insertions, 3 deletions
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
/// <param name="memoryManager">GPU memory manager where the texture is mapped</param>
/// <param name="dsState">Depth-stencil buffer texture to find or create</param>
/// <param name="size">Size of the depth-stencil texture</param>
+ /// <param name="layered">Indicates if the texture might be accessed with a non-zero layer index</param>
/// <param name="samplesInX">Number of samples in the X direction, for MSAA</param>
/// <param name="samplesInY">Number of samples in the Y direction, for MSAA</param>
/// <param name="sizeHint">A hint indicating the minimum used size for the texture</param>
@@ -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();