aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Host1x/Devices.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.Host1x/Devices.cs')
-rw-r--r--Ryujinx.Graphics.Host1x/Devices.cs32
1 files changed, 32 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Host1x/Devices.cs b/Ryujinx.Graphics.Host1x/Devices.cs
new file mode 100644
index 00000000..5b3bed6b
--- /dev/null
+++ b/Ryujinx.Graphics.Host1x/Devices.cs
@@ -0,0 +1,32 @@
+using Ryujinx.Graphics.Device;
+using System;
+using System.Collections.Generic;
+
+namespace Ryujinx.Graphics.Host1x
+{
+ class Devices : IDisposable
+ {
+ private readonly Dictionary<ClassId, IDeviceState> _devices = new Dictionary<ClassId, IDeviceState>();
+
+ public void RegisterDevice(ClassId classId, IDeviceState device)
+ {
+ _devices[classId] = device;
+ }
+
+ public IDeviceState GetDevice(ClassId classId)
+ {
+ return _devices.TryGetValue(classId, out IDeviceState device) ? device : null;
+ }
+
+ public void Dispose()
+ {
+ foreach (var device in _devices.Values)
+ {
+ if (device is ThiDevice thi)
+ {
+ thi.Dispose();
+ }
+ }
+ }
+ }
+}