aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Texture
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-01-15 15:14:00 -0300
committerGitHub <noreply@github.com>2021-01-15 19:14:00 +0100
commit3bad321d2b0994cd19129bc18ed98bb3ab81c3b0 (patch)
tree0c1c3610b7b0b42a2be3f797baf46ce42986a98b /Ryujinx.Graphics.Texture
parent1e5b37c94f870dc3faa94fb2d095cfa39fecb2a3 (diff)
Fix mipmap base level being ignored for sampled textures and images (#1911)
* Fix mipmap base level being ignored for sampled textures and images * Fix layer size and max level for textures * Missing XML doc + reorder comments
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);
}