LibWeb: Implement WebGL extension OES_standard_derivatives

This commit is contained in:
Undefine 2025-11-05 21:38:41 +01:00 committed by Andreas Kling
parent 2bf35881f9
commit d4ac9fc5c6
Notes: github-actions[bot] 2025-11-06 18:04:25 +00:00
12 changed files with 115 additions and 2 deletions

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2025, Undefine <undefine@undefine.pl>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibJS/Runtime/Realm.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/Bindings/OESStandardDerivativesPrototype.h>
#include <LibWeb/WebGL/Extensions/OESStandardDerivatives.h>
#include <LibWeb/WebGL/OpenGLContext.h>
#include <LibWeb/WebGL/WebGLRenderingContext.h>
namespace Web::WebGL::Extensions {
GC_DEFINE_ALLOCATOR(OESStandardDerivatives);
JS::ThrowCompletionOr<GC::Ptr<OESStandardDerivatives>> OESStandardDerivatives::create(JS::Realm& realm, GC::Ref<WebGLRenderingContext> context)
{
return realm.create<OESStandardDerivatives>(realm, context);
}
OESStandardDerivatives::OESStandardDerivatives(JS::Realm& realm, GC::Ref<WebGLRenderingContext> context)
: PlatformObject(realm)
, m_context(context)
{
m_context->context().request_extension("GL_OES_standard_derivatives");
}
void OESStandardDerivatives::initialize(JS::Realm& realm)
{
WEB_SET_PROTOTYPE_FOR_INTERFACE(OESStandardDerivatives);
Base::initialize(realm);
}
void OESStandardDerivatives::visit_edges(Visitor& visitor)
{
Base::visit_edges(visitor);
visitor.visit(m_context);
}
}