Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 29f6e01b9654f5fe2b32b229a24be11710641005
https://github.com/WebKit/WebKit/commit/29f6e01b9654f5fe2b32b229a24be11710641005
Author: Kimmo Kinnunen <[email protected]>
Date: 2026-10-10 (Sat, 10 Oct 2026)
Changed paths:
M Source/ThirdParty/ANGLE/src/libANGLE/Framebuffer.cpp
M Source/ThirdParty/ANGLE/src/libANGLE/FramebufferAttachment.cpp
M Source/ThirdParty/ANGLE/src/libANGLE/FramebufferAttachment.h
M Source/ThirdParty/ANGLE/src/tests/gl_tests/RobustResourceInitTest.cpp
Log Message:
-----------
ANGLE: Full clears of renderbuffers are treated as partial clears under in
WebGL
https://bugs.webkit.org/show_bug.cgi?id=326798
rdar://189506198
Reviewed by Mike Wyrzykowski.
With robust resource initialization, ANGLE
skips zero-filling an uninitialized attachment when a clear overwrites
it completely. Every clear of an uninitialized renderbuffer was instead
treated as a partial clear, so ANGLE first zero-filled every attachment
that needed initialization and then performed the clear. This includes
the full clear that WebGLDefaultFramebuffer::reshape() issues right
after allocating the drawing buffer. On Metal the zero-fill of a color
renderbuffer is done from the CPU, one replaceRegion() call per row.
The bug is in gl::Framebuffer::partialClearNeedsInit():
if (depth && mState.mDepthAttachment.hasLayer())
{
*needsInitOut = true;
return angle::Result::Continue;
}
if (stencil && mState.mStencilAttachment.hasLayer())
...
if (mState.mColorAttachments[colorIndex].hasLayer())
FramebufferAttachment::hasLayer() returned ImageIndex::hasLayer(), which
is mLayerIndex != kEntireLevel. Renderbuffer and default framebuffer
attachments use a default-constructed ImageIndex, whose layer index is
0, so hasLayer() was true for every renderbuffer. It was also true for
cube map faces, whose layer index is the face index.
The check came from upstream ANGLE commit
2c0fcdce8c915937764f57c70a30c5e07432645a "Fix robust init vs arrayed
textures vs glClear" (crbug.com/492131521), imported in 8153a3994db5
"Update ANGLE to 2026-03-30 (c5641af1a29a5569f096baba2675e2290865ad14)".
It is meant for single layers of 3D and array textures, because
gl::Texture tracks initialization per mip level and cannot record that
only one layer was cleared.
Rename FramebufferAttachment::hasLayer() to has3DLayer() and make it
return true only for texture attachments whose index is a 3D layer,
using ImageIndex::has3DLayer(). Cube map faces are excluded as well:
gl::Texture tracks initialization per face, so a full clear of a face
can mark just that face initialized. The new name matches the ImageIndex
function it uses, so it no longer reads as ImageIndex::hasLayer(), which
is true for cube map faces.
Speeds up large WebGL default framebuffer creation considerably.
Tests: RobustResourceInitTest.CubeMapFaceCleared
RobustResourceInitTest.RenderbufferColorClearWithDepthInit
* Source/ThirdParty/ANGLE/src/libANGLE/Framebuffer.cpp:
(gl::Framebuffer::partialClearNeedsInit):
* Source/ThirdParty/ANGLE/src/libANGLE/FramebufferAttachment.cpp:
(gl::FramebufferAttachment::has3DLayer const):
(gl::FramebufferAttachment::hasLayer const): Deleted.
* Source/ThirdParty/ANGLE/src/libANGLE/FramebufferAttachment.h:
* Source/ThirdParty/ANGLE/src/tests/gl_tests/RobustResourceInitTest.cpp:
(TEST_P):
Canonical link: https://commits.webkit.org/323300@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications