mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
Previously, the LibWeb bindings generator would output multiple per interface files like Prototype/Constructor/Namespace/GlobalMixin depending on the contents of that IDL file. This complicates the build system as it means that it does not know what files will be generated without knowledge of the contents of that IDL file. Instead, for each IDL file only generate a single Bindings/<IDLFile>.h and Bindings/<IDLFile>.cpp.
64 lines
1.8 KiB
C++
64 lines
1.8 KiB
C++
/*
|
|
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibJS/Runtime/Realm.h>
|
|
#include <LibWeb/Bindings/ANGLEInstancedArrays.h>
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
|
#include <LibWeb/WebGL/Extensions/ANGLEInstancedArrays.h>
|
|
#include <LibWeb/WebGL/OpenGLContext.h>
|
|
#include <LibWeb/WebGL/WebGLRenderingContextBase.h>
|
|
|
|
#define GL_GLEXT_PROTOTYPES 1
|
|
#include <GLES2/gl2.h>
|
|
#include <GLES2/gl2ext.h>
|
|
|
|
namespace Web::WebGL::Extensions {
|
|
|
|
GC_DEFINE_ALLOCATOR(ANGLEInstancedArrays);
|
|
|
|
JS::ThrowCompletionOr<GC::Ref<JS::Object>> ANGLEInstancedArrays::create(JS::Realm& realm, GC::Ref<WebGLRenderingContextBase> context)
|
|
{
|
|
return realm.create<ANGLEInstancedArrays>(realm, context);
|
|
}
|
|
|
|
ANGLEInstancedArrays::ANGLEInstancedArrays(JS::Realm& realm, GC::Ref<WebGLRenderingContextBase> context)
|
|
: PlatformObject(realm)
|
|
, m_context(context)
|
|
{
|
|
}
|
|
|
|
void ANGLEInstancedArrays::vertex_attrib_divisor_angle(GLuint index, GLuint divisor)
|
|
{
|
|
m_context->context().make_current();
|
|
glVertexAttribDivisorANGLE(index, divisor);
|
|
}
|
|
|
|
void ANGLEInstancedArrays::draw_arrays_instanced_angle(GLenum mode, GLint first, GLsizei count, GLsizei primcount)
|
|
{
|
|
m_context->context().make_current();
|
|
glDrawArraysInstancedANGLE(mode, first, count, primcount);
|
|
}
|
|
|
|
void ANGLEInstancedArrays::draw_elements_instanced_angle(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei primcount)
|
|
{
|
|
m_context->context().make_current();
|
|
glDrawElementsInstancedANGLE(mode, count, type, reinterpret_cast<void*>(offset), primcount);
|
|
}
|
|
|
|
void ANGLEInstancedArrays::initialize(JS::Realm& realm)
|
|
{
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(ANGLEInstancedArrays);
|
|
Base::initialize(realm);
|
|
}
|
|
|
|
void ANGLEInstancedArrays::visit_edges(Visitor& visitor)
|
|
{
|
|
Base::visit_edges(visitor);
|
|
visitor.visit(m_context);
|
|
}
|
|
|
|
}
|