mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 09:12:13 -05: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: https://github.com/LadybirdBrowser/ladybird/commit/c5e9615c293 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
|
||||
*/
|
||||
|
||||
#include <LibJS/Runtime/Realm.h>
|
||||
#include <LibWeb/Bindings/WebGLFramebufferPrototype.h>
|
||||
#include <LibWeb/WebGL/WebGLFramebuffer.h>
|
||||
|
||||
|
@ -11,8 +12,13 @@ namespace Web::WebGL {
|
|||
|
||||
GC_DEFINE_ALLOCATOR(WebGLFramebuffer);
|
||||
|
||||
WebGLFramebuffer::WebGLFramebuffer(JS::Realm& realm)
|
||||
: WebGLObject(realm, 0)
|
||||
GC::Ptr<WebGLFramebuffer> WebGLFramebuffer::create(JS::Realm& realm, GLuint handle)
|
||||
{
|
||||
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);
|
||||
|
||||
public:
|
||||
static GC::Ptr<WebGLFramebuffer> create(JS::Realm& realm, GLuint handle);
|
||||
|
||||
virtual ~WebGLFramebuffer();
|
||||
|
||||
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);
|
||||
|
||||
WebGLBuffer? createBuffer();
|
||||
[FIXME] WebGLFramebuffer? createFramebuffer();
|
||||
WebGLFramebuffer? createFramebuffer();
|
||||
WebGLProgram? createProgram();
|
||||
[FIXME] WebGLRenderbuffer? createRenderbuffer();
|
||||
WebGLShader? createShader(GLenum type);
|
||||
|
|
|
@ -415,6 +415,15 @@ public:
|
|||
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) {
|
||||
function_impl_generator.append(R"~~~(
|
||||
Vector<GLchar*> strings;
|
||||
|
|
Loading…
Reference in a new issue