[Ryujinx.Graphics.Texture] Address dotnet-format issues (#5375)

* dotnet format style --severity info

Some changes were manually reverted.

* Restore a few unused methods and variables

* Silence dotnet format IDE0060 warnings

* Silence dotnet format IDE0059 warnings

* Address or silence dotnet format CA2208 warnings

* Address most dotnet format whitespace warnings

* Apply dotnet format whitespace formatting

A few of them have been manually reverted and the corresponding warning was silenced

* Format if-blocks correctly

* Add comments to disabled warnings

* Simplify properties and array initialization, Use const when possible, Remove trailing commas

* Address IDE0251 warnings

* Silence IDE0060 in .editorconfig

* Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas"

This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e.

* dotnet format whitespace after rebase

* First dotnet format pass

* Apply suggestions from code review

Co-authored-by: Ac_K <Acoustik666@gmail.com>

* Address review feedback

* Update src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs

Co-authored-by: Ac_K <Acoustik666@gmail.com>

---------

Co-authored-by: Ac_K <Acoustik666@gmail.com>
This commit is contained in:
TSRBerry
2023-06-28 18:46:18 +02:00
committed by GitHub
parent fc20d9b925
commit cebfa54467
25 changed files with 741 additions and 630 deletions

View File

@ -1,6 +1,5 @@
using Ryujinx.Common;
using System;
using static Ryujinx.Graphics.Texture.BlockLinearConstants;
namespace Ryujinx.Graphics.Texture
@ -48,16 +47,16 @@ namespace Ryujinx.Graphics.Texture
int mipGobBlocksInY = gobBlocksInY;
int mipGobBlocksInZ = gobBlocksInZ;
int gobWidth = (GobStride / bytesPerPixel) * gobBlocksInTileX;
int gobWidth = (GobStride / bytesPerPixel) * gobBlocksInTileX;
int gobHeight = gobBlocksInY * GobHeight;
int depthLevelOffset = 0;
for (int level = 0; level < levels; level++)
{
int w = Math.Max(1, width >> level);
int w = Math.Max(1, width >> level);
int h = Math.Max(1, height >> level);
int d = Math.Max(1, depth >> level);
int d = Math.Max(1, depth >> level);
w = BitUtils.DivRoundUp(w, blockWidth);
h = BitUtils.DivRoundUp(h, blockHeight);
@ -104,7 +103,7 @@ namespace Ryujinx.Graphics.Texture
for (int z = 0; z < d; z++)
{
int zLow = z & mask;
int zLow = z & mask;
int zHigh = z & ~mask;
allOffsets[z + depthLevelOffset] = baseOffset + zLow * gobSize + zHigh * sliceSize;
@ -159,7 +158,7 @@ namespace Ryujinx.Graphics.Texture
{
for (int layer = 0; layer < layers; layer++)
{
int baseIndex = layer * levels;
int baseIndex = layer * levels;
int baseOffset = layer * layerSize;
for (int level = 0; level < levels; level++)
@ -234,10 +233,10 @@ namespace Ryujinx.Graphics.Texture
int gobBlocksInZ,
int gobBlocksInTileX)
{
width = BitUtils.DivRoundUp(width, blockWidth);
width = BitUtils.DivRoundUp(width, blockWidth);
height = BitUtils.DivRoundUp(height, blockHeight);
int gobWidth = (GobStride / bytesPerPixel) * gobBlocksInTileX;
int gobWidth = (GobStride / bytesPerPixel) * gobBlocksInTileX;
int gobHeight = gobBlocksInY * GobHeight;
int alignment = gobWidth;
@ -251,11 +250,11 @@ namespace Ryujinx.Graphics.Texture
(gobBlocksInY, gobBlocksInZ) = GetMipGobBlockSizes(height, depth, 1, gobBlocksInY, gobBlocksInZ);
int blockOfGobsHeight = gobBlocksInY * GobHeight;
int blockOfGobsDepth = gobBlocksInZ;
int blockOfGobsDepth = gobBlocksInZ;
width = BitUtils.AlignUp(width, alignment);
width = BitUtils.AlignUp(width, alignment);
height = BitUtils.AlignUp(height, blockOfGobsHeight);
depth = BitUtils.AlignUp(depth, blockOfGobsDepth);
depth = BitUtils.AlignUp(depth, blockOfGobsDepth);
return new Size(width, height, depth);
}
@ -267,7 +266,7 @@ namespace Ryujinx.Graphics.Texture
int blockHeight,
int bytesPerPixel)
{
width = BitUtils.DivRoundUp(width, blockWidth);
width = BitUtils.DivRoundUp(width, blockWidth);
height = BitUtils.DivRoundUp(height, blockHeight);
int widthAlignment = StrideAlignment / bytesPerPixel;
@ -300,4 +299,4 @@ namespace Ryujinx.Graphics.Texture
return (gobBlocksInY, gobBlocksInZ);
}
}
}
}