mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-23 02:31:55 +00:00
LibWeb/WebGL: Set prototypes of the WebGL objects
This commit is contained in:
parent
2e1702a14b
commit
a14cd5dab8
Notes:
github-actions[bot]
2024-12-05 20:42:31 +00:00
Author: https://github.com/Lubrsi
Commit: a14cd5dab8
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2791
Reviewed-by: https://github.com/gmta
Reviewed-by: https://github.com/shannonbooth
17 changed files with 120 additions and 27 deletions
|
@ -12,5 +12,6 @@
|
||||||
namespace Web::WebGL {
|
namespace Web::WebGL {
|
||||||
|
|
||||||
using GLenum = unsigned int;
|
using GLenum = unsigned int;
|
||||||
|
using GLuint = unsigned int;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||||
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||||
|
* Copyright (c) 2024, Luke Wilde <luke@ladybird.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <LibJS/Runtime/Realm.h>
|
#include <LibJS/Runtime/Realm.h>
|
||||||
|
#include <LibWeb/Bindings/Intrinsics.h>
|
||||||
#include <LibWeb/Bindings/WebGLBufferPrototype.h>
|
#include <LibWeb/Bindings/WebGLBufferPrototype.h>
|
||||||
#include <LibWeb/WebGL/WebGLBuffer.h>
|
#include <LibWeb/WebGL/WebGLBuffer.h>
|
||||||
|
|
||||||
|
@ -13,9 +15,9 @@ namespace Web::WebGL {
|
||||||
|
|
||||||
GC_DEFINE_ALLOCATOR(WebGLBuffer);
|
GC_DEFINE_ALLOCATOR(WebGLBuffer);
|
||||||
|
|
||||||
GC::Ptr<WebGLBuffer> WebGLBuffer::create(JS::Realm& realm, GLuint handle)
|
GC::Ref<WebGLBuffer> WebGLBuffer::create(JS::Realm& realm, GLuint handle)
|
||||||
{
|
{
|
||||||
return realm.heap().allocate<WebGLBuffer>(realm, handle);
|
return realm.create<WebGLBuffer>(realm, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebGLBuffer::WebGLBuffer(JS::Realm& realm, GLuint handle)
|
WebGLBuffer::WebGLBuffer(JS::Realm& realm, GLuint handle)
|
||||||
|
@ -25,4 +27,10 @@ WebGLBuffer::WebGLBuffer(JS::Realm& realm, GLuint handle)
|
||||||
|
|
||||||
WebGLBuffer::~WebGLBuffer() = default;
|
WebGLBuffer::~WebGLBuffer() = default;
|
||||||
|
|
||||||
|
void WebGLBuffer::initialize(JS::Realm& realm)
|
||||||
|
{
|
||||||
|
Base::initialize(realm);
|
||||||
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(WebGLBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||||
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||||
|
* Copyright (c) 2024, Luke Wilde <luke@ladybird.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -17,12 +18,14 @@ class WebGLBuffer final : public WebGLObject {
|
||||||
GC_DECLARE_ALLOCATOR(WebGLBuffer);
|
GC_DECLARE_ALLOCATOR(WebGLBuffer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static GC::Ptr<WebGLBuffer> create(JS::Realm& realm, GLuint handle);
|
static GC::Ref<WebGLBuffer> create(JS::Realm& realm, GLuint handle);
|
||||||
|
|
||||||
virtual ~WebGLBuffer();
|
virtual ~WebGLBuffer();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit WebGLBuffer(JS::Realm&, GLuint handle);
|
explicit WebGLBuffer(JS::Realm&, GLuint handle);
|
||||||
|
|
||||||
|
virtual void initialize(JS::Realm&) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||||
|
* Copyright (c) 2024, Luke Wilde <luke@ladybird.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <LibJS/Runtime/Realm.h>
|
#include <LibJS/Runtime/Realm.h>
|
||||||
|
#include <LibWeb/Bindings/Intrinsics.h>
|
||||||
#include <LibWeb/Bindings/WebGLFramebufferPrototype.h>
|
#include <LibWeb/Bindings/WebGLFramebufferPrototype.h>
|
||||||
#include <LibWeb/WebGL/WebGLFramebuffer.h>
|
#include <LibWeb/WebGL/WebGLFramebuffer.h>
|
||||||
|
|
||||||
|
@ -12,9 +14,9 @@ namespace Web::WebGL {
|
||||||
|
|
||||||
GC_DEFINE_ALLOCATOR(WebGLFramebuffer);
|
GC_DEFINE_ALLOCATOR(WebGLFramebuffer);
|
||||||
|
|
||||||
GC::Ptr<WebGLFramebuffer> WebGLFramebuffer::create(JS::Realm& realm, GLuint handle)
|
GC::Ref<WebGLFramebuffer> WebGLFramebuffer::create(JS::Realm& realm, GLuint handle)
|
||||||
{
|
{
|
||||||
return realm.heap().allocate<WebGLFramebuffer>(realm, handle);
|
return realm.create<WebGLFramebuffer>(realm, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebGLFramebuffer::WebGLFramebuffer(JS::Realm& realm, GLuint handle)
|
WebGLFramebuffer::WebGLFramebuffer(JS::Realm& realm, GLuint handle)
|
||||||
|
@ -24,4 +26,10 @@ WebGLFramebuffer::WebGLFramebuffer(JS::Realm& realm, GLuint handle)
|
||||||
|
|
||||||
WebGLFramebuffer::~WebGLFramebuffer() = default;
|
WebGLFramebuffer::~WebGLFramebuffer() = default;
|
||||||
|
|
||||||
|
void WebGLFramebuffer::initialize(JS::Realm& realm)
|
||||||
|
{
|
||||||
|
Base::initialize(realm);
|
||||||
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(WebGLFramebuffer);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||||
|
* Copyright (c) 2024, Luke Wilde <luke@ladybird.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -15,12 +16,14 @@ class WebGLFramebuffer final : public WebGLObject {
|
||||||
GC_DECLARE_ALLOCATOR(WebGLFramebuffer);
|
GC_DECLARE_ALLOCATOR(WebGLFramebuffer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static GC::Ptr<WebGLFramebuffer> create(JS::Realm& realm, GLuint handle);
|
static GC::Ref<WebGLFramebuffer> create(JS::Realm& realm, GLuint handle);
|
||||||
|
|
||||||
virtual ~WebGLFramebuffer();
|
virtual ~WebGLFramebuffer();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit WebGLFramebuffer(JS::Realm&, GLuint handle);
|
explicit WebGLFramebuffer(JS::Realm&, GLuint handle);
|
||||||
|
|
||||||
|
virtual void initialize(JS::Realm&) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||||
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||||
|
* Copyright (c) 2024, Luke Wilde <luke@ladybird.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <LibWeb/Bindings/Intrinsics.h>
|
||||||
|
#include <LibWeb/Bindings/WebGLObjectPrototype.h>
|
||||||
#include <LibWeb/WebGL/WebGLObject.h>
|
#include <LibWeb/WebGL/WebGLObject.h>
|
||||||
|
|
||||||
namespace Web::WebGL {
|
namespace Web::WebGL {
|
||||||
|
@ -17,4 +20,10 @@ WebGLObject::WebGLObject(JS::Realm& realm, GLuint handle)
|
||||||
|
|
||||||
WebGLObject::~WebGLObject() = default;
|
WebGLObject::~WebGLObject() = default;
|
||||||
|
|
||||||
|
void WebGLObject::initialize(JS::Realm& realm)
|
||||||
|
{
|
||||||
|
Base::initialize(realm);
|
||||||
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(WebGLObject);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||||
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||||
|
* Copyright (c) 2024, Luke Wilde <luke@ladybird.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -10,8 +11,6 @@
|
||||||
#include <LibWeb/Bindings/PlatformObject.h>
|
#include <LibWeb/Bindings/PlatformObject.h>
|
||||||
#include <LibWeb/WebGL/Types.h>
|
#include <LibWeb/WebGL/Types.h>
|
||||||
|
|
||||||
typedef unsigned int GLuint;
|
|
||||||
|
|
||||||
namespace Web::WebGL {
|
namespace Web::WebGL {
|
||||||
|
|
||||||
class WebGLObject : public Bindings::PlatformObject {
|
class WebGLObject : public Bindings::PlatformObject {
|
||||||
|
@ -28,6 +27,8 @@ public:
|
||||||
protected:
|
protected:
|
||||||
explicit WebGLObject(JS::Realm&, GLuint handle);
|
explicit WebGLObject(JS::Realm&, GLuint handle);
|
||||||
|
|
||||||
|
virtual void initialize(JS::Realm&) override;
|
||||||
|
|
||||||
bool invalidated() const { return m_invalidated; }
|
bool invalidated() const { return m_invalidated; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||||
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||||
|
* Copyright (c) 2024, Luke Wilde <luke@ladybird.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <LibJS/Runtime/Realm.h>
|
#include <LibJS/Runtime/Realm.h>
|
||||||
|
#include <LibWeb/Bindings/Intrinsics.h>
|
||||||
#include <LibWeb/Bindings/WebGLProgramPrototype.h>
|
#include <LibWeb/Bindings/WebGLProgramPrototype.h>
|
||||||
#include <LibWeb/WebGL/WebGLProgram.h>
|
#include <LibWeb/WebGL/WebGLProgram.h>
|
||||||
|
|
||||||
|
@ -13,9 +15,9 @@ namespace Web::WebGL {
|
||||||
|
|
||||||
GC_DEFINE_ALLOCATOR(WebGLProgram);
|
GC_DEFINE_ALLOCATOR(WebGLProgram);
|
||||||
|
|
||||||
GC::Ptr<WebGLProgram> WebGLProgram::create(JS::Realm& realm, GLuint handle)
|
GC::Ref<WebGLProgram> WebGLProgram::create(JS::Realm& realm, GLuint handle)
|
||||||
{
|
{
|
||||||
return realm.heap().allocate<WebGLProgram>(realm, handle);
|
return realm.create<WebGLProgram>(realm, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebGLProgram::WebGLProgram(JS::Realm& realm, GLuint handle)
|
WebGLProgram::WebGLProgram(JS::Realm& realm, GLuint handle)
|
||||||
|
@ -25,4 +27,10 @@ WebGLProgram::WebGLProgram(JS::Realm& realm, GLuint handle)
|
||||||
|
|
||||||
WebGLProgram::~WebGLProgram() = default;
|
WebGLProgram::~WebGLProgram() = default;
|
||||||
|
|
||||||
|
void WebGLProgram::initialize(JS::Realm& realm)
|
||||||
|
{
|
||||||
|
Base::initialize(realm);
|
||||||
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(WebGLProgram);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||||
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||||
|
* Copyright (c) 2024, Luke Wilde <luke@ladybird.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -17,12 +18,14 @@ class WebGLProgram final : public WebGLObject {
|
||||||
GC_DECLARE_ALLOCATOR(WebGLProgram);
|
GC_DECLARE_ALLOCATOR(WebGLProgram);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static GC::Ptr<WebGLProgram> create(JS::Realm& realm, GLuint handle);
|
static GC::Ref<WebGLProgram> create(JS::Realm& realm, GLuint handle);
|
||||||
|
|
||||||
virtual ~WebGLProgram();
|
virtual ~WebGLProgram();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit WebGLProgram(JS::Realm&, GLuint handle);
|
explicit WebGLProgram(JS::Realm&, GLuint handle);
|
||||||
|
|
||||||
|
virtual void initialize(JS::Realm&) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||||
|
* Copyright (c) 2024, Luke Wilde <luke@ladybird.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <LibJS/Runtime/Realm.h>
|
#include <LibJS/Runtime/Realm.h>
|
||||||
|
#include <LibWeb/Bindings/Intrinsics.h>
|
||||||
#include <LibWeb/Bindings/WebGLRenderbufferPrototype.h>
|
#include <LibWeb/Bindings/WebGLRenderbufferPrototype.h>
|
||||||
#include <LibWeb/WebGL/WebGLRenderbuffer.h>
|
#include <LibWeb/WebGL/WebGLRenderbuffer.h>
|
||||||
|
|
||||||
|
@ -12,9 +14,9 @@ namespace Web::WebGL {
|
||||||
|
|
||||||
GC_DEFINE_ALLOCATOR(WebGLRenderbuffer);
|
GC_DEFINE_ALLOCATOR(WebGLRenderbuffer);
|
||||||
|
|
||||||
GC::Ptr<WebGLRenderbuffer> WebGLRenderbuffer::create(JS::Realm& realm, GLuint handle)
|
GC::Ref<WebGLRenderbuffer> WebGLRenderbuffer::create(JS::Realm& realm, GLuint handle)
|
||||||
{
|
{
|
||||||
return realm.heap().allocate<WebGLRenderbuffer>(realm, handle);
|
return realm.create<WebGLRenderbuffer>(realm, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebGLRenderbuffer::WebGLRenderbuffer(JS::Realm& realm, GLuint handle)
|
WebGLRenderbuffer::WebGLRenderbuffer(JS::Realm& realm, GLuint handle)
|
||||||
|
@ -24,4 +26,10 @@ WebGLRenderbuffer::WebGLRenderbuffer(JS::Realm& realm, GLuint handle)
|
||||||
|
|
||||||
WebGLRenderbuffer::~WebGLRenderbuffer() = default;
|
WebGLRenderbuffer::~WebGLRenderbuffer() = default;
|
||||||
|
|
||||||
|
void WebGLRenderbuffer::initialize(JS::Realm& realm)
|
||||||
|
{
|
||||||
|
Base::initialize(realm);
|
||||||
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(WebGLRenderbuffer);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||||
|
* Copyright (c) 2024, Luke Wilde <luke@ladybird.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -15,12 +16,14 @@ class WebGLRenderbuffer final : public WebGLObject {
|
||||||
GC_DECLARE_ALLOCATOR(WebGLRenderbuffer);
|
GC_DECLARE_ALLOCATOR(WebGLRenderbuffer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static GC::Ptr<WebGLRenderbuffer> create(JS::Realm& realm, GLuint handle);
|
static GC::Ref<WebGLRenderbuffer> create(JS::Realm& realm, GLuint handle);
|
||||||
|
|
||||||
virtual ~WebGLRenderbuffer();
|
virtual ~WebGLRenderbuffer();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit WebGLRenderbuffer(JS::Realm&, GLuint handle);
|
explicit WebGLRenderbuffer(JS::Realm&, GLuint handle);
|
||||||
|
|
||||||
|
virtual void initialize(JS::Realm&) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||||
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||||
|
* Copyright (c) 2024, Luke Wilde <luke@ladybird.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <LibJS/Runtime/Realm.h>
|
#include <LibJS/Runtime/Realm.h>
|
||||||
|
#include <LibWeb/Bindings/Intrinsics.h>
|
||||||
#include <LibWeb/Bindings/WebGLShaderPrototype.h>
|
#include <LibWeb/Bindings/WebGLShaderPrototype.h>
|
||||||
#include <LibWeb/WebGL/WebGLShader.h>
|
#include <LibWeb/WebGL/WebGLShader.h>
|
||||||
|
|
||||||
|
@ -13,9 +15,9 @@ namespace Web::WebGL {
|
||||||
|
|
||||||
GC_DEFINE_ALLOCATOR(WebGLShader);
|
GC_DEFINE_ALLOCATOR(WebGLShader);
|
||||||
|
|
||||||
GC::Ptr<WebGLShader> WebGLShader::create(JS::Realm& realm, GLuint handle)
|
GC::Ref<WebGLShader> WebGLShader::create(JS::Realm& realm, GLuint handle)
|
||||||
{
|
{
|
||||||
return realm.heap().allocate<WebGLShader>(realm, handle);
|
return realm.create<WebGLShader>(realm, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebGLShader::WebGLShader(JS::Realm& realm, GLuint handle)
|
WebGLShader::WebGLShader(JS::Realm& realm, GLuint handle)
|
||||||
|
@ -25,4 +27,10 @@ WebGLShader::WebGLShader(JS::Realm& realm, GLuint handle)
|
||||||
|
|
||||||
WebGLShader::~WebGLShader() = default;
|
WebGLShader::~WebGLShader() = default;
|
||||||
|
|
||||||
|
void WebGLShader::initialize(JS::Realm& realm)
|
||||||
|
{
|
||||||
|
Base::initialize(realm);
|
||||||
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(WebGLShader);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||||
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||||
|
* Copyright (c) 2024, Luke Wilde <luke@ladybird.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -17,12 +18,14 @@ class WebGLShader final : public WebGLObject {
|
||||||
GC_DECLARE_ALLOCATOR(WebGLShader);
|
GC_DECLARE_ALLOCATOR(WebGLShader);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static GC::Ptr<WebGLShader> create(JS::Realm& realm, GLuint handle);
|
static GC::Ref<WebGLShader> create(JS::Realm& realm, GLuint handle);
|
||||||
|
|
||||||
virtual ~WebGLShader();
|
virtual ~WebGLShader();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit WebGLShader(JS::Realm&, GLuint handle);
|
explicit WebGLShader(JS::Realm&, GLuint handle);
|
||||||
|
|
||||||
|
virtual void initialize(JS::Realm&) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||||
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||||
|
* Copyright (c) 2024, Luke Wilde <luke@ladybird.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <LibJS/Runtime/Realm.h>
|
#include <LibJS/Runtime/Realm.h>
|
||||||
|
#include <LibWeb/Bindings/Intrinsics.h>
|
||||||
#include <LibWeb/Bindings/WebGLTexturePrototype.h>
|
#include <LibWeb/Bindings/WebGLTexturePrototype.h>
|
||||||
#include <LibWeb/WebGL/WebGLTexture.h>
|
#include <LibWeb/WebGL/WebGLTexture.h>
|
||||||
|
|
||||||
|
@ -13,9 +15,9 @@ namespace Web::WebGL {
|
||||||
|
|
||||||
GC_DEFINE_ALLOCATOR(WebGLTexture);
|
GC_DEFINE_ALLOCATOR(WebGLTexture);
|
||||||
|
|
||||||
GC::Ptr<WebGLTexture> WebGLTexture::create(JS::Realm& realm, GLuint handle)
|
GC::Ref<WebGLTexture> WebGLTexture::create(JS::Realm& realm, GLuint handle)
|
||||||
{
|
{
|
||||||
return realm.heap().allocate<WebGLTexture>(realm, handle);
|
return realm.create<WebGLTexture>(realm, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebGLTexture::WebGLTexture(JS::Realm& realm, GLuint handle)
|
WebGLTexture::WebGLTexture(JS::Realm& realm, GLuint handle)
|
||||||
|
@ -25,4 +27,10 @@ WebGLTexture::WebGLTexture(JS::Realm& realm, GLuint handle)
|
||||||
|
|
||||||
WebGLTexture::~WebGLTexture() = default;
|
WebGLTexture::~WebGLTexture() = default;
|
||||||
|
|
||||||
|
void WebGLTexture::initialize(JS::Realm& realm)
|
||||||
|
{
|
||||||
|
Base::initialize(realm);
|
||||||
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(WebGLTexture);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||||
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||||
|
* Copyright (c) 2024, Luke Wilde <luke@ladybird.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -17,12 +18,14 @@ class WebGLTexture final : public WebGLObject {
|
||||||
GC_DECLARE_ALLOCATOR(WebGLTexture);
|
GC_DECLARE_ALLOCATOR(WebGLTexture);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static GC::Ptr<WebGLTexture> create(JS::Realm& realm, GLuint handle);
|
static GC::Ref<WebGLTexture> create(JS::Realm& realm, GLuint handle);
|
||||||
|
|
||||||
virtual ~WebGLTexture();
|
virtual ~WebGLTexture();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit WebGLTexture(JS::Realm&, GLuint handle);
|
explicit WebGLTexture(JS::Realm&, GLuint handle);
|
||||||
|
|
||||||
|
virtual void initialize(JS::Realm&) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||||
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||||
|
* Copyright (c) 2024, Luke Wilde <luke@ladybird.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <LibJS/Runtime/Realm.h>
|
#include <LibJS/Runtime/Realm.h>
|
||||||
|
#include <LibWeb/Bindings/Intrinsics.h>
|
||||||
#include <LibWeb/Bindings/WebGLUniformLocationPrototype.h>
|
#include <LibWeb/Bindings/WebGLUniformLocationPrototype.h>
|
||||||
#include <LibWeb/WebGL/WebGLUniformLocation.h>
|
#include <LibWeb/WebGL/WebGLUniformLocation.h>
|
||||||
|
|
||||||
|
@ -13,16 +15,23 @@ namespace Web::WebGL {
|
||||||
|
|
||||||
GC_DEFINE_ALLOCATOR(WebGLUniformLocation);
|
GC_DEFINE_ALLOCATOR(WebGLUniformLocation);
|
||||||
|
|
||||||
GC::Ptr<WebGLUniformLocation> WebGLUniformLocation::create(JS::Realm& realm, GLuint handle)
|
GC::Ref<WebGLUniformLocation> WebGLUniformLocation::create(JS::Realm& realm, GLuint handle)
|
||||||
{
|
{
|
||||||
return realm.heap().allocate<WebGLUniformLocation>(realm, handle);
|
return realm.create<WebGLUniformLocation>(realm, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebGLUniformLocation::WebGLUniformLocation(JS::Realm& realm, GLuint handle)
|
WebGLUniformLocation::WebGLUniformLocation(JS::Realm& realm, GLuint handle)
|
||||||
: WebGLObject(realm, handle)
|
: Bindings::PlatformObject(realm)
|
||||||
|
, m_handle(handle)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
WebGLUniformLocation::~WebGLUniformLocation() = default;
|
WebGLUniformLocation::~WebGLUniformLocation() = default;
|
||||||
|
|
||||||
|
void WebGLUniformLocation::initialize(JS::Realm& realm)
|
||||||
|
{
|
||||||
|
Base::initialize(realm);
|
||||||
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(WebGLUniformLocation);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,21 +7,28 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/WebGL/WebGLObject.h>
|
#include <LibWeb/Bindings/PlatformObject.h>
|
||||||
|
#include <LibWeb/WebGL/Types.h>
|
||||||
|
|
||||||
namespace Web::WebGL {
|
namespace Web::WebGL {
|
||||||
|
|
||||||
class WebGLUniformLocation final : public WebGLObject {
|
class WebGLUniformLocation final : public Bindings::PlatformObject {
|
||||||
WEB_PLATFORM_OBJECT(WebGLUniformLocation, WebGLObject);
|
WEB_PLATFORM_OBJECT(WebGLUniformLocation, Bindings::PlatformObject);
|
||||||
GC_DECLARE_ALLOCATOR(WebGLUniformLocation);
|
GC_DECLARE_ALLOCATOR(WebGLUniformLocation);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static GC::Ptr<WebGLUniformLocation> create(JS::Realm& realm, GLuint handle);
|
static GC::Ref<WebGLUniformLocation> create(JS::Realm& realm, GLuint handle);
|
||||||
|
|
||||||
virtual ~WebGLUniformLocation();
|
virtual ~WebGLUniformLocation();
|
||||||
|
|
||||||
|
GLuint handle() const { return m_handle; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit WebGLUniformLocation(JS::Realm&, GLuint handle);
|
explicit WebGLUniformLocation(JS::Realm&, GLuint handle);
|
||||||
|
|
||||||
|
virtual void initialize(JS::Realm&) override;
|
||||||
|
|
||||||
|
GLuint m_handle { 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue