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