LinearSwizzle.cs 1004 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. namespace Ryujinx.Graphics.Texture
  3. {
  4. class LinearSwizzle : ISwizzle
  5. {
  6. private int _pitch;
  7. private int _bpp;
  8. private int _sliceSize;
  9. public LinearSwizzle(int pitch, int bpp, int width, int height)
  10. {
  11. _pitch = pitch;
  12. _bpp = bpp;
  13. _sliceSize = width * height * bpp;
  14. }
  15. public void SetMipLevel(int level)
  16. {
  17. throw new NotImplementedException();
  18. }
  19. public int GetMipOffset(int level)
  20. {
  21. if (level == 1)
  22. return _sliceSize;
  23. throw new NotImplementedException();
  24. }
  25. public int GetImageSize(int mipsCount)
  26. {
  27. int size = GetMipOffset(mipsCount);
  28. size = (size + 0x1fff) & ~0x1fff;
  29. return size;
  30. }
  31. public int GetSwizzleOffset(int x, int y, int z)
  32. {
  33. return z * _sliceSize + x * _bpp + y * _pitch;
  34. }
  35. }
  36. }