LibWeb: Pass some WebGL context attribute flags to OpenGLContext

This allows us to conditionally enable depth and stencil.

The antialias option is currently unused.
This commit is contained in:
Zaggy1024
2026-03-04 02:08:59 -06:00
committed by Jelle Raaijmakers
parent e84dc71291
commit 682662d44c
Notes: github-actions[bot] 2026-03-06 22:01:52 +00:00
4 changed files with 42 additions and 13 deletions

View File

@@ -45,7 +45,12 @@ JS::ThrowCompletionOr<GC::Ptr<WebGL2RenderingContext>> WebGL2RenderingContext::c
fire_webgl_context_creation_error(canvas_element);
return GC::Ptr<WebGL2RenderingContext> { nullptr };
}
auto context = OpenGLContext::create(*skia_backend_context, OpenGLContext::WebGLVersion::WebGL2);
OpenGLContext::DrawingBufferOptions context_options {
.depth = context_attributes.depth,
.stencil = context_attributes.stencil,
.antialias = context_attributes.antialias,
};
auto context = OpenGLContext::create(*skia_backend_context, OpenGLContext::WebGLVersion::WebGL2, context_options);
if (!context) {
fire_webgl_context_creation_error(canvas_element);
return GC::Ptr<WebGL2RenderingContext> { nullptr };