aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-03-12 01:04:52 -0300
committergdkchan <gab.dark.100@gmail.com>2018-03-12 01:14:12 -0300
commit7a27990faa557c5c93f52e5cb082d551ad119ed0 (patch)
treea0800fded014a4a6afe738e5a65a17bc78cf0c19 /Ryujinx.Graphics
parent3aaa4717b6f7400bac862e589a1f345e70e78d56 (diff)
Allow more than one process, free resources on process dispose, implement SvcExitThread
Diffstat (limited to 'Ryujinx.Graphics')
-rw-r--r--Ryujinx.Graphics/Gal/IGalRenderer.cs1
-rw-r--r--Ryujinx.Graphics/Gal/OpenGL/FrameBuffer.cs32
-rw-r--r--Ryujinx.Graphics/Gal/OpenGL/OpenGLRenderer.cs5
3 files changed, 31 insertions, 7 deletions
diff --git a/Ryujinx.Graphics/Gal/IGalRenderer.cs b/Ryujinx.Graphics/Gal/IGalRenderer.cs
index 83d2c699..aa4eac4e 100644
--- a/Ryujinx.Graphics/Gal/IGalRenderer.cs
+++ b/Ryujinx.Graphics/Gal/IGalRenderer.cs
@@ -8,6 +8,7 @@ namespace Ryujinx.Graphics.Gal
void RunActions();
void InitializeFrameBuffer();
+ void ResetFrameBuffer();
void Render();
void SetWindowSize(int Width, int Height);
void SetFrameBuffer(
diff --git a/Ryujinx.Graphics/Gal/OpenGL/FrameBuffer.cs b/Ryujinx.Graphics/Gal/OpenGL/FrameBuffer.cs
index 7dc4bffe..b761811f 100644
--- a/Ryujinx.Graphics/Gal/OpenGL/FrameBuffer.cs
+++ b/Ryujinx.Graphics/Gal/OpenGL/FrameBuffer.cs
@@ -24,6 +24,8 @@ namespace Ryujinx.Graphics.Gal.OpenGL
private byte* FbPtr;
+ private object FbPtrLock;
+
public FrameBuffer(int Width, int Height)
{
if (Width < 0)
@@ -36,6 +38,8 @@ namespace Ryujinx.Graphics.Gal.OpenGL
throw new ArgumentOutOfRangeException(nameof(Height));
}
+ FbPtrLock = new object();
+
TexWidth = Width;
TexHeight = Height;
@@ -152,7 +156,10 @@ namespace Ryujinx.Graphics.Gal.OpenGL
throw new ArgumentOutOfRangeException(nameof(Height));
}
- FbPtr = Fb;
+ lock (FbPtrLock)
+ {
+ FbPtr = Fb;
+ }
if (Width != TexWidth ||
Height != TexHeight)
@@ -178,17 +185,28 @@ namespace Ryujinx.Graphics.Gal.OpenGL
GL.Uniform2(OffsetUniformLocation, Offs);
}
- public void Render()
+ public void Reset()
{
- if (FbPtr == null)
+ lock (FbPtrLock)
{
- return;
+ FbPtr = null;
}
+ }
- for (int Y = 0; Y < TexHeight; Y++)
- for (int X = 0; X < TexWidth; X++)
+ public void Render()
+ {
+ lock (FbPtrLock)
{
- Pixels[X + Y * TexWidth] = *((int*)(FbPtr + GetSwizzleOffset(X, Y)));
+ if (FbPtr == null)
+ {
+ return;
+ }
+
+ for (int Y = 0; Y < TexHeight; Y++)
+ for (int X = 0; X < TexWidth; X++)
+ {
+ Pixels[X + Y * TexWidth] = *((int*)(FbPtr + GetSwizzleOffset(X, Y)));
+ }
}
GL.BindTexture(TextureTarget.Texture2D, TexHandle);
diff --git a/Ryujinx.Graphics/Gal/OpenGL/OpenGLRenderer.cs b/Ryujinx.Graphics/Gal/OpenGL/OpenGLRenderer.cs
index bdedfc1a..002e54da 100644
--- a/Ryujinx.Graphics/Gal/OpenGL/OpenGLRenderer.cs
+++ b/Ryujinx.Graphics/Gal/OpenGL/OpenGLRenderer.cs
@@ -43,6 +43,11 @@ namespace Ryujinx.Graphics.Gal.OpenGL
FbRenderer = new FrameBuffer(1280, 720);
}
+ public void ResetFrameBuffer()
+ {
+ FbRenderer.Reset();
+ }
+
public void QueueAction(Action ActionMthd)
{
ActionsQueue.Enqueue(ActionMthd);