From de77a5e3ea5ead6c5d61b6cafa8bd38fa1fdab30 Mon Sep 17 00:00:00 2001 From: Luke Wilde Date: Fri, 10 Jan 2025 14:27:03 +0000 Subject: [PATCH] LibWeb/WebGL: Move extensions into their own folder --- Libraries/LibWeb/CMakeLists.txt | 6 +++--- Libraries/LibWeb/Forward.h | 7 +++++-- .../WebGL/{ => Extensions}/ANGLEInstancedArrays.cpp | 4 ++-- .../LibWeb/WebGL/{ => Extensions}/ANGLEInstancedArrays.h | 2 +- .../WebGL/{ => Extensions}/ANGLEInstancedArrays.idl | 0 .../WebGL/{ => Extensions}/OESVertexArrayObject.cpp | 7 ++++--- .../LibWeb/WebGL/{ => Extensions}/OESVertexArrayObject.h | 3 +-- .../WebGL/{ => Extensions}/OESVertexArrayObject.idl | 2 +- .../WebGL/{ => Extensions}/WebGLVertexArrayObjectOES.cpp | 4 ++-- .../WebGL/{ => Extensions}/WebGLVertexArrayObjectOES.h | 2 +- .../WebGL/{ => Extensions}/WebGLVertexArrayObjectOES.idl | 0 Libraries/LibWeb/WebGL/WebGLRenderingContext.cpp | 8 ++++---- Libraries/LibWeb/WebGL/WebGLRenderingContext.h | 4 ++-- Libraries/LibWeb/idl_files.cmake | 6 +++--- .../LibWeb/BindingsGenerator/IDLGenerators.cpp | 1 + 15 files changed, 30 insertions(+), 26 deletions(-) rename Libraries/LibWeb/WebGL/{ => Extensions}/ANGLEInstancedArrays.cpp (95%) rename Libraries/LibWeb/WebGL/{ => Extensions}/ANGLEInstancedArrays.h (96%) rename Libraries/LibWeb/WebGL/{ => Extensions}/ANGLEInstancedArrays.idl (100%) rename Libraries/LibWeb/WebGL/{ => Extensions}/OESVertexArrayObject.cpp (95%) rename Libraries/LibWeb/WebGL/{ => Extensions}/OESVertexArrayObject.h (93%) rename Libraries/LibWeb/WebGL/{ => Extensions}/OESVertexArrayObject.idl (94%) rename Libraries/LibWeb/WebGL/{ => Extensions}/WebGLVertexArrayObjectOES.cpp (90%) rename Libraries/LibWeb/WebGL/{ => Extensions}/WebGLVertexArrayObjectOES.h (95%) rename Libraries/LibWeb/WebGL/{ => Extensions}/WebGLVertexArrayObjectOES.idl (100%) diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt index c5badacecf1..295c66f2953 100644 --- a/Libraries/LibWeb/CMakeLists.txt +++ b/Libraries/LibWeb/CMakeLists.txt @@ -823,9 +823,10 @@ set(SOURCES WebDriver/Response.cpp WebDriver/Screenshot.cpp WebDriver/TimeoutsConfiguration.cpp - WebGL/ANGLEInstancedArrays.cpp + WebGL/Extensions/ANGLEInstancedArrays.cpp + WebGL/Extensions/OESVertexArrayObject.cpp + WebGL/Extensions/WebGLVertexArrayObjectOES.cpp WebGL/EventNames.cpp - WebGL/OESVertexArrayObject.cpp WebGL/OpenGLContext.cpp WebGL/WebGL2RenderingContext.cpp WebGL/WebGLActiveInfo.cpp @@ -846,7 +847,6 @@ set(SOURCES WebGL/WebGLTransformFeedback.cpp WebGL/WebGLUniformLocation.cpp WebGL/WebGLVertexArrayObject.cpp - WebGL/WebGLVertexArrayObjectOES.cpp WebIDL/AbstractOperations.cpp WebIDL/Buffers.cpp WebIDL/CallbackType.cpp diff --git a/Libraries/LibWeb/Forward.h b/Libraries/LibWeb/Forward.h index 8a9d123396b..a611792d26f 100644 --- a/Libraries/LibWeb/Forward.h +++ b/Libraries/LibWeb/Forward.h @@ -841,8 +841,6 @@ struct OscillatorOptions; } namespace Web::WebGL { -class ANGLEInstancedArrays; -class OESVertexArrayObject; class OpenGLContext; class WebGL2RenderingContext; class WebGLActiveInfo; @@ -860,6 +858,11 @@ class WebGLSync; class WebGLTexture; class WebGLUniformLocation; class WebGLVertexArrayObject; +} + +namespace Web::WebGL::Extensions { +class ANGLEInstancedArrays; +class OESVertexArrayObject; class WebGLVertexArrayObjectOES; } diff --git a/Libraries/LibWeb/WebGL/ANGLEInstancedArrays.cpp b/Libraries/LibWeb/WebGL/Extensions/ANGLEInstancedArrays.cpp similarity index 95% rename from Libraries/LibWeb/WebGL/ANGLEInstancedArrays.cpp rename to Libraries/LibWeb/WebGL/Extensions/ANGLEInstancedArrays.cpp index a1b1c74c2c3..ed6b8011ae9 100644 --- a/Libraries/LibWeb/WebGL/ANGLEInstancedArrays.cpp +++ b/Libraries/LibWeb/WebGL/Extensions/ANGLEInstancedArrays.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include @@ -15,7 +15,7 @@ #include #include -namespace Web::WebGL { +namespace Web::WebGL::Extensions { GC_DEFINE_ALLOCATOR(ANGLEInstancedArrays); diff --git a/Libraries/LibWeb/WebGL/ANGLEInstancedArrays.h b/Libraries/LibWeb/WebGL/Extensions/ANGLEInstancedArrays.h similarity index 96% rename from Libraries/LibWeb/WebGL/ANGLEInstancedArrays.h rename to Libraries/LibWeb/WebGL/Extensions/ANGLEInstancedArrays.h index f2bf80a0244..ccdba82d50a 100644 --- a/Libraries/LibWeb/WebGL/ANGLEInstancedArrays.h +++ b/Libraries/LibWeb/WebGL/Extensions/ANGLEInstancedArrays.h @@ -10,7 +10,7 @@ #include #include -namespace Web::WebGL { +namespace Web::WebGL::Extensions { class ANGLEInstancedArrays : public Bindings::PlatformObject { WEB_PLATFORM_OBJECT(ANGLEInstancedArrays, Bindings::PlatformObject); diff --git a/Libraries/LibWeb/WebGL/ANGLEInstancedArrays.idl b/Libraries/LibWeb/WebGL/Extensions/ANGLEInstancedArrays.idl similarity index 100% rename from Libraries/LibWeb/WebGL/ANGLEInstancedArrays.idl rename to Libraries/LibWeb/WebGL/Extensions/ANGLEInstancedArrays.idl diff --git a/Libraries/LibWeb/WebGL/OESVertexArrayObject.cpp b/Libraries/LibWeb/WebGL/Extensions/OESVertexArrayObject.cpp similarity index 95% rename from Libraries/LibWeb/WebGL/OESVertexArrayObject.cpp rename to Libraries/LibWeb/WebGL/Extensions/OESVertexArrayObject.cpp index 49951e21b0e..26799859861 100644 --- a/Libraries/LibWeb/WebGL/OESVertexArrayObject.cpp +++ b/Libraries/LibWeb/WebGL/Extensions/OESVertexArrayObject.cpp @@ -5,9 +5,10 @@ */ #include -#include #include -#include +#include +#include +#include #include #include @@ -15,7 +16,7 @@ #include #include -namespace Web::WebGL { +namespace Web::WebGL::Extensions { GC_DEFINE_ALLOCATOR(OESVertexArrayObject); diff --git a/Libraries/LibWeb/WebGL/OESVertexArrayObject.h b/Libraries/LibWeb/WebGL/Extensions/OESVertexArrayObject.h similarity index 93% rename from Libraries/LibWeb/WebGL/OESVertexArrayObject.h rename to Libraries/LibWeb/WebGL/Extensions/OESVertexArrayObject.h index ef34332518c..9868a96aa05 100644 --- a/Libraries/LibWeb/WebGL/OESVertexArrayObject.h +++ b/Libraries/LibWeb/WebGL/Extensions/OESVertexArrayObject.h @@ -9,9 +9,8 @@ #include #include #include -#include -namespace Web::WebGL { +namespace Web::WebGL::Extensions { class OESVertexArrayObject : public Bindings::PlatformObject { WEB_PLATFORM_OBJECT(OESVertexArrayObject, Bindings::PlatformObject); diff --git a/Libraries/LibWeb/WebGL/OESVertexArrayObject.idl b/Libraries/LibWeb/WebGL/Extensions/OESVertexArrayObject.idl similarity index 94% rename from Libraries/LibWeb/WebGL/OESVertexArrayObject.idl rename to Libraries/LibWeb/WebGL/Extensions/OESVertexArrayObject.idl index 177f2ce9126..cd7cd7c209f 100644 --- a/Libraries/LibWeb/WebGL/OESVertexArrayObject.idl +++ b/Libraries/LibWeb/WebGL/Extensions/OESVertexArrayObject.idl @@ -1,5 +1,5 @@ +#import #import -#import // https://registry.khronos.org/webgl/extensions/OES_vertex_array_object/ // NOTE: Original OES_vertex_array_object name is changed to title case, diff --git a/Libraries/LibWeb/WebGL/WebGLVertexArrayObjectOES.cpp b/Libraries/LibWeb/WebGL/Extensions/WebGLVertexArrayObjectOES.cpp similarity index 90% rename from Libraries/LibWeb/WebGL/WebGLVertexArrayObjectOES.cpp rename to Libraries/LibWeb/WebGL/Extensions/WebGLVertexArrayObjectOES.cpp index a047ddb76bd..c20169674c4 100644 --- a/Libraries/LibWeb/WebGL/WebGLVertexArrayObjectOES.cpp +++ b/Libraries/LibWeb/WebGL/Extensions/WebGLVertexArrayObjectOES.cpp @@ -8,9 +8,9 @@ #include #include #include -#include +#include -namespace Web::WebGL { +namespace Web::WebGL::Extensions { GC_DEFINE_ALLOCATOR(WebGLVertexArrayObjectOES); diff --git a/Libraries/LibWeb/WebGL/WebGLVertexArrayObjectOES.h b/Libraries/LibWeb/WebGL/Extensions/WebGLVertexArrayObjectOES.h similarity index 95% rename from Libraries/LibWeb/WebGL/WebGLVertexArrayObjectOES.h rename to Libraries/LibWeb/WebGL/Extensions/WebGLVertexArrayObjectOES.h index 8cfc7d0d562..32dff7e4e9a 100644 --- a/Libraries/LibWeb/WebGL/WebGLVertexArrayObjectOES.h +++ b/Libraries/LibWeb/WebGL/Extensions/WebGLVertexArrayObjectOES.h @@ -10,7 +10,7 @@ #include #include -namespace Web::WebGL { +namespace Web::WebGL::Extensions { class WebGLVertexArrayObjectOES : public WebGLObject { WEB_PLATFORM_OBJECT(WebGLVertexArrayObjectOES, WebGLObject); diff --git a/Libraries/LibWeb/WebGL/WebGLVertexArrayObjectOES.idl b/Libraries/LibWeb/WebGL/Extensions/WebGLVertexArrayObjectOES.idl similarity index 100% rename from Libraries/LibWeb/WebGL/WebGLVertexArrayObjectOES.idl rename to Libraries/LibWeb/WebGL/Extensions/WebGLVertexArrayObjectOES.idl diff --git a/Libraries/LibWeb/WebGL/WebGLRenderingContext.cpp b/Libraries/LibWeb/WebGL/WebGLRenderingContext.cpp index 6fddb746e00..6351c8b2641 100644 --- a/Libraries/LibWeb/WebGL/WebGLRenderingContext.cpp +++ b/Libraries/LibWeb/WebGL/WebGLRenderingContext.cpp @@ -13,9 +13,9 @@ #include #include #include -#include #include -#include +#include +#include #include #include #include @@ -191,7 +191,7 @@ JS::Object* WebGLRenderingContext::get_extension(String const& name) if (Infra::is_ascii_case_insensitive_match(name, "ANGLE_instanced_arrays"sv)) { if (!m_angle_instanced_arrays_extension) { - m_angle_instanced_arrays_extension = MUST(ANGLEInstancedArrays::create(realm(), *this)); + m_angle_instanced_arrays_extension = MUST(Extensions::ANGLEInstancedArrays::create(realm(), *this)); } VERIFY(m_angle_instanced_arrays_extension); @@ -200,7 +200,7 @@ JS::Object* WebGLRenderingContext::get_extension(String const& name) if (Infra::is_ascii_case_insensitive_match(name, "OES_vertex_array_object"sv)) { if (!m_oes_vertex_array_object_extension) { - m_oes_vertex_array_object_extension = MUST(OESVertexArrayObject::create(realm(), *this)); + m_oes_vertex_array_object_extension = MUST(Extensions::OESVertexArrayObject::create(realm(), *this)); } VERIFY(m_oes_vertex_array_object_extension); diff --git a/Libraries/LibWeb/WebGL/WebGLRenderingContext.h b/Libraries/LibWeb/WebGL/WebGLRenderingContext.h index e99d665df41..dc7d3372c9b 100644 --- a/Libraries/LibWeb/WebGL/WebGLRenderingContext.h +++ b/Libraries/LibWeb/WebGL/WebGLRenderingContext.h @@ -81,8 +81,8 @@ private: // Extensions // "Multiple calls to getExtension with the same extension string, taking into account case-insensitive comparison, must return the same object as long as the extension is enabled." - GC::Ptr m_angle_instanced_arrays_extension; - GC::Ptr m_oes_vertex_array_object_extension; + GC::Ptr m_angle_instanced_arrays_extension; + GC::Ptr m_oes_vertex_array_object_extension; virtual void set_error(GLenum error) override; }; diff --git a/Libraries/LibWeb/idl_files.cmake b/Libraries/LibWeb/idl_files.cmake index f929040d7e4..ba26f69874f 100644 --- a/Libraries/LibWeb/idl_files.cmake +++ b/Libraries/LibWeb/idl_files.cmake @@ -380,8 +380,9 @@ libweb_js_bindings(WebAudio/OscillatorNode) libweb_js_bindings(WebAudio/PannerNode) libweb_js_bindings(WebAudio/PeriodicWave) libweb_js_bindings(WebAudio/StereoPannerNode) -libweb_js_bindings(WebGL/ANGLEInstancedArrays) -libweb_js_bindings(WebGL/OESVertexArrayObject) +libweb_js_bindings(WebGL/Extensions/ANGLEInstancedArrays) +libweb_js_bindings(WebGL/Extensions/OESVertexArrayObject) +libweb_js_bindings(WebGL/Extensions/WebGLVertexArrayObjectOES) libweb_js_bindings(WebGL/WebGL2RenderingContext) libweb_js_bindings(WebGL/WebGLActiveInfo) libweb_js_bindings(WebGL/WebGLBuffer) @@ -400,7 +401,6 @@ libweb_js_bindings(WebGL/WebGLTexture) libweb_js_bindings(WebGL/WebGLTransformFeedback) libweb_js_bindings(WebGL/WebGLUniformLocation) libweb_js_bindings(WebGL/WebGLVertexArrayObject) -libweb_js_bindings(WebGL/WebGLVertexArrayObjectOES) libweb_js_bindings(WebIDL/DOMException) libweb_js_bindings(WebSockets/WebSocket) libweb_js_bindings(WebVTT/VTTCue) diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index df69f22cf8e..a88bdab9645 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -4440,6 +4440,7 @@ using namespace Web::UserTiming; using namespace Web::WebAssembly; using namespace Web::WebAudio; using namespace Web::WebGL; +using namespace Web::WebGL::Extensions; using namespace Web::WebIDL; using namespace Web::WebVTT; using namespace Web::XHR;