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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2024-11-30 16:53:52 +01:00
|
|
|
#include <LibWeb/WebGL/Types.h>
|
2024-11-13 09:59:10 +01:00
|
|
|
#include <LibWeb/WebGL/WebGLObject.h>
|
|
|
|
|
|
|
|
namespace Web::WebGL {
|
|
|
|
|
|
|
|
class WebGLProgram final : public WebGLObject {
|
|
|
|
WEB_PLATFORM_OBJECT(WebGLProgram, WebGLObject);
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DECLARE_ALLOCATOR(WebGLProgram);
|
2024-11-13 09:59:10 +01:00
|
|
|
|
|
|
|
public:
|
2024-12-17 06:15:53 +01:00
|
|
|
static GC::Ref<WebGLProgram> create(JS::Realm& realm, WebGLRenderingContextBase&, GLuint handle);
|
2024-11-30 16:53:52 +01:00
|
|
|
|
2024-11-13 09:59:10 +01:00
|
|
|
virtual ~WebGLProgram();
|
|
|
|
|
2025-03-23 11:24:36 +00:00
|
|
|
GC::Ptr<WebGLShader> attached_vertex_shader() const { return m_attached_vertex_shader; }
|
2025-01-09 17:20:59 +00:00
|
|
|
void set_attached_vertex_shader(GC::Ptr<WebGLShader> shader) { m_attached_vertex_shader = shader; }
|
|
|
|
|
|
|
|
GC::Ptr<WebGLShader> attached_fragment_shader() const { return m_attached_fragment_shader; }
|
|
|
|
void set_attached_fragment_shader(GC::Ptr<WebGLShader> shader) { m_attached_fragment_shader = shader; }
|
|
|
|
|
2024-11-13 09:59:10 +01:00
|
|
|
protected:
|
2024-12-17 06:15:53 +01:00
|
|
|
explicit WebGLProgram(JS::Realm&, WebGLRenderingContextBase&, GLuint handle);
|
2024-12-05 15:13:02 +00:00
|
|
|
|
|
|
|
virtual void initialize(JS::Realm&) override;
|
2025-01-09 17:20:59 +00:00
|
|
|
virtual void visit_edges(JS::Cell::Visitor&) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
GC::Ptr<WebGLShader> m_attached_vertex_shader;
|
|
|
|
GC::Ptr<WebGLShader> m_attached_fragment_shader;
|
2024-11-13 09:59:10 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|