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