LinearSwizzle.cs 1000 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. this.Pitch = Pitch;
  12. this.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. }