|
|
@@ -90,6 +90,8 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|
|
|
|
|
private int CopyPBO;
|
|
|
|
|
|
+ public bool FramebufferSrgb { get; set; }
|
|
|
+
|
|
|
public OGLRenderTarget(OGLTexture Texture)
|
|
|
{
|
|
|
Attachments = new FrameBufferAttachments();
|
|
|
@@ -363,11 +365,24 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|
|
|
|
|
GL.Clear(ClearBufferMask.ColorBufferBit);
|
|
|
|
|
|
+ GL.Disable(EnableCap.FramebufferSrgb);
|
|
|
+
|
|
|
GL.BlitFramebuffer(
|
|
|
- SrcX0, SrcY0, SrcX1, SrcY1,
|
|
|
- DstX0, DstY0, DstX1, DstY1,
|
|
|
+ SrcX0,
|
|
|
+ SrcY0,
|
|
|
+ SrcX1,
|
|
|
+ SrcY1,
|
|
|
+ DstX0,
|
|
|
+ DstY0,
|
|
|
+ DstX1,
|
|
|
+ DstY1,
|
|
|
ClearBufferMask.ColorBufferBit,
|
|
|
BlitFramebufferFilter.Linear);
|
|
|
+
|
|
|
+ if (FramebufferSrgb)
|
|
|
+ {
|
|
|
+ GL.Enable(EnableCap.FramebufferSrgb);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void Copy(
|
|
|
@@ -432,7 +447,9 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (NewImage.Format == OldImage.Format)
|
|
|
+ if (NewImage.Format == OldImage.Format &&
|
|
|
+ NewImage.Width == OldImage.Width &&
|
|
|
+ NewImage.Height == OldImage.Height)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
@@ -444,7 +461,11 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|
|
|
|
|
GL.BindBuffer(BufferTarget.PixelPackBuffer, CopyPBO);
|
|
|
|
|
|
- GL.BufferData(BufferTarget.PixelPackBuffer, Math.Max(ImageUtils.GetSize(OldImage), ImageUtils.GetSize(NewImage)), IntPtr.Zero, BufferUsageHint.StreamCopy);
|
|
|
+ //The buffer should be large enough to hold the largest texture.
|
|
|
+ int BufferSize = Math.Max(ImageUtils.GetSize(OldImage),
|
|
|
+ ImageUtils.GetSize(NewImage));
|
|
|
+
|
|
|
+ GL.BufferData(BufferTarget.PixelPackBuffer, BufferSize, IntPtr.Zero, BufferUsageHint.StreamCopy);
|
|
|
|
|
|
if (!Texture.TryGetImageHandler(Key, out ImageHandler CachedImage))
|
|
|
{
|
|
|
@@ -460,8 +481,12 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|
|
GL.BindBuffer(BufferTarget.PixelPackBuffer, 0);
|
|
|
GL.BindBuffer(BufferTarget.PixelUnpackBuffer, CopyPBO);
|
|
|
|
|
|
+ GL.PixelStore(PixelStoreParameter.UnpackRowLength, OldImage.Width);
|
|
|
+
|
|
|
Texture.Create(Key, ImageUtils.GetSize(NewImage), NewImage);
|
|
|
|
|
|
+ GL.PixelStore(PixelStoreParameter.UnpackRowLength, 0);
|
|
|
+
|
|
|
GL.BindBuffer(BufferTarget.PixelUnpackBuffer, 0);
|
|
|
}
|
|
|
|