GalImage.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using Ryujinx.Graphics.Texture;
  2. namespace Ryujinx.Graphics.Gal
  3. {
  4. public struct GalImage
  5. {
  6. public int Width;
  7. public int Height;
  8. public int TileWidth;
  9. public int GobBlockHeight;
  10. public int Pitch;
  11. public GalImageFormat Format;
  12. public GalMemoryLayout Layout;
  13. public GalTextureSource XSource;
  14. public GalTextureSource YSource;
  15. public GalTextureSource ZSource;
  16. public GalTextureSource WSource;
  17. public GalImage(
  18. int Width,
  19. int Height,
  20. int TileWidth,
  21. int GobBlockHeight,
  22. GalMemoryLayout Layout,
  23. GalImageFormat Format,
  24. GalTextureSource XSource = GalTextureSource.Red,
  25. GalTextureSource YSource = GalTextureSource.Green,
  26. GalTextureSource ZSource = GalTextureSource.Blue,
  27. GalTextureSource WSource = GalTextureSource.Alpha)
  28. {
  29. this.Width = Width;
  30. this.Height = Height;
  31. this.TileWidth = TileWidth;
  32. this.GobBlockHeight = GobBlockHeight;
  33. this.Layout = Layout;
  34. this.Format = Format;
  35. this.XSource = XSource;
  36. this.YSource = YSource;
  37. this.ZSource = ZSource;
  38. this.WSource = WSource;
  39. Pitch = ImageUtils.GetPitch(Format, Width);
  40. }
  41. public bool SizeMatches(GalImage Image)
  42. {
  43. if (ImageUtils.GetBytesPerPixel(Format) !=
  44. ImageUtils.GetBytesPerPixel(Image.Format))
  45. {
  46. return false;
  47. }
  48. if (ImageUtils.GetAlignedWidth(this) !=
  49. ImageUtils.GetAlignedWidth(Image))
  50. {
  51. return false;
  52. }
  53. return Height == Image.Height;
  54. }
  55. }
  56. }