From b67c8d138c8ac6976b2d8fb0d0d9305fbd6ebbf3 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Wed, 13 Nov 2024 10:18:51 +0100 Subject: [PATCH] LibWeb: Add WebGLShaderPrecisionFormat (cherry picked from commit 3d8ab0e67c707062e4d889598fbd176fa0c6fce8) --- .../Userland/Libraries/LibWeb/idl_files.gni | 1 + .../Text/expected/all-window-properties.txt | 1 + Userland/Libraries/LibWeb/CMakeLists.txt | 1 + .../WebGL/WebGLShaderPrecisionFormat.cpp | 21 ++++++++++++++++ .../LibWeb/WebGL/WebGLShaderPrecisionFormat.h | 24 +++++++++++++++++++ .../WebGL/WebGLShaderPrecisionFormat.idl | 9 +++++++ Userland/Libraries/LibWeb/idl_files.cmake | 1 + 7 files changed, 58 insertions(+) create mode 100644 Userland/Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.cpp create mode 100644 Userland/Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.h create mode 100644 Userland/Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.idl diff --git a/Meta/gn/secondary/Userland/Libraries/LibWeb/idl_files.gni b/Meta/gn/secondary/Userland/Libraries/LibWeb/idl_files.gni index 279bbab309ef8d..da388c0a01ce2b 100644 --- a/Meta/gn/secondary/Userland/Libraries/LibWeb/idl_files.gni +++ b/Meta/gn/secondary/Userland/Libraries/LibWeb/idl_files.gni @@ -375,6 +375,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 7ec613cb920a36..05d306770e2bf2 100644 --- a/Tests/LibWeb/Text/expected/all-window-properties.txt +++ b/Tests/LibWeb/Text/expected/all-window-properties.txt @@ -391,6 +391,7 @@ WebGLProgram WebGLRenderbuffer WebGLRenderingContext WebGLShader +WebGLShaderPrecisionFormat WebGLTexture WebGLUniformLocation WebKitCSSMatrix diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index 5d9f7d66e1c595..3335dc08a91c1e 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -761,6 +761,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/Userland/Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.cpp b/Userland/Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.cpp new file mode 100644 index 00000000000000..8470c440accdc8 --- /dev/null +++ b/Userland/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/Userland/Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.h b/Userland/Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.h new file mode 100644 index 00000000000000..980e7432480344 --- /dev/null +++ b/Userland/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/Userland/Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.idl b/Userland/Libraries/LibWeb/WebGL/WebGLShaderPrecisionFormat.idl new file mode 100644 index 00000000000000..df92fe77e7f943 --- /dev/null +++ b/Userland/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/Userland/Libraries/LibWeb/idl_files.cmake b/Userland/Libraries/LibWeb/idl_files.cmake index ed7db558e93612..fc22bb605cc7b4 100644 --- a/Userland/Libraries/LibWeb/idl_files.cmake +++ b/Userland/Libraries/LibWeb/idl_files.cmake @@ -360,6 +360,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)