2024-11-13 09:59:10 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
2024-11-30 16:53:52 +01:00
|
|
|
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
2025-01-09 17:20:59 +00:00
|
|
|
* Copyright (c) 2024-2025, Luke Wilde <luke@ladybird.org>
|
2024-11-13 09:59:10 +01:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
2024-11-30 16:53:52 +01:00
|
|
|
#include <LibJS/Runtime/Realm.h>
|
2024-12-05 15:13:02 +00:00
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
2024-11-13 09:59:10 +01:00
|
|
|
#include <LibWeb/Bindings/WebGLProgramPrototype.h>
|
|
|
|
#include <LibWeb/WebGL/WebGLProgram.h>
|
2025-01-09 17:20:59 +00:00
|
|
|
#include <LibWeb/WebGL/WebGLShader.h>
|
2024-11-13 09:59:10 +01:00
|
|
|
|
|
|
|
namespace Web::WebGL {
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DEFINE_ALLOCATOR(WebGLProgram);
|
2024-11-13 09:59:10 +01:00
|
|
|
|
2024-12-17 06:15:53 +01:00
|
|
|
GC::Ref<WebGLProgram> WebGLProgram::create(JS::Realm& realm, WebGLRenderingContextBase& context, GLuint handle)
|
2024-11-30 16:53:52 +01:00
|
|
|
{
|
2024-12-17 06:15:53 +01:00
|
|
|
return realm.create<WebGLProgram>(realm, context, handle);
|
2024-11-30 16:53:52 +01:00
|
|
|
}
|
|
|
|
|
2024-12-17 06:15:53 +01:00
|
|
|
WebGLProgram::WebGLProgram(JS::Realm& realm, WebGLRenderingContextBase& context, GLuint handle)
|
|
|
|
: WebGLObject(realm, context, handle)
|
2024-11-13 09:59:10 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
WebGLProgram::~WebGLProgram() = default;
|
|
|
|
|
2024-12-05 15:13:02 +00:00
|
|
|
void WebGLProgram::initialize(JS::Realm& realm)
|
|
|
|
{
|
|
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(WebGLProgram);
|
2025-04-20 16:22:57 +02:00
|
|
|
Base::initialize(realm);
|
2024-12-05 15:13:02 +00:00
|
|
|
}
|
|
|
|
|
2025-01-09 17:20:59 +00:00
|
|
|
void WebGLProgram::visit_edges(Cell::Visitor& visitor)
|
|
|
|
{
|
|
|
|
Base::visit_edges(visitor);
|
|
|
|
visitor.visit(m_attached_vertex_shader);
|
|
|
|
visitor.visit(m_attached_fragment_shader);
|
|
|
|
}
|
|
|
|
|
2024-11-13 09:59:10 +01:00
|
|
|
}
|