aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/Gal/OpenGL/OglConstBuffer.cs
diff options
context:
space:
mode:
authorgdk <gab.dark.100@gmail.com>2019-10-13 03:02:07 -0300
committerThog <thog@protonmail.com>2020-01-09 02:13:00 +0100
commit1876b346fea647e8284a66bb6d62c38801035cff (patch)
tree6eeff094298cda84d1613dc5ec0691e51d7b35f1 /Ryujinx.Graphics/Gal/OpenGL/OglConstBuffer.cs
parentf617fb542a0e3d36012d77a4b5acbde7b08902f2 (diff)
Initial work
Diffstat (limited to 'Ryujinx.Graphics/Gal/OpenGL/OglConstBuffer.cs')
-rw-r--r--Ryujinx.Graphics/Gal/OpenGL/OglConstBuffer.cs74
1 files changed, 0 insertions, 74 deletions
diff --git a/Ryujinx.Graphics/Gal/OpenGL/OglConstBuffer.cs b/Ryujinx.Graphics/Gal/OpenGL/OglConstBuffer.cs
deleted file mode 100644
index e076be33..00000000
--- a/Ryujinx.Graphics/Gal/OpenGL/OglConstBuffer.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-using OpenTK.Graphics.OpenGL;
-using System;
-
-namespace Ryujinx.Graphics.Gal.OpenGL
-{
- class OglConstBuffer : IGalConstBuffer
- {
- private const long MaxConstBufferCacheSize = 64 * 1024 * 1024;
-
- private OglCachedResource<OglStreamBuffer> _cache;
-
- public OglConstBuffer()
- {
- _cache = new OglCachedResource<OglStreamBuffer>(DeleteBuffer, MaxConstBufferCacheSize);
- }
-
- public void LockCache()
- {
- _cache.Lock();
- }
-
- public void UnlockCache()
- {
- _cache.Unlock();
- }
-
- public void Create(long key, long size)
- {
- OglStreamBuffer buffer = new OglStreamBuffer(BufferTarget.UniformBuffer, size);
-
- _cache.AddOrUpdate(key, buffer, size);
- }
-
- public bool IsCached(long key, long size)
- {
- return _cache.TryGetSize(key, out long cachedSize) && cachedSize == size;
- }
-
- public void SetData(long key, long size, IntPtr hostAddress)
- {
- if (_cache.TryGetValue(key, out OglStreamBuffer buffer))
- {
- buffer.SetData(size, hostAddress);
- }
- }
-
- public void SetData(long key, byte[] data)
- {
- if (_cache.TryGetValue(key, out OglStreamBuffer buffer))
- {
- buffer.SetData(data);
- }
- }
-
- public bool TryGetUbo(long key, out int uboHandle)
- {
- if (_cache.TryGetValue(key, out OglStreamBuffer buffer))
- {
- uboHandle = buffer.Handle;
-
- return true;
- }
-
- uboHandle = 0;
-
- return false;
- }
-
- private static void DeleteBuffer(OglStreamBuffer buffer)
- {
- buffer.Dispose();
- }
- }
-} \ No newline at end of file