From 3d8ab0e67c707062e4d889598fbd176fa0c6fce8 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Wed, 13 Nov 2024 10:18:51 +0100 Subject: [PATCH] LibWeb: Add WebGLShaderPrecisionFormat --- Libraries/LibWeb/CMakeLists.txt | 1 + .../WebGL/WebGLShaderPrecisionFormat.cpp | 21 ++++++++++++++++ .../LibWeb/WebGL/WebGLShaderPrecisionFormat.h | 24 +++++++++++++++++++ .../WebGL/WebGLShaderPrecisionFormat.idl | 9 +++++++ Libraries/LibWeb/idl_files.cmake | 1 + .../Userland/Libraries/LibWeb/idl_files.gni | 1 + .../Text/expected/all-window-properties.txt | 1 + 7 files changed, 58 insertions(+) create mode 100644 Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.cpp create mode 100644 Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.h create mode 100644 Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.idl diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt index 0fbe9306456..52b5a58473f 100644 --- a/Libraries/LibWeb/CMakeLists.txt +++ b/Libraries/LibWeb/CMakeLists.txt @@ -788,6 +788,7 @@ set(SOURCES WebGL/WebGLRenderingContext.cpp WebGL/WebGLRenderingContextBase.cpp WebGL/WebGLShader.cpp + WebGL/WebGLShaderPrecisionFormat.cpp WebGL/WebGLTexture.cpp WebGL/WebGLUniformLocation.cpp WebIDL/AbstractOperations.cpp diff --git a/Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.cpp b/Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.cpp new file mode 100644 index 00000000000..8470c440acc --- /dev/null +++ b/Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.cpp @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2024, Jelle Raaijmakers + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include +#include + +namespace Web::WebGL { + +JS_DEFINE_ALLOCATOR(WebGLShaderPrecisionFormat); + +WebGLShaderPrecisionFormat::WebGLShaderPrecisionFormat(JS::Realm& realm) + : WebGLObject(realm) +{ +} + +WebGLShaderPrecisionFormat::~WebGLShaderPrecisionFormat() = default; + +} diff --git a/Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.h b/Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.h new file mode 100644 index 00000000000..980e7432480 --- /dev/null +++ b/Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2024, Jelle Raaijmakers + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include + +namespace Web::WebGL { + +class WebGLShaderPrecisionFormat final : public WebGLObject { + WEB_PLATFORM_OBJECT(WebGLShaderPrecisionFormat, WebGLObject); + JS_DECLARE_ALLOCATOR(WebGLShaderPrecisionFormat); + +public: + virtual ~WebGLShaderPrecisionFormat(); + +protected: + explicit WebGLShaderPrecisionFormat(JS::Realm&); +}; + +} diff --git a/Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.idl b/Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.idl new file mode 100644 index 00000000000..df92fe77e7f --- /dev/null +++ b/Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.idl @@ -0,0 +1,9 @@ +#import + +// https://registry.khronos.org/webgl/specs/latest/1.0/#5.12 +[Exposed=(Window,Worker)] +interface WebGLShaderPrecisionFormat { + [FIXME] readonly attribute GLint rangeMin; + [FIXME] readonly attribute GLint rangeMax; + [FIXME] readonly attribute GLint precision; +}; diff --git a/Libraries/LibWeb/idl_files.cmake b/Libraries/LibWeb/idl_files.cmake index 3e247e65edb..7262cbd3035 100644 --- a/Libraries/LibWeb/idl_files.cmake +++ b/Libraries/LibWeb/idl_files.cmake @@ -368,6 +368,7 @@ libweb_js_bindings(WebGL/WebGLProgram) libweb_js_bindings(WebGL/WebGLRenderbuffer) libweb_js_bindings(WebGL/WebGLRenderingContext) libweb_js_bindings(WebGL/WebGLShader) +libweb_js_bindings(WebGL/WebGLShaderPrecisionFormat) libweb_js_bindings(WebGL/WebGLTexture) libweb_js_bindings(WebGL/WebGLUniformLocation) 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 5032f37d3e8..0cc4e709de4 100644 --- a/Meta/gn/secondary/Userland/Libraries/LibWeb/idl_files.gni +++ b/Meta/gn/secondary/Userland/Libraries/LibWeb/idl_files.gni @@ -380,6 +380,7 @@ standard_idl_files = [ "//Userland/Libraries/LibWeb/WebGL/WebGLRenderbuffer.idl", "//Userland/Libraries/LibWeb/WebGL/WebGLRenderingContext.idl", "//Userland/Libraries/LibWeb/WebGL/WebGLShader.idl", + "//Userland/Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.idl", "//Userland/Libraries/LibWeb/WebGL/WebGLTexture.idl", "//Userland/Libraries/LibWeb/WebGL/WebGLUniformLocation.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 fcb4476cea0..a97c7ec63d8 100644 --- a/Tests/LibWeb/Text/expected/all-window-properties.txt +++ b/Tests/LibWeb/Text/expected/all-window-properties.txt @@ -399,6 +399,7 @@ WebGLProgram WebGLRenderbuffer WebGLRenderingContext WebGLShader +WebGLShaderPrecisionFormat WebGLTexture WebGLUniformLocation WebKitCSSMatrix