LibWeb: Introduce a WebGL extension_enabled helper

Since we moved to using a hash map in the previous commits we get
a quite easy way to check if a certain extension is enabled without
having to create a seperate method for each one.
This commit is contained in:
Undefine
2026-03-05 20:54:58 +01:00
committed by Jelle Raaijmakers
parent d7bdc5b6c8
commit 09f592a34c
Notes: github-actions[bot] 2026-03-11 19:21:16 +00:00
4 changed files with 11 additions and 28 deletions

View File

@@ -229,24 +229,9 @@ void WebGLRenderingContextBase::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_enabled_extensions);
}
bool WebGLRenderingContextBase::ext_texture_filter_anisotropic_extension_enabled() const
bool WebGLRenderingContextBase::extension_enabled(StringView extension) const
{
return m_enabled_extensions.contains("EXT_texture_filter_anisotropic"_string);
}
bool WebGLRenderingContextBase::angle_instanced_arrays_extension_enabled() const
{
return m_enabled_extensions.contains("ANGLE_instanced_arrays"_string);
}
bool WebGLRenderingContextBase::oes_standard_derivatives_extension_enabled() const
{
return m_enabled_extensions.contains("OES_standard_derivatives"_string);
}
bool WebGLRenderingContextBase::webgl_draw_buffers_extension_enabled() const
{
return m_enabled_extensions.contains("WEBGL_draw_buffers"_string);
return m_enabled_extensions.contains(MUST(String::from_utf8(extension)));
}
ReadonlySpan<WebIDL::UnsignedLong> WebGLRenderingContextBase::enabled_compressed_texture_formats() const