Commit graph

29 commits

Author SHA1 Message Date
Undefine
b0fcb35134 LibWeb: Implement WebGL getParameter(GL_VERTEX_ARRAY_BINDING) 2025-11-27 19:19:54 +01: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
7d6212ae71 LibWeb: Ensure WebGL buffers don't mix between index and other data
The spec mandates that a buffer during its lifetime can only get bound
to either an index buffer or any other type.
2025-11-27 19:19:54 +01:00
Jelle Raaijmakers
82dfa69e4e LibWeb/WebGL: Implement getRenderbufferParameter() 2025-11-27 15:51:59 +01:00
Undefine
2a73f779c3 LibWeb: Small WebGL spec fix for vertexAttribPointer 2025-11-06 19:02:36 +01:00
Undefine
5caead88fc LibWeb: Allow WebGL getParameter when WEBGL_draw_buffers is enabled
When that extensions is enabled we should allow getting the parameter
value of MAX_COLOR_ATTACHMENTS_WEBGL.
2025-11-06 19:02:36 +01:00
Undefine
d4ac9fc5c6 LibWeb: Implement WebGL extension OES_standard_derivatives 2025-11-06 19:02:36 +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
5b88b76b84 LibWeb: Deduplicate WebGL1 implementations from WebGL2
This makes the WebGL2 implementation file inherit from the WebGL1
implementation file. This is actually closer to what the IDL files
describe and allows us to not have to maintain two copies of the same
functions.
2025-11-05 02:19:32 +01:00
Undefine
7a1668fe22 LibWeb: Switch include in WebGLRenderingContextImpl to OpenGL ES 3
The reasoning behind this is that in the next commit some of the WebGL2
specific parameters will be moved here. This header is needed to give
us access to those defines. Note that when in WebGL1 nothing from ES3
will be used as it's locked behind WebGL2 checks (it wouldn't work
anyways as we request ES2 from ANGLE).
2025-11-05 02:19:32 +01:00
Undefine
df1aeda955 LibWeb: Deduplicate the WebGL null_terminated_string helper 2025-11-05 02:19:32 +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
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
Undefine
50d66ba74c LibWeb: Implement WebGL getVertexAttribOffset 2025-11-01 16:53:39 -07:00
Undefine
1bc7e9d3f8 LibWeb: Stub out WebGL getUniform
This makes the function return a dummy value instead of undefined
as that fixes a crash while capturing on SpectorJS.
2025-11-01 16:53:39 -07:00
Undefine
a2c659ee6b LibWeb: Implement WebGL getVertexAttrib
This also implements all allowed parameter name values for this
function.
2025-11-01 16:53:39 -07:00
Undefine
2d8b393c76 LibWeb: Implement WebGL getShaderSource 2025-11-01 16:53:39 -07:00
Undefine
932a3328a3 LibWeb: Implement WebGL getParameter(COMPRESSED_TEXTURE_FORMATS) 2025-11-01 16:53:39 -07: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
Luke Wilde
008699c129 LibWeb/WebGL: Return null from getUniformLocation if uniform isn't found 2025-10-25 12:56:17 +02:00
Luke Wilde
b8bbebd3ff LibWeb/WebGL: Upload blank image in texImage2D if pixels is null 2025-10-21 23:29:50 +02:00
Luke Wilde
ab3eb9adab LibWeb/WebGL: Replace manual pointer math with Span
This deduplicates a lot of sensitive pointer math by using Span, which
performs this math for us with more safety checks and with type
information.

This also allows us to use the correctly typed Span for typed arrays,
which automatically fixes srcOffset to now offset by the number of
elements instead of bytes. This goes for srcLengthOverride too.

Fixes the Rive animations on Shopify's homepage not appearing.
Fixes some Unity applications such as ArcViewer having missing
graphics.
2025-10-20 16:26:12 +02:00
Luke Wilde
b15f4424f9 LibWeb/WebGL: Implement the EXT_texture_filter_anisotropic extension 2025-10-20 15:33:33 +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
a6288e12e9 LibWeb/WebGL: Use TexImageSource alias in method signatures 2025-10-02 18:41:02 +02:00
Aliaksandr Kalenik
c75a8fab3b LibWeb/WebGL: Define Int32List exactly like in the spec
Same fix as d54cab60 but applied for Int32List.
2025-09-30 17:57:46 +02:00
Aliaksandr Kalenik
655cd339a7 LibWeb/WebGL: Move Float32List -> Span<float> conversion into helper
This allows to remove lots of duplicated code.
2025-09-30 16:47:16 +02:00
Aliaksandr Kalenik
d54cab60a8 LibWeb/WebGL: Define Float32List exactly like in the spec
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
2025-09-30 16:47:16 +02:00
Luke Wilde
e85b809f8d LibWeb+Meta: Move WebGL rendering context implementations in tree
This copies the latest generated code in tree and then removes code
generation for the WebGL rendering contexts. This is because it didn't
add much value, and we can maintain the generated output instead of
both that and the generator itself.
2025-07-02 19:00:49 +02:00