From 0278fadbeaedd0cf74e746e983a151ee9969d11a Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Thu, 6 Sep 2018 16:38:20 -0300 Subject: [PATCH] Address some feedback --- Ryujinx.Graphics/Gal/OpenGL/ImageHandler.cs | 18 +++++++++--------- Ryujinx.Graphics/Gal/OpenGL/OGLRenderTarget.cs | 2 +- Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs | 2 +- Ryujinx.Graphics/NvGpuEngine3d.cs | 10 +++++----- .../Texture/{ImageTable.cs => ImageUtils.cs} | 2 +- Ryujinx.Graphics/Texture/TextureFactory.cs | 2 +- Ryujinx.Graphics/Texture/TextureReader.cs | 2 +- Ryujinx.HLE/Switch.cs | 2 +- 8 files changed, 20 insertions(+), 20 deletions(-) rename Ryujinx.Graphics/Texture/{ImageTable.cs => ImageUtils.cs} (99%) diff --git a/Ryujinx.Graphics/Gal/OpenGL/ImageHandler.cs b/Ryujinx.Graphics/Gal/OpenGL/ImageHandler.cs index 4aa807f1c7..dda825385e 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/ImageHandler.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/ImageHandler.cs @@ -50,7 +50,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL PixelFormat PixelFormat; PixelType PixelType; - if (ImageTable.IsCompressed(NewImage.Format)) + if (ImageUtils.IsCompressed(NewImage.Format)) { InternalFmt = (PixelInternalFormat)OGLEnumConverter.GetCompressedImageFormat(NewImage.Format); @@ -71,8 +71,8 @@ namespace Ryujinx.Graphics.Gal.OpenGL CopyBuffer = GL.GenBuffer(); } - int CurrentSize = Math.Max(ImageTable.GetSize(NewImage), - ImageTable.GetSize(Image)); + int CurrentSize = Math.Max(ImageUtils.GetSize(NewImage), + ImageUtils.GetSize(Image)); GL.BindBuffer(BufferTarget.PixelPackBuffer, CopyBuffer); GL.BindBuffer(BufferTarget.PixelUnpackBuffer, CopyBuffer); @@ -84,7 +84,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL GL.BufferData(BufferTarget.PixelPackBuffer, CurrentSize, IntPtr.Zero, BufferUsageHint.StreamCopy); } - if (ImageTable.IsCompressed(Image.Format)) + if (ImageUtils.IsCompressed(Image.Format)) { GL.GetCompressedTexImage(TextureTarget.Texture2D, 0, IntPtr.Zero); } @@ -109,7 +109,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL const int Level = 0; const int Border = 0; - if (ImageTable.IsCompressed(NewImage.Format)) + if (ImageUtils.IsCompressed(NewImage.Format)) { Console.WriteLine("Hit"); @@ -120,7 +120,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL NewImage.Width, NewImage.Height, Border, - ImageTable.GetSize(NewImage), + ImageUtils.GetSize(NewImage), IntPtr.Zero); } else @@ -152,8 +152,8 @@ namespace Ryujinx.Graphics.Gal.OpenGL Initialized = true; } - public bool HasColor => ImageTable.HasColor(Image.Format); - public bool HasDepth => ImageTable.HasDepth(Image.Format); - public bool HasStencil => ImageTable.HasStencil(Image.Format); + public bool HasColor => ImageUtils.HasColor(Image.Format); + public bool HasDepth => ImageUtils.HasDepth(Image.Format); + public bool HasStencil => ImageUtils.HasStencil(Image.Format); } } diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLRenderTarget.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLRenderTarget.cs index b52e2b312d..99bfa350de 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OGLRenderTarget.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OGLRenderTarget.cs @@ -380,7 +380,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL { if (Texture.TryGetImage(Key, out ImageHandler Tex)) { - byte[] Data = new byte[ImageTable.GetSize(Tex.Image)]; + byte[] Data = new byte[ImageUtils.GetSize(Tex.Image)]; GL.BindTexture(TextureTarget.Texture2D, Tex.Handle); diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs index 6ac4b5e51d..82f9c9139c 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs @@ -43,7 +43,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL bool IsASTC = TypeLess >= GalImageFormat.ASTC_BEGIN && TypeLess <= GalImageFormat.ASTC_END; - if (ImageTable.IsCompressed(Image.Format) && !IsASTC) + if (ImageUtils.IsCompressed(Image.Format) && !IsASTC) { InternalFormat InternalFmt = OGLEnumConverter.GetCompressedImageFormat(Image.Format); diff --git a/Ryujinx.Graphics/NvGpuEngine3d.cs b/Ryujinx.Graphics/NvGpuEngine3d.cs index 701c51c30b..624eddae0a 100644 --- a/Ryujinx.Graphics/NvGpuEngine3d.cs +++ b/Ryujinx.Graphics/NvGpuEngine3d.cs @@ -201,11 +201,11 @@ namespace Ryujinx.Graphics int VpW = (int)(TX + MathF.Abs(SX)) - VpX; int VpH = (int)(TY + MathF.Abs(SY)) - VpY; - GalImageFormat ImageFormat = ImageTable.ConvertSurface((GalSurfaceFormat)Format); + GalImageFormat ImageFormat = ImageUtils.ConvertSurface((GalSurfaceFormat)Format); GalImage Image = new GalImage(Width, Height, ImageFormat); - long Size = ImageTable.GetSize(Image); + long Size = ImageUtils.GetSize(Image); Gpu.Renderer.Texture.CreateFb(Key, Size, Image); @@ -234,11 +234,11 @@ namespace Ryujinx.Graphics int Width = ReadRegister(NvGpuEngine3dReg.ZetaHoriz); int Height = ReadRegister(NvGpuEngine3dReg.ZetaVert); - GalImageFormat ImageFormat = ImageTable.ConvertZeta((GalZetaFormat)Format); + GalImageFormat ImageFormat = ImageUtils.ConvertZeta((GalZetaFormat)Format); GalImage Image = new GalImage(Width, Height, ImageFormat); - long Size = ImageTable.GetSize(Image); + long Size = ImageUtils.GetSize(Image); Gpu.Renderer.Texture.CreateFb(Key, Size, Image); @@ -528,7 +528,7 @@ namespace Ryujinx.Graphics { GalImage NewImage = TextureFactory.MakeTexture(Vmm, TicPosition); - long Size = (uint)ImageTable.GetSize(NewImage); + long Size = (uint)ImageUtils.GetSize(NewImage); bool HasCachedTexture = false; diff --git a/Ryujinx.Graphics/Texture/ImageTable.cs b/Ryujinx.Graphics/Texture/ImageUtils.cs similarity index 99% rename from Ryujinx.Graphics/Texture/ImageTable.cs rename to Ryujinx.Graphics/Texture/ImageUtils.cs index 311e89f3a3..ccea43ec1c 100644 --- a/Ryujinx.Graphics/Texture/ImageTable.cs +++ b/Ryujinx.Graphics/Texture/ImageUtils.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; namespace Ryujinx.Graphics.Texture { - static class ImageTable + static class ImageUtils { struct ImageDescriptor { diff --git a/Ryujinx.Graphics/Texture/TextureFactory.cs b/Ryujinx.Graphics/Texture/TextureFactory.cs index 824687ccc5..fa7a0f80e0 100644 --- a/Ryujinx.Graphics/Texture/TextureFactory.cs +++ b/Ryujinx.Graphics/Texture/TextureFactory.cs @@ -114,7 +114,7 @@ namespace Ryujinx.Graphics.Texture GalTextureFormat Format = (GalTextureFormat)(Tic[0] & 0x7f); - return ImageTable.ConvertTexture(Format, RType, GType, BType, AType); + return ImageUtils.ConvertTexture(Format, RType, GType, BType, AType); } private static int[] ReadWords(NvGpuVmm Vmm, long Position, int Count) diff --git a/Ryujinx.Graphics/Texture/TextureReader.cs b/Ryujinx.Graphics/Texture/TextureReader.cs index d38e27cb64..dbaed1a8e8 100644 --- a/Ryujinx.Graphics/Texture/TextureReader.cs +++ b/Ryujinx.Graphics/Texture/TextureReader.cs @@ -10,7 +10,7 @@ namespace Ryujinx.Graphics.Texture { public static byte[] Read(IAMemory Memory, TextureInfo Texture) { - TextureReaderDelegate Reader = ImageTable.GetReader(Texture.Format); + TextureReaderDelegate Reader = ImageUtils.GetReader(Texture.Format); return Reader(Memory, Texture); } diff --git a/Ryujinx.HLE/Switch.cs b/Ryujinx.HLE/Switch.cs index 28400055de..32d5bef681 100644 --- a/Ryujinx.HLE/Switch.cs +++ b/Ryujinx.HLE/Switch.cs @@ -1,6 +1,6 @@ using Ryujinx.Audio; -using Ryujinx.Graphics.Gal; using Ryujinx.Graphics; +using Ryujinx.Graphics.Gal; using Ryujinx.HLE.HOS; using Ryujinx.HLE.Input; using Ryujinx.HLE.Logging;