Commit graph

100 commits

Author SHA1 Message Date
Luke Wilde
d915b574ab LibWeb/WebGL: Implement pixel format conversion for TexImageSource
This is done by using the combination of format and type to map to the
appropriate Skia bitmap type. With this, we then read the SkImage of
the TexImageSource into a new SkPixmap with the destination format
information and holding an appropriately sized buffer. Once created,
readPixels is called to convert and write the image into the buffer.
2025-01-21 21:36:05 +01:00
Luke Wilde
d13dd76818 LibWeb/WebGL: Map DEPTH_STENCIL to DEPTH24_STENCIL8 for WebGL 1 too 2025-01-21 21:36:05 +01:00
Luke Wilde
4cb5a980e5 LibWeb/WebGL: Implement getAttachedShaders 2025-01-21 21:36:05 +01:00
Luke Wilde
aa99853a5c LibWeb/WebGL: Track the shaders attached to a program
This is required to return original references to the shaders attached
to a program from getAttachedShaders. This is required for Figma (and
likely all other Emscripten compiled applications that use WebGL) to
get it's own generated shader IDs from the shaders returned from
getAttachedShaders.
2025-01-21 21:36:05 +01:00
Timothy Flynn
85b424464a AK+Everywhere: Rename verify_cast to as
Follow-up to fc20e61e72.
2025-01-21 11:34:06 -05:00
Luke Wilde
927bdf909b LibWeb/WebGL2: Implement a bunch of parameters read by CreepJS
This also fixes GLfloat and GLboolean to use their appropriate glGet
functions.
2025-01-18 10:23:07 +01:00
Andrew Kaster
7c3b590d44 LibWeb/WebGL2: Implement MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS
This is a parameter for getParameter()
2025-01-15 11:25:22 +00:00
Andrew Kaster
f5e06a2457 LibWeb/WebGL2: Implement MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS
This is a parameter for getParameter()
2025-01-15 11:25:22 +00:00
Luke Wilde
876d26c32e LibWeb/WebGL: Respect subarrays in readPixels 2025-01-08 17:55:17 +03:00
Luke Wilde
71746c47c2 LibWeb/WebGL: Bind default frame/render buffer when binding is null
This fixes the depth issues on github.com, as the depth commands are
now sent to the right frame/render buffer.
2025-01-08 17:55:17 +03:00
Luke Wilde
e5d59a2d42 LibWeb/WebGL2: Implement getSyncParameter 2025-01-08 17:55:17 +03:00
Luke Wilde
6bf6cd3f19 LibWeb/WebGL: Account for subarrays in tex(Sub)Image{2D,3D}
This allows Ruffle to correctly upload textures.
2025-01-08 17:55:17 +03:00
Luke Wilde
2b20b8aaff LibWeb/WebGL: Return correct types from get{Shader,Program}Parameter
Returning numbers instead of booleans for the statuses made Ruffle
(through the wgpu crate) think a shader/program failed to compile/link,
as it does a strict type comparison.
2025-01-08 17:55:17 +03:00
Luke Wilde
c30c1d65f4 LibWeb/WebGL2: Implement clearBuffer{fv,iv,uiv,fi} 2025-01-08 17:55:17 +03:00
Luke Wilde
f627c91bf3 LibWeb/WebGL2: Implement deleteSampler 2025-01-08 17:55:17 +03:00
Luke Wilde
09ad685238 LibWeb/WebGL2: Implement samplerParameter{i,f} 2025-01-08 17:55:17 +03:00
Luke Wilde
aa2eb7ac7d LibWeb/WebGL2: Implement MAX_VARYING_COMPONENTS parameter 2025-01-08 17:55:17 +03:00
Luke Wilde
c4ff1a1eb0 LibWeb/WebGL2: Implement MAX_FRAGMENT_UNIFORM_BLOCKS parameter 2025-01-08 17:55:17 +03:00
Luke Wilde
0390a2328c LibWeb/WebGL2: Implement MAX_ELEMENT_INDEX parameter 2025-01-08 17:55:17 +03:00
Luke Wilde
2d94953047 LibWeb/WebGL2: Implement COPY_WRITE_BUFFER_BINDING parameter 2025-01-08 17:55:17 +03:00
Luke Wilde
af8cb211eb LibWeb/WebGL2: Implement COPY_READ_BUFFER_BINDING parameter 2025-01-08 17:55:17 +03:00
Luke Wilde
47699360e5 LibWeb/WebGL2: Implement TEXTURE_BINDING_2D_ARRAY parameter 2025-01-08 17:55:17 +03:00
Luke Wilde
b8416570e0 LibWeb/WebGL2: Implement UNIFORM_BUFFER_BINDING parameter 2025-01-08 17:55:17 +03:00
Luke Wilde
9b4bad4255 LibWeb/WebGL: Factor in subarrays for typed arrays for generic methods 2025-01-08 17:55:17 +03:00
Luke Wilde
42cce393f4 LibWeb/WebGL2: Implement drawElementsInstanced 2025-01-08 17:55:17 +03:00
Luke Wilde
b6bc5912d6 LibWeb/WebGL: Implement tex(Sub)Image2D with TexImageSource 2025-01-08 17:55:17 +03:00
Luke Wilde
8e453d5069 LibWeb/WebGL: Preserve original bound objects to return in getParameter
Required by https://qwasm2.m-h.org.uk, which adds a custom `name`
attribute to objects it generates. It then gets some of these objects
out with getParameter, and expects the `name` attribute to be there.
2025-01-08 17:55:17 +03:00
Luke Wilde
c067271897 LibWeb/WebGL2: Implement getActiveUniformBlockParameter 2025-01-08 17:55:17 +03:00
Luke Wilde
191ceb0f61 LibWeb/WebGL2: Implement getActiveUniformBlockName 2025-01-08 17:55:17 +03:00
Luke Wilde
28a73dc392 LibWeb/WebGL: Implement deleteRenderbuffer 2025-01-08 17:55:17 +03:00
Luke Wilde
4e33d8e577 LibWeb/WebGL: Mark clear as a draw operation instead of clearColor 2025-01-08 17:55:17 +03:00
Luke Wilde
e26b524721 LibWeb/WebGL2: Implement invalidateFramebuffer 2025-01-08 17:55:17 +03:00
Luke Wilde
2983ad10bc LibWeb/WebGL2: Correctly handle offsets in uniform(Matrix) functions 2025-01-08 17:55:17 +03:00
Luke Wilde
63b792c205 LibWeb/WebGL2: Implement bufferSubData with offset and length 2025-01-08 17:55:17 +03:00
Luke Wilde
18ea91715b LibWeb/WebGL2: Implement bufferData with offset and length 2025-01-08 17:55:17 +03:00
Aliaksandr Kalenik
07635d4554 LibWeb/WebGL: Set INVALID_OPERATION if object does not belong to context 2024-12-19 13:38:43 +01:00
Aliaksandr Kalenik
fbae24f7a9 LibWeb/WebGL: Don't treat WebGLUniformLocation as WebGLObject
...in code generator. `is_webgl_object_type()` is only supposed to
return true for objects inheriting from WebGLObject.
2024-12-19 13:38:43 +01:00
Aliaksandr Kalenik
cf730870c5 LibWeb: Save WebGL context pointer in WebGLObject
This way we could be sure that context object won't be deallocated
before any of the objects that belong to it.

