mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 01:00:05 +00:00
LibWeb/WebGL: Implement createFramebuffer
This commit is contained in:
parent
2ac8408fef
commit
c5e9615c29
Notes:
github-actions[bot]
2024-12-05 20:43:53 +00:00
Author: https://github.com/Lubrsi 🔰
Commit: c5e9615c29
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2791
Reviewed-by: https://github.com/gmta
Reviewed-by: https://github.com/shannonbooth
4 changed files with 21 additions and 4 deletions
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <LibJS/Runtime/Realm.h>
|
||||||
#include <LibWeb/Bindings/WebGLFramebufferPrototype.h>
|
#include <LibWeb/Bindings/WebGLFramebufferPrototype.h>
|
||||||
#include <LibWeb/WebGL/WebGLFramebuffer.h>
|
#include <LibWeb/WebGL/WebGLFramebuffer.h>
|
||||||
|
|
||||||
|
@ -11,8 +12,13 @@ namespace Web::WebGL {
|
||||||
|
|
||||||
GC_DEFINE_ALLOCATOR(WebGLFramebuffer);
|
GC_DEFINE_ALLOCATOR(WebGLFramebuffer);
|
||||||
|
|
||||||
WebGLFramebuffer::WebGLFramebuffer(JS::Realm& realm)
|
GC::Ptr<WebGLFramebuffer> WebGLFramebuffer::create(JS::Realm& realm, GLuint handle)
|
||||||
: WebGLObject(realm, 0)
|
{
|
||||||
|
return realm.heap().allocate<WebGLFramebuffer>(realm, handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
WebGLFramebuffer::WebGLFramebuffer(JS::Realm& realm, GLuint handle)
|
||||||
|
: WebGLObject(realm, handle)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,12 @@ 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);
|
||||||
|
|
||||||
virtual ~WebGLFramebuffer();
|
virtual ~WebGLFramebuffer();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit WebGLFramebuffer(JS::Realm&);
|
explicit WebGLFramebuffer(JS::Realm&, GLuint handle);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ interface mixin WebGLRenderingContextBase {
|
||||||
[FIXME] undefined copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
[FIXME] undefined copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||||
|
|
||||||
WebGLBuffer? createBuffer();
|
WebGLBuffer? createBuffer();
|
||||||
[FIXME] WebGLFramebuffer? createFramebuffer();
|
WebGLFramebuffer? createFramebuffer();
|
||||||
WebGLProgram? createProgram();
|
WebGLProgram? createProgram();
|
||||||
[FIXME] WebGLRenderbuffer? createRenderbuffer();
|
[FIXME] WebGLRenderbuffer? createRenderbuffer();
|
||||||
WebGLShader? createShader(GLenum type);
|
WebGLShader? createShader(GLenum type);
|
||||||
|
|
|
@ -415,6 +415,15 @@ public:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (function.name == "createFramebuffer"sv) {
|
||||||
|
function_impl_generator.append(R"~~~(
|
||||||
|
GLuint handle = 0;
|
||||||
|
glGenFramebuffers(1, &handle);
|
||||||
|
return WebGLFramebuffer::create(m_realm, handle);
|
||||||
|
)~~~");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (function.name == "shaderSource"sv) {
|
if (function.name == "shaderSource"sv) {
|
||||||
function_impl_generator.append(R"~~~(
|
function_impl_generator.append(R"~~~(
|
||||||
Vector<GLchar*> strings;
|
Vector<GLchar*> strings;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue