aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/Gal/OpenGL/FrameBuffer.cs
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/Gal/OpenGL/FrameBuffer.cs
parent3aaa4717b6f7400bac862e589a1f345e70e78d56 (diff)
Allow more than one process, free resources on process dispose, implement SvcExitThread
Diffstat (limited to 'Ryujinx.Graphics/Gal/OpenGL/FrameBuffer.cs')
-rw-r--r--Ryujinx.Graphics/Gal/OpenGL/FrameBuffer.cs32
1 files changed, 25 insertions, 7 deletions
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);