From d53cb9833b274658c1ec1b6c1813cfb466470bdb Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Wed, 13 Nov 2024 10:03:53 +0100 Subject: [PATCH] LibWeb: Add WebGLRenderbuffer --- Libraries/LibWeb/CMakeLists.txt | 1 + Libraries/LibWeb/WebGL/WebGLRenderbuffer.cpp | 21 ++++++++++++++++ Libraries/LibWeb/WebGL/WebGLRenderbuffer.h | 24 +++++++++++++++++++ Libraries/LibWeb/WebGL/WebGLRenderbuffer.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/WebGLRenderbuffer.cpp create mode 100644 Libraries/LibWeb/WebGL/WebGLRenderbuffer.h create mode 100644 Libraries/LibWeb/WebGL/WebGLRenderbuffer.idl diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt index f766933dffb..e0069145280 100644 --- a/Libraries/LibWeb/CMakeLists.txt +++ b/Libraries/LibWeb/CMakeLists.txt @@ -783,6 +783,7 @@ set(SOURCES WebGL/WebGLFramebuffer.cpp WebGL/WebGLObject.cpp WebGL/WebGLProgram.cpp + WebGL/WebGLRenderbuffer.cpp WebGL/WebGLRenderingContext.cpp WebGL/WebGLRenderingContextBase.cpp WebIDL/AbstractOperations.cpp diff --git a/Libraries/LibWeb/WebGL/WebGLRenderbuffer.cpp b/Libraries/LibWeb/WebGL/WebGLRenderbuffer.cpp new file mode 100644 index 00000000000..e268f9b3549 --- /dev/null +++ b/Libraries/LibWeb/WebGL/WebGLRenderbuffer.cpp @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024, Jelle Raaijmakers + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include +#include + +namespace Web::WebGL { + +JS_DEFINE_ALLOCATOR(WebGLRenderbuffer); + +WebGLRenderbuffer::WebGLRenderbuffer(JS::Realm& realm) + : WebGLObject(realm) +{ +} + +WebGLRenderbuffer::~WebGLRenderbuffer() = default; + +} diff --git a/Libraries/LibWeb/WebGL/WebGLRenderbuffer.h b/Libraries/LibWeb/WebGL/WebGLRenderbuffer.h new file mode 100644 index 00000000000..1a4887643bf --- /dev/null +++ b/Libraries/LibWeb/WebGL/WebGLRenderbuffer.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2024, Jelle Raaijmakers + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include + +namespace Web::WebGL { + +class WebGLRenderbuffer final : public WebGLObject { + WEB_PLATFORM_OBJECT(WebGLRenderbuffer, WebGLObject); + JS_DECLARE_ALLOCATOR(WebGLRenderbuffer); + +public: + virtual ~WebGLRenderbuffer(); + +protected: + explicit WebGLRenderbuffer(JS::Realm&); +}; + +} diff --git a/Libraries/LibWeb/WebGL/WebGLRenderbuffer.idl b/Libraries/LibWeb/WebGL/WebGLRenderbuffer.idl new file mode 100644 index 00000000000..81adae69b00 --- /dev/null +++ b/Libraries/LibWeb/WebGL/WebGLRenderbuffer.idl @@ -0,0 +1,6 @@ +#import + +// https://registry.khronos.org/webgl/specs/latest/1.0/#5.7 +[Exposed=(Window,Worker)] +interface WebGLRenderbuffer : WebGLObject { +}; diff --git a/Libraries/LibWeb/idl_files.cmake b/Libraries/LibWeb/idl_files.cmake index 669c66a31dc..5e5baccd28e 100644 --- a/Libraries/LibWeb/idl_files.cmake +++ b/Libraries/LibWeb/idl_files.cmake @@ -364,6 +364,7 @@ libweb_js_bindings(WebGL/WebGLContextEvent) libweb_js_bindings(WebGL/WebGLFramebuffer) libweb_js_bindings(WebGL/WebGLObject) libweb_js_bindings(WebGL/WebGLProgram) +libweb_js_bindings(WebGL/WebGLRenderbuffer) libweb_js_bindings(WebGL/WebGLRenderingContext) libweb_js_bindings(WebIDL/DOMException) libweb_js_bindings(WebSockets/WebSocket) diff --git a/Meta/gn/secondary/Userland/Libraries/LibWeb/idl_files.gni b/Meta/gn/secondary/Userland/Libraries/LibWeb/idl_files.gni index 59d76d858ab..571e01af3b3 100644 --- a/Meta/gn/secondary/Userland/Libraries/LibWeb/idl_files.gni +++ b/Meta/gn/secondary/Userland/Libraries/LibWeb/idl_files.gni @@ -376,6 +376,7 @@ standard_idl_files = [ "//Userland/Libraries/LibWeb/WebGL/WebGLFramebuffer.idl", "//Userland/Libraries/LibWeb/WebGL/WebGLObject.idl", "//Userland/Libraries/LibWeb/WebGL/WebGLProgram.idl", + "//Userland/Libraries/LibWeb/WebGL/WebGLRenderbuffer.idl", "//Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.idl", "//Userland/Libraries/LibWeb/WebIDL/DOMException.idl", "//Userland/Libraries/LibWeb/WebSockets/WebSocket.idl", diff --git a/Tests/LibWeb/Text/expected/all-window-properties.txt b/Tests/LibWeb/Text/expected/all-window-properties.txt index c5018319eed..4554857a7a8 100644 --- a/Tests/LibWeb/Text/expected/all-window-properties.txt +++ b/Tests/LibWeb/Text/expected/all-window-properties.txt @@ -395,6 +395,7 @@ WebGLContextEvent WebGLFramebuffer WebGLObject WebGLProgram +WebGLRenderbuffer WebGLRenderingContext WebKitCSSMatrix WebSocket