mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 22:49:47 +00:00
Use `Float32Array or sequence<GLfloat>` instead of `BufferSource or sequence<GLfloat>`. This meaningfully changes behavior for `Float16Array` and `Float64Array`: they are now converted to `sequence<GLfloat>` by iterating the typed array, rather than being treated as a `BufferSource`. As a result, many WebGL calls now work correctly where we previously crashed in `VERIFY_NOT_REACHED()` due to the assumption that a `BufferSource` was always a `Float32Array`. Fixes https://github.com/LadybirdBrowser/ladybird/issues/5962
28 lines
1 KiB
C++
28 lines
1 KiB
C++
/*
|
|
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/Forward.h>
|
|
#include <LibWeb/WebIDL/Types.h>
|
|
|
|
namespace Web::WebGL {
|
|
|
|
// NOTE: This is the Variant created by the IDL wrapper generator, and needs to be updated accordingly.
|
|
using TexImageSource = Variant<GC::Root<HTML::ImageBitmap>, GC::Root<HTML::ImageData>, GC::Root<HTML::HTMLImageElement>, GC::Root<HTML::HTMLCanvasElement>, GC::Root<HTML::OffscreenCanvas>, GC::Root<HTML::HTMLVideoElement>>;
|
|
|
|
// FIXME: This object should inherit from Bindings::PlatformObject and implement the WebGLRenderingContextBase IDL interface.
|
|
// We should make WebGL code generator to produce implementation for this interface.
|
|
class WebGLRenderingContextBase {
|
|
public:
|
|
using Float32List = Variant<GC::Root<JS::Float32Array>, Vector<float>>;
|
|
|
|
virtual GC::Cell const* gc_cell() const = 0;
|
|
virtual void visit_edges(JS::Cell::Visitor&) = 0;
|
|
virtual OpenGLContext& context() = 0;
|
|
};
|
|
|
|
}
|