Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 174d4885ac9e5be47c68de22fbd7987f1e6ba21e
https://github.com/WebKit/WebKit/commit/174d4885ac9e5be47c68de22fbd7987f1e6ba21e
Author: Nikolas Zimmermann <[email protected]>
Date: 2026-07-15 (Wed, 15 Jul 2026)
Changed paths:
M Source/WebCore/platform/Skia.cmake
M Source/WebCore/platform/graphics/skia/SkiaBackingStore.cpp
M Source/WebCore/platform/graphics/skia/SkiaBackingStore.h
M Source/WebCore/platform/graphics/skia/SkiaCompositingLayer.cpp
M Source/WebCore/platform/graphics/skia/SkiaCompositingLayer.h
M
Source/WebCore/platform/graphics/skia/SkiaCompositingLayerImageSetBatch.cpp
M Source/WebCore/platform/graphics/skia/SkiaCompositingLayerImageSetBatch.h
A Source/WebCore/platform/graphics/skia/SkiaDamageRegion.h
Log Message:
-----------
[Damage][Skia] Teach the tile and image draws to split themselves by damage
rect
https://bugs.webkit.org/show_bug.cgi?id=319472
Reviewed by Alejandro G. Castro.
Add SkiaDamageRegion, a frame's damage in device space, as the rects that a draw
is split by and as the same rects in a region, for the draws that have to clip
and
for culling. It is built once per frame, so no draw site rebuilds the region.
Teach the tile and image draws to restrict themselves to it. planDraw() says
how a
single draw is narrowed: skipped when nothing touches the damage, split into one
draw per damage rect it touches, or, when the transform is rotated or skewed and
rects cannot be narrowed, drawn under a device-space clip.
Splitting is deliberately uncapped, the sub-quads share a paint, so Skia batches
them into one op, while a clip of more than one rect cannot be a scissor and so
costs a stencil buffer or a mask texture and breaks batching. A full-viewport
layer
is touched by every rect in the frame, so a cap would send exactly the biggest
draws
down the expensive path - we want to avoid that.
Nothing passes a damage region yet, so every draw still paints in full.
* Source/WebCore/platform/Skia.cmake:
* Source/WebCore/platform/graphics/skia/SkiaBackingStore.cpp:
(WebCore::SkiaBackingStore::paintToCanvas):
(WebCore::SkiaBackingStore::appendImageSetEntries const):
(WebCore::SkiaBackingStore::buildImageSet const): Deleted.
* Source/WebCore/platform/graphics/skia/SkiaBackingStore.h:
(WebCore::SkiaBackingStore::size const):
* Source/WebCore/platform/graphics/skia/SkiaCompositingLayer.cpp:
(WebCore::SkiaCompositingLayer::paintContents):
(WebCore::SkiaCompositingLayer::collectFrameDamage):
(WebCore::SkiaCompositingLayer::paintDebugIndicators):
(WebCore::SkiaCompositingLayer::combinedTransform const):
* Source/WebCore/platform/graphics/skia/SkiaCompositingLayer.h:
* Source/WebCore/platform/graphics/skia/SkiaCompositingLayerImageSetBatch.cpp:
(WebCore::SkiaCompositingLayerImageSetBatch::samplingOptionsForImage const):
(WebCore::SkiaCompositingLayerImageSetBatch::matrixIndexForDraw):
(WebCore::SkiaCompositingLayerImageSetBatch::addImageSet):
(WebCore::SkiaCompositingLayerImageSetBatch::addImage):
(WebCore::SkiaCompositingLayerImageSetBatch::flushIfNeeded):
* Source/WebCore/platform/graphics/skia/SkiaCompositingLayerImageSetBatch.h:
(WebCore::SkiaCompositingLayerImageSetBatch::planRestrictedDraw):
* Source/WebCore/platform/graphics/skia/SkiaDamageRegion.h: Added.
(WebCore::SkiaDamageRegion::create):
(WebCore::SkiaDamageRegion::isEmpty const):
(WebCore::SkiaDamageRegion::intersects const):
(WebCore::SkiaDamageRegion::planDraw const):
(WebCore::SkiaDamageRegion::forEachDamagedSubRect const):
(WebCore::SkiaDamageRegion::clipCanvasInDeviceSpace const):
Canonical link: https://commits.webkit.org/317247@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications