mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-29 00:46:05 +00:00
[GPU] Avoid drawing the frame buffer with alpha blend enabled, use correct blend enable register, clear the buffer before drawing
This commit is contained in:
parent
bbcad307bd
commit
47100ec8c1
|
@ -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);
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ namespace Ryujinx.Graphics.Gpu
|
|||
private void SetAlphaBlending()
|
||||
{
|
||||
//TODO: Support independent blend properly.
|
||||
bool Enable = (ReadRegister(NvGpuEngine3dReg.IBlendEnable) & 1) != 0;
|
||||
bool Enable = (ReadRegister(NvGpuEngine3dReg.IBlendNEnable) & 1) != 0;
|
||||
|
||||
Gpu.Renderer.SetBlendEnable(Enable);
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace Ryujinx.Graphics.Gpu
|
|||
BlendFuncSrcAlpha = 0x4d4,
|
||||
BlendFuncDstAlpha = 0x4d6,
|
||||
BlendEnableMaster = 0x4d7,
|
||||
IBlendNEnable = 0x4d8,
|
||||
VertexArrayElemBase = 0x50d,
|
||||
TexHeaderPoolOffset = 0x55d,
|
||||
TexSamplerPoolOffset = 0x557,
|
||||
|
|
Loading…
Reference in a new issue