Having a context pointer is also going to be used in upcoming changes
to generate an INVALID_OPERATION error if an object does not belong to
the context it's being used in.
2024-12-19 13:38:43 +01:00
Luke Wilde
ced5eea610 LibWeb/WebGL2: Implement MAX_COMBINED_UNIFORM_BLOCKS parameter 2024-12-14 09:06:28 +01:00
Luke Wilde
5d383fdd11 LibWeb/WebGL2: Implement MAX_FRAGMENT_INPUT_COMPONENTS parameter 2024-12-14 09:06:28 +01:00
Luke Wilde
f1d194a97a LibWeb/WebGL2: Implement MAX_VERTEX_UNIFORM_BLOCKS parameter 2024-12-14 09:06:28 +01:00
Luke Wilde
a19fb0a759 LibWeb/WebGL2: Implement MAX_DRAW_BUFFERS parameter 2024-12-14 09:06:28 +01:00
Luke Wilde
1fc8353da0 LibWeb/WebGL2: Implement UNIFORM_BUFFER_OFFSET_ALIGNMENT parameter 2024-12-14 09:06:28 +01:00
Luke Wilde
2adacbc8bb LibWeb/WebGL2: Implement MAX_UNIFORM_BUFFER_BINDINGS parameter 2024-12-14 09:06:28 +01:00
Luke Wilde
0e5e0d922f LibWeb/WebGL2: Implement MAX_UNIFORM_BLOCK_SIZE parameter 2024-12-14 09:06:28 +01:00
Luke Wilde
791c258754 LibWeb/WebGL2: Implement MAX_VERTEX_UNIFORM_COMPONENTS parameter 2024-12-14 09:06:28 +01:00
Luke Wilde
b6388abb9b LibWeb/WebGL2: Implement MAX_COLOR_ATTACHMENTS parameter 2024-12-14 09:06:28 +01:00
Luke Wilde
99a501bd09 LibWeb/WebGL2: Implement MAX_ARRAY_TEXTURE_LAYERS parameter 2024-12-14 09:06:28 +01:00
Luke Wilde
6e42f401f9 LibWeb/WebGL2: Implement texImage3D with ArrayBufferView and offset 2024-12-14 09:06:28 +01:00
Luke Wilde
50b4d65540 LibWeb/WebGL2: Implement texImage2D with ArrayBufferView and offset 2024-12-14 09:06:28 +01:00