LibWeb/WebGL2: Check if WebGLSync object belongs to the current context

This commit is contained in:
Luke Wilde 2025-10-20 20:57:06 +01:00 committed by Jelle Raaijmakers
parent 3d2874bc4e
commit 3005cc30b4
Notes: github-actions[bot] 2025-10-21 21:33:59 +00:00
4 changed files with 47 additions and 5 deletions

View file

@ -9,6 +9,8 @@
#include <LibWeb/Bindings/WebGLSyncPrototype.h>
#include <LibWeb/WebGL/WebGLSync.h>
#include <GLES2/gl2.h>
namespace Web::WebGL {
GC_DEFINE_ALLOCATOR(WebGLSync);
@ -32,4 +34,11 @@ void WebGLSync::initialize(JS::Realm& realm)
Base::initialize(realm);
}
ErrorOr<GLsyncInternal> WebGLSync::sync_handle(WebGLRenderingContextBase const* context) const
{
if (context == m_context)
return m_sync_handle;
return Error::from_errno(GL_INVALID_OPERATION);
}
}