mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-13 03:29:49 +00:00
LibWeb: Implement GLES2 context creation
For now only macOS is supported. IOSurface is used as a backing store because it will allow us to read it from Skia and write to it from OpenGL without any extra copying: - ANGLE_metal_texture_client_buffer extension is used to create EGLSurface from IOSurface. - Then the same IOSurface is wrapped into Metal texture and passed to Skia allowing to share the same memory between Skia Metal backend and ANGLE.
This commit is contained in:
parent
d133b0aded
commit
38488b9ef3
Notes:
github-actions[bot]
2024-12-03 22:37:28 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 38488b9ef3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2688
Reviewed-by: https://github.com/ADKaster ✅
5 changed files with 223 additions and 19 deletions
|
@ -6,19 +6,34 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibWeb/WebGL/Types.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibGfx/Size.h>
|
||||
|
||||
namespace Web::WebGL {
|
||||
|
||||
class OpenGLContext {
|
||||
public:
|
||||
static OwnPtr<OpenGLContext> create();
|
||||
static OwnPtr<OpenGLContext> create(NonnullRefPtr<Gfx::SkiaBackendContext>);
|
||||
|
||||
virtual void present() = 0;
|
||||
void clear_buffer_to_default_values();
|
||||
void allocate_painting_surface_if_needed();
|
||||
|
||||
virtual ~OpenGLContext() { }
|
||||
struct Impl;
|
||||
OpenGLContext(NonnullRefPtr<Gfx::SkiaBackendContext>, Impl);
|
||||
|
||||
~OpenGLContext();
|
||||
|
||||
void make_current();
|
||||
|
||||
void set_size(Gfx::IntSize const&);
|
||||
|
||||
RefPtr<Gfx::PaintingSurface> surface();
|
||||
|
||||
private:
|
||||
NonnullRefPtr<Gfx::SkiaBackendContext> m_skia_backend_context;
|
||||
Gfx::IntSize m_size;
|
||||
RefPtr<Gfx::PaintingSurface> m_painting_surface;
|
||||
NonnullOwnPtr<Impl> m_impl;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue