Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fd8dfbafeb2edf271522def5bcc56ce2cf639ffe
      
https://github.com/WebKit/WebKit/commit/fd8dfbafeb2edf271522def5bcc56ce2cf639ffe
  Author: Nikolas Zimmermann <[email protected]>
  Date:   2026-03-30 (Mon, 30 Mar 2026)

  Changed paths:
    M Source/WebCore/platform/graphics/texmap/BitmapTexture.cpp

  Log Message:
  -----------
  [GTK][WPE] Fix GL state restoration bugs in BitmapTexture
https://bugs.webkit.org/show_bug.cgi?id=311086

Reviewed by Miguel Gomez.

Various BitmapTexture methods induced side-effects to the GL state.
In certain cases that lead to a mismatch between the GL state assumed
by Skia and the actual GL state leading to rendering artifacts, at least
for some GPU drivers/configurations.

1. copyFromExternalTexture(): Texture binding was saved from the original
   active texture unit but restored to GL_TEXTURE0 (wrong unit).
   -> Save/restore both units correctly, restore active unit before
      restoring its texture binding.

2. BitmapTexture(size, flags) constructor: The GBM/dma-buf early-return path
   called createTexture() which binds the new texture, then returned without
   restoring the previous texture binding.
   -> Move the binding save before the GBM block and restore on early return.

3. swapTexture(): After swapping m_flags between two textures,
   m_renderTarget/m_binding were not recalculated for either texture.
   If the ExternalOESRenderTarget flag differed between the two textures,
   subsequent GL operations would use the wrong texture target/binding
   query. Not something I could reproduce, but worhth fixing nontheless.
   -> Call determineRenderTargetAndBinding() on both textures after the swap.

4. updateContents(data): Redundant glBindTexture(m_renderTarget, m_id) call
   before the subimage buffer preparation - the same bind is done again
   after preparation -- fix that.

Covered by existing tests.

Canonical link: https://commits.webkit.org/310220@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to