diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt index 659a7186fd6..134b4129d88 100644 --- a/Libraries/LibWeb/CMakeLists.txt +++ b/Libraries/LibWeb/CMakeLists.txt @@ -817,6 +817,7 @@ set(SOURCES WebGL/WebGLSampler.cpp WebGL/WebGLShader.cpp WebGL/WebGLShaderPrecisionFormat.cpp + WebGL/WebGLSync.cpp WebGL/WebGLTexture.cpp WebGL/WebGLUniformLocation.cpp WebIDL/AbstractOperations.cpp diff --git a/Libraries/LibWeb/WebGL/WebGLSync.cpp b/Libraries/LibWeb/WebGL/WebGLSync.cpp new file mode 100644 index 00000000000..cc89e5cdff6 --- /dev/null +++ b/Libraries/LibWeb/WebGL/WebGLSync.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024, Andrew Kaster + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include +#include +#include +#include + +namespace Web::WebGL { + +GC_DEFINE_ALLOCATOR(WebGLSync); + +GC::Ref WebGLSync::create(JS::Realm& realm, GLuint handle) +{ + return realm.create(realm, handle); +} + +WebGLSync::WebGLSync(JS::Realm& realm, GLuint handle) + : WebGLObject(realm, handle) +{ +} + +WebGLSync::~WebGLSync() = default; + +void WebGLSync::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + WEB_SET_PROTOTYPE_FOR_INTERFACE(WebGLSync); +} + +} diff --git a/Libraries/LibWeb/WebGL/WebGLSync.h b/Libraries/LibWeb/WebGL/WebGLSync.h new file mode 100644 index 00000000000..f64195c7125 --- /dev/null +++ b/Libraries/LibWeb/WebGL/WebGLSync.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2024, Andrew Kaster + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include +#include + +namespace Web::WebGL { + +class WebGLSync : public WebGLObject { + WEB_PLATFORM_OBJECT(WebGLSync, WebGLObject); + GC_DECLARE_ALLOCATOR(WebGLSync); + +public: + static GC::Ref create(JS::Realm& realm, GLuint handle); + + virtual ~WebGLSync() override; + +protected: + explicit WebGLSync(JS::Realm&, GLuint handle); + + virtual void initialize(JS::Realm&) override; +}; + +} diff --git a/Libraries/LibWeb/WebGL/WebGLSync.idl b/Libraries/LibWeb/WebGL/WebGLSync.idl new file mode 100644 index 00000000000..0a69dadcf9b --- /dev/null +++ b/Libraries/LibWeb/WebGL/WebGLSync.idl @@ -0,0 +1,6 @@ +#import + +// https://registry.khronos.org/webgl/specs/latest/2.0/#3.4 +[Exposed=(Window,Worker)] +interface WebGLSync : WebGLObject { +}; diff --git a/Libraries/LibWeb/idl_files.cmake b/Libraries/LibWeb/idl_files.cmake index bf44c9e8ade..5753b8df023 100644 --- a/Libraries/LibWeb/idl_files.cmake +++ b/Libraries/LibWeb/idl_files.cmake @@ -381,6 +381,7 @@ libweb_js_bindings(WebGL/WebGLRenderingContext) libweb_js_bindings(WebGL/WebGLSampler) libweb_js_bindings(WebGL/WebGLShader) libweb_js_bindings(WebGL/WebGLShaderPrecisionFormat) +libweb_js_bindings(WebGL/WebGLSync) libweb_js_bindings(WebGL/WebGLTexture) libweb_js_bindings(WebGL/WebGLUniformLocation) libweb_js_bindings(WebIDL/DOMException) diff --git a/Tests/LibWeb/Text/expected/all-window-properties.txt b/Tests/LibWeb/Text/expected/all-window-properties.txt index 2b13aa60fbe..9712e3a6e57 100644 --- a/Tests/LibWeb/Text/expected/all-window-properties.txt +++ b/Tests/LibWeb/Text/expected/all-window-properties.txt @@ -410,6 +410,7 @@ WebGLRenderingContext WebGLSampler WebGLShader WebGLShaderPrecisionFormat +WebGLSync WebGLTexture WebGLUniformLocation WebKitCSSMatrix