2019-02-27 17:12:24 -08:00
|
|
|
using System;
|
|
|
|
|
2018-09-08 10:51:50 -07:00
|
|
|
namespace Ryujinx.Graphics.Texture
|
2018-04-08 12:17:35 -07:00
|
|
|
{
|
|
|
|
class LinearSwizzle : ISwizzle
|
|
|
|
{
|
2019-03-03 17:45:25 -08:00
|
|
|
private int _pitch;
|
|
|
|
private int _bpp;
|
2018-04-08 12:17:35 -07:00
|
|
|
|
2019-03-03 17:45:25 -08:00
|
|
|
private int _sliceSize;
|
2019-02-27 17:12:24 -08:00
|
|
|
|
2019-03-03 17:45:25 -08:00
|
|
|
public LinearSwizzle(int pitch, int bpp, int width, int height)
|
2018-04-08 12:17:35 -07:00
|
|
|
{
|
2019-03-03 17:45:25 -08:00
|
|
|
_pitch = pitch;
|
|
|
|
_bpp = bpp;
|
|
|
|
_sliceSize = width * height * bpp;
|
2019-02-27 17:12:24 -08:00
|
|
|
}
|
|
|
|
|
2019-03-03 17:45:25 -08:00
|
|
|
public void SetMipLevel(int level)
|
2019-02-27 17:12:24 -08:00
|
|
|
{
|
|
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
|
2019-03-03 17:45:25 -08:00
|
|
|
public int GetMipOffset(int level)
|
2019-02-27 17:12:24 -08:00
|
|
|
{
|
2019-03-03 17:45:25 -08:00
|
|
|
if (level == 1)
|
|
|
|
return _sliceSize;
|
2019-02-27 17:12:24 -08:00
|
|
|
throw new NotImplementedException();
|
|
|
|
}
|
|
|
|
|
2019-03-03 17:45:25 -08:00
|
|
|
public int GetImageSize(int mipsCount)
|
2019-02-27 17:12:24 -08:00
|
|
|
{
|
2019-03-03 17:45:25 -08:00
|
|
|
int size = GetMipOffset(mipsCount);
|
2019-02-27 17:12:24 -08:00
|
|
|
|
2019-03-03 17:45:25 -08:00
|
|
|
size = (size + 0x1fff) & ~0x1fff;
|
2019-02-27 17:12:24 -08:00
|
|
|
|
2019-03-03 17:45:25 -08:00
|
|
|
return size;
|
2018-04-08 12:17:35 -07:00
|
|
|
}
|
|
|
|
|
2019-03-03 17:45:25 -08:00
|
|
|
public int GetSwizzleOffset(int x, int y, int z)
|
2018-04-08 12:17:35 -07:00
|
|
|
{
|
2019-03-03 17:45:25 -08:00
|
|
|
return z * _sliceSize + x * _bpp + y * _pitch;
|
2018-04-08 12:17:35 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|