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