Browse Source

Do not write alpha to the main framebuffer when performing antialiasing.

This allows correct background display when the main framebuffer has alpha.
Noticeable on Wayland with Mesa 24.0.2 Iris driver.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17341
newinvert
Alex Shvartzkop 2 years ago
parent
commit
bf6ff5b805
  1. 8
      common/gal/opengl/antialiasing.cpp
  2. 2
      common/gal/opengl/opengl_compositor.cpp

8
common/gal/opengl/antialiasing.cpp

@ -185,7 +185,11 @@ void ANTIALIASING_SUPERSAMPLING::Present()
glBindTexture( GL_TEXTURE_2D, compositor->GetBufferTexture( ssaaMainBuffer ) );
compositor->SetBuffer( OPENGL_COMPOSITOR::DIRECT_RENDERING );
glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE );
draw_fullscreen_primitive();
glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
}
@ -547,7 +551,11 @@ void ANTIALIASING_SMAA::Present()
glActiveTexture( GL_TEXTURE1 );
glBindTexture( GL_TEXTURE_2D, blendTex );
glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE );
pass_3_shader->Use();
draw_fullscreen_triangle();
pass_3_shader->Deactivate();
glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
}

2
common/gal/opengl/opengl_compositor.cpp

@ -297,7 +297,7 @@ void OPENGL_COMPOSITOR::ClearBuffer( const COLOR4D& aColor )
{
wxASSERT( m_initialized );
glClearColor( aColor.r, aColor.g, aColor.b, 0.0f );
glClearColor( aColor.r, aColor.g, aColor.b, m_curFbo == DIRECT_RENDERING ? 1.0f : 0.0f );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
}

Loading…
Cancel
Save