diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-11-28 21:09:44 -0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-28 21:09:44 -0200 |
| commit | 59964f667c38d9d0550a3b5ef3970433493f4991 (patch) | |
| tree | 92f5545ee7f8ef0fa216f7d87f94963f6530a1a7 /Ryujinx.Graphics/Gal/OpenGL/OGLRenderTarget.cs | |
| parent | 00579927e43bf55ee06ae02933c1e755fb4120eb (diff) | |
Add support for bigger UBOs, fix sRGB regression, small improvement t… (#503)
* Add support for bigger UBOs, fix sRGB regression, small improvement to the 2D copy engine
* Break into multiple lines
* Read fractions for source/step values on the 2d copy engine aswell
* Use fixed point math for more speed
* Fix reinterpret when texture sizes are different
Diffstat (limited to 'Ryujinx.Graphics/Gal/OpenGL/OGLRenderTarget.cs')
| -rw-r--r-- | Ryujinx.Graphics/Gal/OpenGL/OGLRenderTarget.cs | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLRenderTarget.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLRenderTarget.cs index 8d04f1aa..ce5364e1 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OGLRenderTarget.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OGLRenderTarget.cs @@ -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); } |
