diff options
| author | gdk <gab.dark.100@gmail.com> | 2019-10-30 20:45:01 -0300 |
|---|---|---|
| committer | Thog <thog@protonmail.com> | 2020-01-09 02:13:00 +0100 |
| commit | d786d8d2b924da7cd116a2eb97d738a9f07b4e43 (patch) | |
| tree | 0e84072c554066d20622d156d1394144ed5258bd /Ryujinx.Graphics.Texture | |
| parent | 3bcc395253e020df40763d36ba9401b126b17173 (diff) | |
Support copy of slices to 3D textures, remove old 3D render target layered render support, do not delete textures with existing views created from them
Diffstat (limited to 'Ryujinx.Graphics.Texture')
| -rw-r--r-- | Ryujinx.Graphics.Texture/SizeCalculator.cs | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/Ryujinx.Graphics.Texture/SizeCalculator.cs b/Ryujinx.Graphics.Texture/SizeCalculator.cs index 873f41a3..11385d28 100644 --- a/Ryujinx.Graphics.Texture/SizeCalculator.cs +++ b/Ryujinx.Graphics.Texture/SizeCalculator.cs @@ -22,8 +22,11 @@ namespace Ryujinx.Graphics.Texture int gobBlocksInZ, int gobBlocksInTileX) { + bool is3D = depth > 1; + int layerSize = 0; + int[] allOffsets = new int[levels * layers * depth]; int[] mipOffsets = new int[levels]; int mipGobBlocksInY = gobBlocksInY; @@ -55,6 +58,25 @@ namespace Ryujinx.Graphics.Texture int robSize = widthInGobs * mipGobBlocksInY * mipGobBlocksInZ * GobSize; + if (is3D) + { + int gobSize = mipGobBlocksInY * GobSize; + + int sliceSize = totalBlocksOfGobsInY * widthInGobs * gobSize; + + int baseOffset = layerSize; + + int mask = gobBlocksInZ - 1; + + for (int z = 0; z < d; z++) + { + int zLow = z & mask; + int zHigh = z & ~mask; + + allOffsets[z * levels + level] = baseOffset + zLow * gobSize + zHigh * sliceSize; + } + } + mipOffsets[level] = layerSize; layerSize += totalBlocksOfGobsInZ * totalBlocksOfGobsInY * robSize; @@ -68,16 +90,17 @@ namespace Ryujinx.Graphics.Texture gobBlocksInY, gobBlocksInZ); - int[] allOffsets = new int[levels * layers]; - - for (int layer = 0; layer < layers; layer++) + if (!is3D) { - int baseIndex = layer * levels; - int baseOffset = layer * layerSize; - - for (int level = 0; level < levels; level++) + for (int layer = 0; layer < layers; layer++) { - allOffsets[baseIndex + level] = baseOffset + mipOffsets[level]; + int baseIndex = layer * levels; + int baseOffset = layer * layerSize; + + for (int level = 0; level < levels; level++) + { + allOffsets[baseIndex + level] = baseOffset + mipOffsets[level]; + } } } |
