mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibWeb: Unify WebGL handling code in WebGLRenderingContextBase
This commit is contained in:
committed by
Jelle Raaijmakers
parent
5a029b4533
commit
3101565f05
Notes:
github-actions[bot]
2026-03-11 19:21:46 +00:00
Author: https://github.com/cqundefine Commit: https://github.com/LadybirdBrowser/ladybird/commit/3101565f057 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8285 Reviewed-by: https://github.com/gmta ✅
@@ -9,6 +9,7 @@
|
||||
#include <LibGfx/BitmapExportResult.h>
|
||||
#include <LibJS/Runtime/DataView.h>
|
||||
#include <LibJS/Runtime/TypedArray.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/WebGL/Types.h>
|
||||
#include <LibWeb/WebIDL/Buffers.h>
|
||||
@@ -46,14 +47,19 @@ public:
|
||||
|
||||
virtual OpenGLContext& context() = 0;
|
||||
|
||||
Optional<Vector<String>> get_supported_extensions();
|
||||
JS::Object* get_extension(String const& name);
|
||||
|
||||
protected:
|
||||
WebGLRenderingContextBase(JS::Realm&);
|
||||
|
||||
virtual bool ext_texture_filter_anisotropic_extension_enabled() const = 0;
|
||||
virtual bool angle_instanced_arrays_extension_enabled() const = 0;
|
||||
virtual bool oes_standard_derivatives_extension_enabled() const = 0;
|
||||
virtual bool webgl_draw_buffers_extension_enabled() const = 0;
|
||||
virtual ReadonlySpan<WebIDL::UnsignedLong> enabled_compressed_texture_formats() const = 0;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
bool ext_texture_filter_anisotropic_extension_enabled() const;
|
||||
bool angle_instanced_arrays_extension_enabled() const;
|
||||
bool oes_standard_derivatives_extension_enabled() const;
|
||||
bool webgl_draw_buffers_extension_enabled() const;
|
||||
ReadonlySpan<WebIDL::UnsignedLong> enabled_compressed_texture_formats() const;
|
||||
|
||||
template<typename T>
|
||||
static ErrorOr<Span<T>> get_offset_span(Span<T> src_span, WebIDL::UnsignedLongLong src_offset, WebIDL::UnsignedLong src_length_override = 0)
|
||||
@@ -165,6 +171,23 @@ protected:
|
||||
|
||||
private:
|
||||
GLenum m_error { 0 };
|
||||
|
||||
Vector<WebIDL::UnsignedLong> m_enabled_compressed_texture_formats;
|
||||
|
||||
// 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<Extensions::ANGLEInstancedArrays> m_angle_instanced_arrays_extension;
|
||||
GC::Ptr<Extensions::EXTBlendMinMax> m_ext_blend_min_max_extension;
|
||||
GC::Ptr<Extensions::EXTColorBufferFloat> m_ext_color_buffer_float_extension;
|
||||
GC::Ptr<Extensions::EXTRenderSnorm> m_ext_render_snorm;
|
||||
GC::Ptr<Extensions::EXTTextureFilterAnisotropic> m_ext_texture_filter_anisotropic;
|
||||
GC::Ptr<Extensions::EXTTextureNorm16> m_ext_texture_norm16;
|
||||
GC::Ptr<Extensions::OESElementIndexUint> m_oes_element_index_uint_object_extension;
|
||||
GC::Ptr<Extensions::OESStandardDerivatives> m_oes_standard_derivatives_object_extension;
|
||||
GC::Ptr<Extensions::OESVertexArrayObject> m_oes_vertex_array_object_extension;
|
||||
GC::Ptr<Extensions::WebGLCompressedTextureS3tc> m_webgl_compressed_texture_s3tc_extension;
|
||||
GC::Ptr<Extensions::WebGLCompressedTextureS3tcSrgb> m_webgl_compressed_texture_s3tc_srgb_extension;
|
||||
GC::Ptr<Extensions::WebGLDrawBuffers> m_webgl_draw_buffers_extension;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user