mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-22 02:09:24 +00:00
LibCore+LibWeb: Use Metal backend for Skia painter on macOS
If Metal context and IOSurface are available, Skia painter will use Ganesh GPU backend on macOS, which is noticeably faster than the default CPU backend. Painting pipeline: 1. (WebContent) Allocate IOSurface for backing store 2. (WebContent) Allocate MTLTexture that wraps IOSurface 3. (WebContent) Paint into MTLTexture using Skia 4. (Browser) Wrap IOSurface into Gfx::Painter and use QPainter/CoreGraphics to blit backing store into viewport. Things we should improve in the future: 1. Upload textures for images in advance instead of doing that before every repaint. 2. Teach AppKit client to read directly from IOSurface instead of copying.
This commit is contained in:
parent
8de9516272
commit
79acb998e1
Notes:
sideshowbarker
2024-07-16 20:05:14 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 79acb998e1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/294
10 changed files with 288 additions and 21 deletions
|
@ -12,8 +12,13 @@
|
|||
#include <LibWeb/HTML/SessionHistoryTraversalQueue.h>
|
||||
#include <LibWeb/HTML/VisibilityState.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
#include <LibWeb/Painting/DisplayListPlayerSkia.h>
|
||||
#include <WebContent/BackingStoreManager.h>
|
||||
|
||||
#ifdef AK_OS_MACOS
|
||||
# include <LibCore/MetalContext.h>
|
||||
#endif
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/document-sequences.html#traversable-navigable
|
||||
|
@ -124,6 +129,11 @@ private:
|
|||
JS::NonnullGCPtr<SessionHistoryTraversalQueue> m_session_history_traversal_queue;
|
||||
|
||||
String m_window_handle;
|
||||
|
||||
#ifdef AK_OS_MACOS
|
||||
OwnPtr<Web::Painting::SkiaBackendContext> m_skia_backend_context;
|
||||
OwnPtr<Core::MetalContext> m_metal_context;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct BrowsingContextAndDocument {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue