From 3db742a3f8385f5b6f55aa9f40846ff8caae85ee Mon Sep 17 00:00:00 2001 From: gdkchan Date: Tue, 11 Dec 2018 04:16:27 +0100 Subject: [PATCH] Magic numbers to constants * changed 2 magic numbers to constants --- Ryujinx.Graphics/Gal/OpenGL/OGLConstBuffer.cs | 5 ++--- .../Gal/OpenGL/OGLResourceLimits.cs | 18 ++++++++++++++++++ Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs | 3 +-- 3 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 Ryujinx.Graphics/Gal/OpenGL/OGLResourceLimits.cs diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLConstBuffer.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLConstBuffer.cs index a12681c7ce..6fd8776b08 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OGLConstBuffer.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OGLConstBuffer.cs @@ -1,17 +1,16 @@ -using OpenTK.Graphics.OpenGL; +using OpenTK.Graphics.OpenGL; using System; namespace Ryujinx.Graphics.Gal.OpenGL { class OGLConstBuffer : IGalConstBuffer { - private const long MaxConstBufferCacheSize = 64 * 1024 * 1024; private OGLCachedResource Cache; public OGLConstBuffer() { - Cache = new OGLCachedResource(DeleteBuffer, MaxConstBufferCacheSize); + Cache = new OGLCachedResource(DeleteBuffer, OGLResourceLimits.ConstBufferLimit); } public void LockCache() diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLResourceLimits.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLResourceLimits.cs new file mode 100644 index 0000000000..0a39ec58f8 --- /dev/null +++ b/Ryujinx.Graphics/Gal/OpenGL/OGLResourceLimits.cs @@ -0,0 +1,18 @@ +namespace Ryujinx.Graphics.Gal.OpenGL +{ + static class OGLResourceLimits + { + private const int KB = 1024; + private const int MB = 1024 * KB; + + public const int ConstBufferLimit = 64 * MB; + + public const int VertexArrayLimit = 16384; + public const int VertexBufferLimit = 128 * MB; + public const int IndexBufferLimit = 64 * MB; + + public const int TextureLimit = 768 * MB; + + public const int PixelBufferLimit = 64 * MB; + } +} \ No newline at end of file diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs index ef984b1ed3..652d0ceefb 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OGLTexture.cs @@ -6,7 +6,6 @@ namespace Ryujinx.Graphics.Gal.OpenGL { class OGLTexture : IGalTexture { - private const long MaxTextureCacheSize = 768 * 1024 * 1024; private OGLCachedResource TextureCache; @@ -14,7 +13,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL public OGLTexture() { - TextureCache = new OGLCachedResource(DeleteTexture, MaxTextureCacheSize); + TextureCache = new OGLCachedResource(DeleteTexture, OGLResourceLimits.TextureLimit); } public void LockCache()