aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Texture
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.Texture')
-rw-r--r--Ryujinx.Graphics.Texture/SizeCalculator.cs36
1 files changed, 25 insertions, 11 deletions
diff --git a/Ryujinx.Graphics.Texture/SizeCalculator.cs b/Ryujinx.Graphics.Texture/SizeCalculator.cs
index 9339ba12..2dc60869 100644
--- a/Ryujinx.Graphics.Texture/SizeCalculator.cs
+++ b/Ryujinx.Graphics.Texture/SizeCalculator.cs
@@ -20,7 +20,8 @@ namespace Ryujinx.Graphics.Texture
int bytesPerPixel,
int gobBlocksInY,
int gobBlocksInZ,
- int gobBlocksInTileX)
+ int gobBlocksInTileX,
+ int gpuLayerSize = 0)
{
bool is3D = depth > 1;
@@ -94,14 +95,29 @@ namespace Ryujinx.Graphics.Texture
layerSize += totalBlocksOfGobsInZ * totalBlocksOfGobsInY * robSize;
}
- layerSize = AlignLayerSize(
- layerSize,
- height,
- depth,
- blockHeight,
- gobBlocksInY,
- gobBlocksInZ,
- gobBlocksInTileX);
+ if (layers > 1)
+ {
+ layerSize = AlignLayerSize(
+ layerSize,
+ height,
+ depth,
+ blockHeight,
+ gobBlocksInY,
+ gobBlocksInZ,
+ gobBlocksInTileX);
+ }
+
+ int totalSize;
+
+ if (layerSize < gpuLayerSize)
+ {
+ totalSize = (layers - 1) * gpuLayerSize + layerSize;
+ layerSize = gpuLayerSize;
+ }
+ else
+ {
+ totalSize = layerSize * layers;
+ }
if (!is3D)
{
@@ -117,8 +133,6 @@ namespace Ryujinx.Graphics.Texture
}
}
- int totalSize = layerSize * layers;
-
return new SizeInfo(mipOffsets, allOffsets, levels, layerSize, totalSize);
}