1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 11:47:34 +00:00

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.
This commit is contained in:
Aliaksandr Kalenik 2024-01-18 20:29:09 +01:00 committed by Andreas Kling
parent c6289fad49
commit 271c9d1ae9
9 changed files with 449 additions and 37 deletions

View file

@ -621,6 +621,7 @@ set(SOURCES
WebDriver/Screenshot.cpp
WebDriver/TimeoutsConfiguration.cpp
WebGL/EventNames.cpp
WebGL/OpenGLContext.cpp
WebGL/WebGLContextAttributes.cpp
WebGL/WebGLContextEvent.cpp
WebGL/WebGLRenderingContext.cpp
@ -679,12 +680,18 @@ set(GENERATED_SOURCES
serenity_lib(LibWeb web)
# NOTE: We link with LibSoftGPU here instead of lazy loading it via dlopen() so that we do not have to unveil the library and pledge prot_exec.
target_link_libraries(LibWeb PRIVATE LibCore LibCrypto LibJS LibMarkdown LibHTTP LibGemini LibGL LibGUI LibGfx LibIPC LibLocale LibRegex LibSoftGPU LibSyntax LibTextCodec LibUnicode LibAudio LibVideo LibWasm LibXML LibIDL)
target_link_libraries(LibWeb PRIVATE LibCore LibCrypto LibJS LibMarkdown LibHTTP LibGemini LibGUI LibGfx LibIPC LibLocale LibRegex LibSoftGPU LibSyntax LibTextCodec LibUnicode LibAudio LibVideo LibWasm LibXML LibIDL)
link_with_locale_data(LibWeb)
if (HAS_ACCELERATED_GRAPHICS)
target_link_libraries(LibWeb PRIVATE ${ACCEL_GFX_LIBS})
target_sources(LibWeb PRIVATE Painting/PaintingCommandExecutorGPU.cpp)
target_link_libraries(LibWeb PRIVATE LibAccelGfx)
target_compile_definitions(LibWeb PRIVATE HAS_ACCELERATED_GRAPHICS)
endif()
if (SERENITYOS)
target_link_libraries(LibWeb PRIVATE LibGL)
endif()
generate_js_bindings(LibWeb)