From 5d0b206d6ec9c3a5284ee6db7452b21a6cf6c7cd Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Wed, 13 Nov 2024 09:46:25 +0100 Subject: [PATCH] LibWeb: Add WebGLFramebuffer --- Libraries/LibWeb/CMakeLists.txt | 1 + Libraries/LibWeb/WebGL/WebGLFramebuffer.cpp | 21 ++++++++++++++++ Libraries/LibWeb/WebGL/WebGLFramebuffer.h | 24 +++++++++++++++++++ Libraries/LibWeb/WebGL/WebGLFramebuffer.idl | 6 +++++ Libraries/LibWeb/idl_files.cmake | 1 + .../Userland/Libraries/LibWeb/idl_files.gni | 1 + .../Text/expected/all-window-properties.txt | 1 + 7 files changed, 55 insertions(+) create mode 100644 Libraries/LibWeb/WebGL/WebGLFramebuffer.cpp create mode 100644 Libraries/LibWeb/WebGL/WebGLFramebuffer.h create mode 100644 Libraries/LibWeb/WebGL/WebGLFramebuffer.idl diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt index 38928fc65d3..db13fa950f4 100644 --- a/Libraries/LibWeb/CMakeLists.txt +++ b/Libraries/LibWeb/CMakeLists.txt @@ -780,6 +780,7 @@ set(SOURCES WebGL/WebGLBuffer.cpp WebGL/WebGLContextAttributes.cpp WebGL/WebGLContextEvent.cpp + WebGL/WebGLFramebuffer.cpp WebGL/WebGLObject.cpp WebGL/WebGLRenderingContext.cpp WebGL/WebGLRenderingContextBase.cpp diff --git a/Libraries/LibWeb/WebGL/WebGLFramebuffer.cpp b/Libraries/LibWeb/WebGL/WebGLFramebuffer.cpp new file mode 100644 index 00000000000..735e608e4d1 --- /dev/null +++ b/Libraries/LibWeb/WebGL/WebGLFramebuffer.cpp @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024, Jelle Raaijmakers + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include +#include + +namespace Web::WebGL { + +JS_DEFINE_ALLOCATOR(WebGLFramebuffer); + +WebGLFramebuffer::WebGLFramebuffer(JS::Realm& realm) + : WebGLObject(realm) +{ +} + +WebGLFramebuffer::~WebGLFramebuffer() = default; + +} diff --git a/Libraries/LibWeb/WebGL/WebGLFramebuffer.h b/Libraries/LibWeb/WebGL/WebGLFramebuffer.h new file mode 100644 index 00000000000..725edd2af9e --- /dev/null +++ b/Libraries/LibWeb/WebGL/WebGLFramebuffer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2024, Jelle Raaijmakers + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include + +namespace Web::WebGL { + +class WebGLFramebuffer final : public WebGLObject { + WEB_PLATFORM_OBJECT(WebGLFramebuffer, WebGLObject); + JS_DECLARE_ALLOCATOR(WebGLFramebuffer); + +public: + virtual ~WebGLFramebuffer(); + +protected: + explicit WebGLFramebuffer(JS::Realm&); +}; + +} diff --git a/Libraries/LibWeb/WebGL/WebGLFramebuffer.idl b/Libraries/LibWeb/WebGL/WebGLFramebuffer.idl new file mode 100644 index 00000000000..f00f1bac63d --- /dev/null +++ b/Libraries/LibWeb/WebGL/WebGLFramebuffer.idl @@ -0,0 +1,6 @@ +#import + +// https://registry.khronos.org/webgl/specs/latest/1.0/#5.5 +[Exposed=(Window,Worker)] +interface WebGLFramebuffer : WebGLObject { +}; diff --git a/Libraries/LibWeb/idl_files.cmake b/Libraries/LibWeb/idl_files.cmake index 01611fb1841..b059ef1e2ab 100644 --- a/Libraries/LibWeb/idl_files.cmake +++ b/Libraries/LibWeb/idl_files.cmake @@ -361,6 +361,7 @@ libweb_js_bindings(WebAudio/OscillatorNode) libweb_js_bindings(WebAudio/PeriodicWave) libweb_js_bindings(WebGL/WebGLBuffer) libweb_js_bindings(WebGL/WebGLContextEvent) +libweb_js_bindings(WebGL/WebGLFramebuffer) libweb_js_bindings(WebGL/WebGLObject) libweb_js_bindings(WebGL/WebGLRenderingContext) libweb_js_bindings(WebIDL/DOMException) diff --git a/Meta/gn/secondary/Userland/Libraries/LibWeb/idl_files.gni b/Meta/gn/secondary/Userland/Libraries/LibWeb/idl_files.gni index daaa7407154..affcfde2237 100644 --- a/Meta/gn/secondary/Userland/Libraries/LibWeb/idl_files.gni +++ b/Meta/gn/secondary/Userland/Libraries/LibWeb/idl_files.gni @@ -373,6 +373,7 @@ standard_idl_files = [ "//Userland/Libraries/LibWeb/WebAudio/PeriodicWave.idl", "//Userland/Libraries/LibWeb/WebGL/WebGLBuffer.idl", "//Userland/Libraries/LibWeb/WebGL/WebGLContextEvent.idl", + "//Userland/Libraries/LibWeb/WebGL/WebGLFramebuffer.idl", "//Userland/Libraries/LibWeb/WebGL/WebGLObject.idl", "//Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.idl", "//Userland/Libraries/LibWeb/WebIDL/DOMException.idl", diff --git a/Tests/LibWeb/Text/expected/all-window-properties.txt b/Tests/LibWeb/Text/expected/all-window-properties.txt index 597ce1c865f..306dfc73838 100644 --- a/Tests/LibWeb/Text/expected/all-window-properties.txt +++ b/Tests/LibWeb/Text/expected/all-window-properties.txt @@ -392,6 +392,7 @@ WeakRef WeakSet WebGLBuffer WebGLContextEvent +WebGLFramebuffer WebGLObject WebGLRenderingContext WebKitCSSMatrix