1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

LibGL: Make GL::create_context fallible

Propagate errors in places that are already set up to handle them, like
WebGLRenderingContext and the Tubes demo, and convert other callers
to using MUST.
This commit is contained in:
Andrew Kaster 2022-09-16 05:58:30 -06:00 committed by Andreas Kling
parent 7e5080ea53
commit 8ed5ed3ec0
Notes: sideshowbarker 2024-07-18 00:54:03 +09:00
7 changed files with 14 additions and 20 deletions

View file

@ -921,11 +921,11 @@ void GLContext::build_extension_string()
m_extensions = String::join(' ', extensions);
}
NonnullOwnPtr<GLContext> create_context(Gfx::Bitmap& bitmap)
ErrorOr<NonnullOwnPtr<GLContext>> create_context(Gfx::Bitmap& bitmap)
{
// FIXME: Make driver selectable. This is currently hardcoded to LibSoftGPU
auto driver = MUST(GPU::Driver::try_create("softgpu"sv));
auto device = MUST(driver->try_create_device(bitmap.size()));
auto driver = TRY(GPU::Driver::try_create("softgpu"sv));
auto device = TRY(driver->try_create_device(bitmap.size()));
auto context = make<GLContext>(driver, move(device), bitmap);
dbgln_if(GL_DEBUG, "GL::create_context({}) -> {:p}", bitmap.size(), context.ptr());