Correct texture width alignment

This commit is contained in:
gdkchan 2018-07-17 02:27:14 -03:00
commit b56620f1b3
2 changed files with 4 additions and 9 deletions

View file

@ -93,11 +93,6 @@ namespace Ryujinx.HLE.Gpu.Engines
bool IsSrcFb = Gpu.Engine3d.IsFrameBufferPosition(SrcKey); bool IsSrcFb = Gpu.Engine3d.IsFrameBufferPosition(SrcKey);
bool IsDstFb = Gpu.Engine3d.IsFrameBufferPosition(DstKey); bool IsDstFb = Gpu.Engine3d.IsFrameBufferPosition(DstKey);
if (IsSrcFb && DstLinear)
{
DstSwizzle = TextureSwizzle.BlockLinear;
}
TextureInfo SrcTexture = new TextureInfo( TextureInfo SrcTexture = new TextureInfo(
SrcAddress, SrcAddress,
SrcWidth, SrcWidth,

View file

@ -9,11 +9,11 @@ namespace Ryujinx.HLE.Gpu.Texture
{ {
public static ISwizzle GetSwizzle(TextureInfo Texture, int BlockWidth, int Bpp) public static ISwizzle GetSwizzle(TextureInfo Texture, int BlockWidth, int Bpp)
{ {
int AlignMask = Texture.TileWidth * 64 - 1; int Width = (Texture.Width + (BlockWidth - 1)) / BlockWidth;
int WidthAligned = (Texture.Width + AlignMask) & ~AlignMask; int AlignMask = Texture.TileWidth * (64 / Bpp) - 1;
WidthAligned = (WidthAligned + (BlockWidth - 1)) / BlockWidth; Width = (Width + AlignMask) & ~AlignMask;
switch (Texture.Swizzle) switch (Texture.Swizzle)
{ {
@ -24,7 +24,7 @@ namespace Ryujinx.HLE.Gpu.Texture
case TextureSwizzle.BlockLinear: case TextureSwizzle.BlockLinear:
case TextureSwizzle.BlockLinearColorKey: case TextureSwizzle.BlockLinearColorKey:
return new BlockLinearSwizzle(WidthAligned, Bpp, Texture.BlockHeight); return new BlockLinearSwizzle(Width, Bpp, Texture.BlockHeight);
} }
throw new NotImplementedException(Texture.Swizzle.ToString()); throw new NotImplementedException(Texture.Swizzle.ToString());