Commit Graph

4 Commits

Author SHA1 Message Date
Aliaksandr Kalenik
980b61470c LibAccelGfx+LibWeb+WebContent: Handle OpenGL Context init errors
Now, if OpenGL context fails, an error will be returned and a message
printed, instead of crashing.
2024-01-24 19:43:51 +01:00
Aliaksandr Kalenik
21364711da LibWeb/WebGL: Switch context in AccelGfxContext destructor
Destructor of AccelGfxContext needs to make sure that correct OpenGL
context is active so that destructors of its members could proceed
destroying they resources (for example framebuffer owned by
AccelGfx::Canvas).

Fixes https://github.com/SerenityOS/serenity/issues/22879
2024-01-21 16:09:54 +01:00
Aliaksandr Kalenik
215931daac LibWeb/WebGL: Make Context::activate() non-virtual
This method is only relevant for AccelGfx so no reason to keep it
virtual.
2024-01-21 16:09:54 +01:00
Aliaksandr Kalenik
271c9d1ae9 LibWeb: Use platform's OpenGL in WebGL when it is available
This change makes WebGL to use LibGL only in SerenityOS, and the
platform's OpenGL driver in Ladybird if it is available.

This is implemented by introducing wrapper class between WebGL and
OpenGL calls. This way it will also be possible to provide more
complete support in Ladybird even if we don't yet have all needed
calls implemented in LibGL.

For now, the wrapper class makes all GL calls virtual. However, we
can get rid of this and implement it at compile time in case of
performance problems.
2024-01-20 18:21:56 +01:00