Commit graph

23 commits

Author SHA1 Message Date
Psychpsyo
6ae9f21845 LibWeb: Implement makeXRCompatible() enough to work 2026-04-03 13:14:33 +02:00
Undefine
3ac56aad7b LibWeb: Don't lie about supported WebGL extensions unless told to do so
We shouldn't say we support something we don't, unless we are told to
do so by the flag that exposes experimental interfaces.
2026-03-11 20:19:45 +01:00
Undefine
c2aeb9ea73 LibWeb: Move WebGL extensions requests to WebGLRenderingContextBase
Instead of making the extension objects request the OpenGL extensions
themselves, we can do it here since we already store that information
to be able to compute the list of available extensions. As bonus points
this makes it impossible to forget to request an OpenGL extension when
implementing a new WebGL one.
2026-03-11 20:19:45 +01:00
Undefine
09f592a34c 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.
2026-03-11 20:19:45 +01:00
Undefine
d7bdc5b6c8 LibWeb: Refactor WebGL extensions to use a factory field and a hash map
Instead of manually listing out all the extensions which leads to
a bunch of if cases that are more or less the same, lets replace all
the fields with a hash map and introduces a factory field in the
already existing list of extensions. This allows us to neatly compact
the `get_extension` and makes implementing more extensions trivialy
easy.
2026-03-11 20:19:45 +01:00
Undefine
b4dbb0380d LibWeb: Split checking WebGL extensions away from OpenGLContext
This allows us to move the list of possible extensions to the WebGL
context class, which will need it in a later commit. It also makes
`OpenGLContext` more specialized towards only handling OpenGL itself.
2026-03-11 20:19:45 +01:00
Undefine
fa8e122dd4 LibWeb: Move enabling of WebGL compressed texture formats to extensions 2026-03-11 20:19:45 +01:00
Undefine
3101565f05 LibWeb: Unify WebGL handling code in WebGLRenderingContextBase 2026-03-11 20:19:45 +01:00
Zaggy1024
e6dbcccb99 LibGfx+LibMedia: Send video frames to Skia as subsampled YUV
This saves us from having our own color conversion code, which was
taking up a fair amount of time in VideoDataProvider. With this change,
we should be able to play high resolution videos without interruptions
on machines where the CPU can keep up with decoding.

In order to make this change, ImmutableBitmap is now able to be
constructed with YUV data instead of an RBG bitmap. It holds onto a
YUVData instance that stores the buffers of image data, since Skia
itself doesn't take ownership of them.

In order to support greater than 8 bits of color depth, we normalize
the 10- or 12-bit color values into a 16-bit range.
2026-01-22 19:44:36 +01:00
Undefine
2107142cdb LibWeb: Make WebGLRenderingContextBase derive from PlatformObject
This resolves a bunch of FIXMEs and removes a bunch sketchy raw
pointers and hacks.
2026-01-10 13:22:17 +01:00
InvalidUsernameException
88c4814de6 LibGfx+LibWeb: Extract bitmap-to-buffer conversion into LibGfx
This factors the conversion logic to be independent from WebGL code,
allowing us to write unit tests for it that can run in CI (since WebGL
can't run in CI).
2025-11-28 18:32:48 +01:00
InvalidUsernameException
28ba610f32 Everywhere: Avoid large rebuilds when editing (Immutable)Bitmap headers
This reduces the number of recompiled files as follow:
- Bitmap.h: 1309 -> 101
- ImmutableBitmap.h: 1218 -> 75
2025-11-28 18:32:48 +01:00
Undefine
044ac2dd28 LibWeb: Fix WebGL getError
getError was just calling out to glGetError and never checking our
error value that we were maintaining ourselves.
2025-11-06 19:02:36 +01:00
Undefine
e7aeb71d29 LibWeb: Move WebGL error variable to WebGLRenderingContextBase
Implementations in both WebGL1 and WebGL2 were the same and most
probably will stay the same.
2025-11-06 19:02:36 +01:00
Luke Wilde
8adde0980a LibWeb/WebGL: Respect UNPACK_PREMULTIPLY_ALPHA
Fixes splats on https://superspl.at having dark splotches, as they
expect textures with unpremultiplied alpha.
2025-11-04 17:06:24 +01:00
Luke Wilde
3ca4ff6037 LibWeb/WebGL: Don't attempt to do texture transforms on an empty texture
Skia will not give us a surface if the width or height is zero.
2025-10-28 10:05:56 -07:00
Luke Wilde
d733bf54cc LibWeb/WebGL: Avoid copying canvas surface when uploading it 2025-10-25 12:56:17 +02:00
Luke Wilde
d65f0e4490 LibWeb/WebGL: Calculate the correct pitch for compacted types
It's not correct to multiply the number of components by the number of
bytes, since compact formats such as 4_4_4_4 have 4 components but
_always_ stored in 2 bytes, not 8 if you were to do such a
multiplication.

Fixes textures on Google Maps having large blank stripes.
2025-10-25 12:56:17 +02:00
Luke Wilde
3e7061da40 LibWeb/WebGL: Respect UNPACK_FLIP_Y_WEBGL pixel storage parameter
When this is true, we have to vertically flip TexImageSource provided
images before uploading them.

Fixes several graphical glitches on Google Maps.
Fixes globe being upside down on Shopify's homepage.
Likely fixes more websites.
2025-10-25 12:56:17 +02:00
Aliaksandr Kalenik
20490d146c LibWeb/WebGL: Deduplicate read_and_pixel_convert_texture_image_source()
After we commited code produced by WebGL generator this function ended
up duplicated between WebGL 1 and 2 contexts.
2025-10-02 18:41:02 +02:00
Aliaksandr Kalenik
4bf9bf7972 LibWeb: Merge WebGLRenderingContextBase into WebGLRenderingContext
There is no need to have a separate class for WebGLRenderingContextBase
mixin.
2024-12-03 23:35:45 +01:00
Shannon Booth
f87041bf3a LibGC+Everywhere: Factor out a LibGC from LibJS
Resulting in a massive rename across almost everywhere! Alongside the
namespace change, we now have the following names:

 * JS::NonnullGCPtr -> GC::Ref
 * JS::GCPtr -> GC::Ptr
 * JS::HeapFunction -> GC::Function
 * JS::CellImpl -> GC::Cell
 * JS::Handle -> GC::Root
2024-11-15 14:49:20 +01:00
Timothy Flynn
93712b24bf Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Renamed from Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.cpp (Browse further)