mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-06 08:10:02 +00:00
LibWeb: Increase SkSurface's generation id when it's modified by WebGL
Skia is not aware of surface modifications done by WebGL, so we need to manually increase generation id whenver WebGL invokes a writing function.
This commit is contained in:
parent
e2e54dccc3
commit
46cbbda944
Notes:
github-actions[bot]
2024-12-03 22:37:09 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 46cbbda944
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2688
Reviewed-by: https://github.com/ADKaster ✅
5 changed files with 17 additions and 0 deletions
|
@ -114,6 +114,11 @@ SkSurface& PaintingSurface::sk_surface() const
|
||||||
return *m_impl->surface;
|
return *m_impl->surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PaintingSurface::notify_content_will_change()
|
||||||
|
{
|
||||||
|
m_impl->surface->notifyContentWillChange(SkSurface::kDiscard_ContentChangeMode);
|
||||||
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
sk_sp<SkImage> PaintingSurface::sk_image_snapshot() const
|
sk_sp<SkImage> PaintingSurface::sk_image_snapshot() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,6 +34,8 @@ public:
|
||||||
void read_into_bitmap(Bitmap&);
|
void read_into_bitmap(Bitmap&);
|
||||||
void write_from_bitmap(Bitmap&);
|
void write_from_bitmap(Bitmap&);
|
||||||
|
|
||||||
|
void notify_content_will_change();
|
||||||
|
|
||||||
IntSize size() const;
|
IntSize size() const;
|
||||||
IntRect rect() const;
|
IntRect rect() const;
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,11 @@ OwnPtr<OpenGLContext> OpenGLContext::create(NonnullRefPtr<Gfx::SkiaBackendContex
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OpenGLContext::notify_content_will_change()
|
||||||
|
{
|
||||||
|
m_painting_surface->notify_content_will_change();
|
||||||
|
}
|
||||||
|
|
||||||
void OpenGLContext::clear_buffer_to_default_values()
|
void OpenGLContext::clear_buffer_to_default_values()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ class OpenGLContext {
|
||||||
public:
|
public:
|
||||||
static OwnPtr<OpenGLContext> create(NonnullRefPtr<Gfx::SkiaBackendContext>);
|
static OwnPtr<OpenGLContext> create(NonnullRefPtr<Gfx::SkiaBackendContext>);
|
||||||
|
|
||||||
|
void notify_content_will_change();
|
||||||
void clear_buffer_to_default_values();
|
void clear_buffer_to_default_values();
|
||||||
void allocate_painting_surface_if_needed();
|
void allocate_painting_surface_if_needed();
|
||||||
|
|
||||||
|
|
|
@ -205,6 +205,10 @@ public:
|
||||||
m_context->make_current();
|
m_context->make_current();
|
||||||
)~~~");
|
)~~~");
|
||||||
|
|
||||||
|
if (gl_function_modifies_framebuffer(function.name)) {
|
||||||
|
function_impl_generator.append(" m_context->notify_content_will_change();\n"sv);
|
||||||
|
}
|
||||||
|
|
||||||
Vector<ByteString> gl_call_arguments;
|
Vector<ByteString> gl_call_arguments;
|
||||||
for (size_t i = 0; i < function.parameters.size(); ++i) {
|
for (size_t i = 0; i < function.parameters.size(); ++i) {
|
||||||
auto const& parameter = function.parameters[i];
|
auto const& parameter = function.parameters[i];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue