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
This commit is contained in:
gdkchan 2021-01-15 15:14:00 -03:00 committed by GitHub
parent 1e5b37c94f
commit 3bad321d2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 159 additions and 54 deletions

View file

@ -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);
}