Magic numbers to constants

* changed 2 magic numbers to constants
This commit is contained in:
gdkchan 2018-12-11 04:16:27 +01:00 committed by Ryada Productions
commit 3db742a3f8
3 changed files with 21 additions and 5 deletions

View file

@ -1,17 +1,16 @@
using OpenTK.Graphics.OpenGL; using OpenTK.Graphics.OpenGL;
using System; using System;
namespace Ryujinx.Graphics.Gal.OpenGL namespace Ryujinx.Graphics.Gal.OpenGL
{ {
class OGLConstBuffer : IGalConstBuffer class OGLConstBuffer : IGalConstBuffer
{ {
private const long MaxConstBufferCacheSize = 64 * 1024 * 1024;
private OGLCachedResource<OGLStreamBuffer> Cache; private OGLCachedResource<OGLStreamBuffer> Cache;
public OGLConstBuffer() public OGLConstBuffer()
{ {
Cache = new OGLCachedResource<OGLStreamBuffer>(DeleteBuffer, MaxConstBufferCacheSize); Cache = new OGLCachedResource<OGLStreamBuffer>(DeleteBuffer, OGLResourceLimits.ConstBufferLimit);
} }
public void LockCache() public void LockCache()

View file

@ -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;
}
}

View file

@ -6,7 +6,6 @@ namespace Ryujinx.Graphics.Gal.OpenGL
{ {
class OGLTexture : IGalTexture class OGLTexture : IGalTexture
{ {
private const long MaxTextureCacheSize = 768 * 1024 * 1024;
private OGLCachedResource<ImageHandler> TextureCache; private OGLCachedResource<ImageHandler> TextureCache;
@ -14,7 +13,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
public OGLTexture() public OGLTexture()
{ {
TextureCache = new OGLCachedResource<ImageHandler>(DeleteTexture, MaxTextureCacheSize); TextureCache = new OGLCachedResource<ImageHandler>(DeleteTexture, OGLResourceLimits.TextureLimit);
} }
public void LockCache() public void LockCache()