Skip to content

Commit

Permalink
GL3 renderer: Fix some blur artifacts observed on AMD and Intel GPUs
Browse files Browse the repository at this point in the history
  • Loading branch information
mikke89 committed Aug 21, 2024
1 parent 0907b97 commit 8ca8d30
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Backends/RmlUi_Renderer_GL3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1432,6 +1432,17 @@ void RenderInterface_GL3::RenderBlur(float sigma, const Gfx::FramebufferData& so
Gfx::BindTexture(source_destination);
glBindFramebuffer(GL_FRAMEBUFFER, temp.framebuffer);

// Add a 1px transparent border around the blur region by first clearing with a padded scissor. This helps prevent
// artifacts when upscaling the blur result in the later step. On Intel and AMD, we have observed that during
// blitting with linear filtering, pixels outside the 'src' region can be blended into the output. On the other
// hand, it looks like Nvidia clamps the pixels to the source edge, which is what we really want. Regardless, we
// work around the issue with this extra step.
Rml::Rectanglei padded_scissor = scissor;
padded_scissor.Extend(Rml::Vector2i(1));
SetScissor(padded_scissor, true);
glClear(GL_COLOR_BUFFER_BIT);
SetScissor(scissor, true);

SetTexelOffset({1.f, 0.f}, source_destination.width);
DrawFullscreenQuad();

Expand Down

0 comments on commit 8ca8d30

Please sign in to comment.