diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2018-04-13 22:42:55 -0300 |
|---|---|---|
| committer | gdkchan <gab.dark.100@gmail.com> | 2018-04-13 22:42:55 -0300 |
| commit | 47100ec8c1b3cabc7d53654163c1dd30b58d483d (patch) | |
| tree | 5b28448fd48438d78fb0a07d3ac5a914b82b8f69 /Ryujinx.Graphics/Gal/OpenGL/OGLFrameBuffer.cs | |
| parent | bbcad307bdb8edca121ef6e3d2b13196fdd96a2d (diff) | |
[GPU] Avoid drawing the frame buffer with alpha blend enabled, use correct blend enable register, clear the buffer before drawing
Diffstat (limited to 'Ryujinx.Graphics/Gal/OpenGL/OGLFrameBuffer.cs')
| -rw-r--r-- | Ryujinx.Graphics/Gal/OpenGL/OGLFrameBuffer.cs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/Ryujinx.Graphics/Gal/OpenGL/OGLFrameBuffer.cs b/Ryujinx.Graphics/Gal/OpenGL/OGLFrameBuffer.cs index 818af3b3..cca61e18 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OGLFrameBuffer.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OGLFrameBuffer.cs @@ -184,6 +184,10 @@ namespace Ryujinx.Graphics.Gal.OpenGL { EnsureInitialized(); + bool AlphaBlendEnable = GL.GetInteger(GetPName.Blend) != 0; + + GL.Disable(EnableCap.Blend); + GL.ActiveTexture(TextureUnit.Texture0); GL.BindTexture(TextureTarget.Texture2D, CurrTexHandle); @@ -192,6 +196,10 @@ namespace Ryujinx.Graphics.Gal.OpenGL GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0); + GL.Clear( + ClearBufferMask.ColorBufferBit | + ClearBufferMask.DepthBufferBit); + GL.BindVertexArray(VaoHandle); GL.UseProgram(Shader.Handle); @@ -202,6 +210,11 @@ namespace Ryujinx.Graphics.Gal.OpenGL GL.BindFramebuffer(FramebufferTarget.Framebuffer, CurrFbHandle); GL.UseProgram(CurrentProgram); + + if (AlphaBlendEnable) + { + GL.Enable(EnableCap.Blend); + } } } @@ -289,9 +302,11 @@ namespace Ryujinx.Graphics.Gal.OpenGL { GL.BindTexture(TextureTarget.Texture2D, Handle); - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear); + const int MinFilter = (int)TextureMinFilter.Linear; + const int MagFilter = (int)TextureMagFilter.Linear; - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear); + GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, MinFilter); + GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, MagFilter); (PixelFormat Format, PixelType Type) = OGLEnumConverter.GetTextureFormat(GalTextureFormat.A8B8G8R8); |
