Commit graph

11 commits

Author SHA1 Message Date
Aliaksandr Kalenik
a80babffb6 LibWeb+Compositor: Run canvas contexts in the Compositor
Canvas rendering is a major remaining path where WebContent directly
owns GPU-facing drawing state. Back 2D and WebGL canvas contexts with
remote Compositor transports, so WebContent talks to canvas surfaces
through IPC while the Compositor owns the rasterization resources.

This is a large step toward GPU sandboxing because canvas GPU work now
lives behind the Compositor boundary. It also gives OffscreenCanvas the
process-independent canvas plumbing that HTMLCanvasElement now uses,
making worker-owned canvases possible without another WebContent-local
rendering path.
2026-06-17 19:07:32 +02:00
Aliaksandr Kalenik
5b856595b3 Meta+LibWeb/WebGL: Route all GL calls through generated GLFunctions
LibWeb's WebGL implementation currently reaches ANGLE by calling glFoo()
throughout the WebGL context and extension code. That ties the WebGL
spec layer to the concrete GL executor. A future backend that records
operations, sends them to another process, or executes them from the
Compositor would otherwise need to duplicate the WebGL logic or edit
every call site again.

Introduce GLFunctions as an explicit boundary between WebGL semantics
and GL execution. GLFunctions.json lists the GL entry points used by the
implementation, and the generator emits one forwarding method per entry
point. OpenGLContext implements those methods today, so the current
in-process ANGLE path keeps the same behavior while all callers go
through a single replaceable interface.

That boundary is needed before canvas/WebGL rendering can move to the
Compositor: the WebGL context code can keep doing validation, state
tracking, and spec-visible error handling in LibWeb, while a later
implementation can record the same GL calls and replay them where the
canvas surface is produced. The JSON source also gives the recorder and
replayer one shared description of argument shapes, avoiding two
hand-written views of the GL API drifting apart.
2026-06-13 01:58:43 +02:00
Shannon Booth
97abc707c7 LibWeb/Bindings: Generate buffer typedefs as variants
Represent BufferSource and ArrayBufferView as ordinary IDL typedefs over
their underlying union types, instead of special casing in the IDL
generator. This allows the union conversion/return machinery handle
these types consistently with other typedefs, which removes buffer
specific paths from the IDL generator.

This necessitates changing the WebIDL::BufferSource and
WebIDL::ArrayBufferView classes as views over these variants. This
replaces the old GC backed BufferableObject wrapper structure and
provide convenience helpers to determine things such as the byte length,
byte offset, backing buffer, and typed-array APIs.
2026-05-30 11:22:08 +02:00
Shannon Booth
7893f02150 LibWeb: Port a bunch of GC::Root to GC::Ref / GC::Ptr 2026-05-26 21:43:55 +02:00
Shannon Booth
069465c04f LibWeb/WebGL: Add missing null check in tex_sub_image2d 2026-05-26 21:43:55 +02:00
Shannon Booth
637fd51595 LibWeb: Unify WebIDL C++ type generation
Represent WebIDL C++ types with a single CppType model that tracks
nullability, optional presence, and contained storage.

GC-like values now use GC::Ref/GC::Ptr directly, while containers choose
"plain", "Root", or "Conservative" container types depending on what
they contain. For example, sequence<Element> becomes a RootVector of
GC::Ref values, while sequence<SomeDictionary> becomes a
ConservativeVector only when the dictionary contains GC-like values.
This moves the generated bindings away from wrapping GC values in
GC::Root by default.

This has broad fallout as the types passed to interfaces for GC
objects changes almost fully across the board.
2026-05-23 18:26:12 +02:00
Jonathan Gamble
793a4eeb8e Meta: Support nullable BufferSource as Optional in IDL generator
This IDL change is needed for webaudio's WaveShaperNode, where a
null BufferSource for a curve attribute results in a zero-length buffer.

WebGL also has a nullable BufferSource arg in bufferData(...). But
there, a null data/srcData value returns GL_INVALID_VALUE.
2026-03-27 00:03:39 +01:00
Undefine
e9e959876f LibWeb: Set error when buffer passed to WebGL readPixels is null 2026-02-02 11:22:52 -07:00
Undefine
f373ab7011 LibWeb: Bind WebGL uniform locations to their respective program
The spec mandates that each uniform location object only gets used with
the program it was created with.
2025-11-27 19:19:54 +01:00
Undefine
2bf35881f9 LibWeb: Ensure compressed* WebGL functions don't allow disabled formats 2025-11-06 19:02:36 +01:00
Undefine
c70886ab1f LibWeb: Split off WebGLRenderingContextImpl to Impl and Overloads
This is more like what the IDL files specify with two different mixins,
but the inheritance structure here is slightly different for easier
maintenance. This will also allow the WebGL2 Impl to inherit from the
WebGL1 Impl as WebGL versions don't share the functions defined in the
Overloads interfaces.
2025-11-05 02:19:32 +01:00