rust-windowing/glutin

Unable to create debug context with EGL when `KHR_create_context_no_error` is supported

bgK opened this issue · 2 comments

bgK commented

When creating a context with EGL and the following code:

let context_attributes = ContextAttributesBuilder::new()
    .with_debug(true)
    .build(Some(window.raw_window_handle()));

The debug bit does not get set on the GL context:

let mut context_flags = 0;
gl.GetIntegerv(Gl::CONTEXT_FLAGS, &mut context_flags);
assert!(context_flags & Gl::CONTEXT_FLAG_DEBUG_BIT != 0);

This seems to be caused by this check:

if context_attributes.debug && is_one_five && !has_no_error {

The spec for KHR_create_context_no_error mentions an interaction with debug contexts:

BAD_MATCH is generated if the EGL_CONTEXT_OPENGL_NO_ERROR_KHR is TRUE at
the same time as a debug or robustness context is specified.

It's illegal to request a context that is both "no errors" and "debug", however it's fine to have a "debug" context when "no errors" is supported but not enabled.

bgK commented

Thanks! I confirm the issue is fixed with your branch with EGL.