浏览代码

LibWeb/WebGL: Add extensions APIs to WebGLRenderingContextBase

These currently return nothing, as we don't currently support any WebGL
extensions.
Luke Wilde 3 年之前
父节点
当前提交
aa77c26b60

+ 22 - 0
Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.cpp

@@ -71,6 +71,28 @@ void WebGLRenderingContextBase::needs_to_present()
     m_canvas_element->layout_node()->set_needs_display();
 }
 
+Optional<Vector<String>> WebGLRenderingContextBase::get_supported_extensions() const
+{
+    if (m_context_lost)
+        return Optional<Vector<String>> {};
+
+    dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContextBase::get_supported_extensions()");
+
+    // FIXME: We don't currently support any extensions.
+    return Vector<String> {};
+}
+
+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)

+ 3 - 0
Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.h

@@ -23,6 +23,9 @@ public:
 
     void present();
 
+    Optional<Vector<String>> 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);
 

+ 3 - 0
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<DOMString>? getSupportedExtensions();
+    object? getExtension(DOMString name);
+
     undefined clear(GLbitfield mask);
     undefined clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);