From aa77c26b60b54cbc5099dc94491288c9c6804d63 Mon Sep 17 00:00:00 2001 From: Luke Wilde Date: Sat, 4 Jun 2022 04:33:00 +0100 Subject: [PATCH] LibWeb/WebGL: Add extensions APIs to WebGLRenderingContextBase These currently return nothing, as we don't currently support any WebGL extensions. --- .../WebGL/WebGLRenderingContextBase.cpp | 22 +++++++++++++++++++ .../LibWeb/WebGL/WebGLRenderingContextBase.h | 3 +++ .../WebGL/WebGLRenderingContextBase.idl | 3 +++ 3 files changed, 28 insertions(+) diff --git a/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.cpp b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.cpp index e03faa92ef..28c2d0d1d0 100644 --- a/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.cpp +++ b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.cpp @@ -71,6 +71,28 @@ void WebGLRenderingContextBase::needs_to_present() m_canvas_element->layout_node()->set_needs_display(); } +Optional> WebGLRenderingContextBase::get_supported_extensions() const +{ + if (m_context_lost) + return Optional> {}; + + dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContextBase::get_supported_extensions()"); + + // FIXME: We don't currently support any extensions. + return Vector {}; +} + +JS::Object* WebGLRenderingContextBase::get_extension(String const& name) const +{ + if (m_context_lost) + return nullptr; + + dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContextBase::get_extension(name='{}')", name); + + // FIXME: We don't currently support any extensions. + return nullptr; +} + void WebGLRenderingContextBase::clear(GLbitfield mask) { if (m_context_lost) diff --git a/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.h b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.h index 3e03e61d3b..2942133cb5 100644 --- a/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.h +++ b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.h @@ -23,6 +23,9 @@ public: void present(); + Optional> get_supported_extensions() const; + JS::Object* get_extension(String const& name) const; + void clear(GLbitfield mask); void clear_color(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); diff --git a/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.idl b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.idl index a2bb454da1..caf0647372 100644 --- a/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.idl +++ b/Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.idl @@ -18,6 +18,9 @@ interface mixin WebGLRenderingContextBase { // IDL code generator. This also allows us to handle the return type ourselves instead of adding the complexity of the // code generator working out the return type and returning the appropriate value to return on context loss. + sequence? getSupportedExtensions(); + object? getExtension(DOMString name); + undefined clear(GLbitfield mask); undefined clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);