Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 45661a5258636ca7d70e1c088943c84228965e03
https://github.com/WebKit/WebKit/commit/45661a5258636ca7d70e1c088943c84228965e03
Author: Roberto Rodriguez <[email protected]>
Date: 2026-02-10 (Tue, 10 Feb 2026)
Changed paths:
A LayoutTests/webgl/draw-framebuffer-state-sync-on-bind-expected.txt
A LayoutTests/webgl/draw-framebuffer-state-sync-on-bind.html
A
LayoutTests/webgl/read-framebuffer-attachment-preserves-draw-state-expected.txt
A LayoutTests/webgl/read-framebuffer-attachment-preserves-draw-state.html
M Source/WebCore/html/canvas/WebGLFramebuffer.cpp
M Source/WebCore/html/canvas/WebGLFramebuffer.h
M Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
Log Message:
-----------
[WebGL] Prevent READ_FRAMEBUFFER operations from corrupting DRAW_FRAMEBUFFER
state
https://bugs.webkit.org/show_bug.cgi?id=307316
rdar://169621664
Reviewed by Kimmo Kinnunen.
Calling framebufferTexture2D() on READ_FRAMEBUFFER was unexpectedly modifying
DRAW_FRAMEBUFFER state. The issue was that drawBuffersIfNecessary()
unconditionally
called glDrawBuffers(), which always targets DRAW_FRAMEBUFFER - so modifying one
framebuffer's attachments would corrupt whatever was bound to DRAW_FRAMEBUFFER.
Fix by deferring the glDrawBuffers() call: when attachments change while bound
to
READ_FRAMEBUFFER, record that sync is pending and apply it when the framebuffer
is
later bound for drawing. The fix handles both WebGL 2.0 (separate READ/DRAW
bindings)
and WebGL 1.0 with the WEBGL_draw_buffers extension (single FRAMEBUFFER
binding).
Tests: webgl/draw-framebuffer-state-sync-on-bind.html
webgl/read-framebuffer-attachment-preserves-draw-state.html
* LayoutTests/webgl/draw-framebuffer-state-sync-on-bind-expected.txt: Added.
* LayoutTests/webgl/draw-framebuffer-state-sync-on-bind.html: Added.
*
LayoutTests/webgl/read-framebuffer-attachment-preserves-draw-state-expected.txt:
Added.
* LayoutTests/webgl/read-framebuffer-attachment-preserves-draw-state.html:
Added.
* Source/WebCore/html/canvas/WebGLFramebuffer.cpp:
(WebCore::WebGLFramebuffer::isBoundForDrawing const):
(WebCore::WebGLFramebuffer::applyFilteredDrawBuffers):
(WebCore::WebGLFramebuffer::syncDrawBuffersState):
(WebCore::WebGLFramebuffer::drawBuffersIfNecessary):
* Source/WebCore/html/canvas/WebGLFramebuffer.h:
* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::setFramebuffer):
Canonical link: https://commits.webkit.org/307223@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications