Commit 2126a107 by Jamie Madill Committed by Commit Bot

EGLWindow: Clean up some init attribute code.

EGL_CONTEXT_OPENGL_DEBUG is only exposed as of EGL 1.5. We can also now properly test for no_error extension strings. Do not require backwards compatible context extensions. Fixes parts of using EGLWindow to load native EGL drivers. Bug: angleproject:4596 Change-Id: I4de8f492f265d29f6603ed1b35b123e362699c54 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2176271 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org>
parent a48f3c38
......@@ -344,6 +344,14 @@ EGLContext EGLWindow::createContext(EGLContext share) const
return EGL_NO_CONTEXT;
}
// EGL_CONTEXT_OPENGL_DEBUG is only valid as of EGL 1.5.
bool hasDebug = mEGLMinorVersion >= 5;
if (mConfigParams.debug && !hasDebug)
{
std::cerr << "EGL 1.5 is required for EGL_CONTEXT_OPENGL_DEBUG.\n";
return EGL_NO_CONTEXT;
}
bool hasWebGLCompatibility =
strstr(displayExtensions, "EGL_ANGLE_create_context_webgl_compatibility") != nullptr;
if (mConfigParams.webGLCompatibility.valid() && !hasWebGLCompatibility)
......@@ -394,11 +402,11 @@ EGLContext EGLWindow::createContext(EGLContext share) const
return EGL_NO_CONTEXT;
}
bool hasBackwardsCompatibleContextExtension =
strstr(displayExtensions, "EGL_ANGLE_create_context_backwards_compatible") != nullptr;
if (!hasProgramCacheControlExtension)
bool hasKHRCreateContextNoError =
strstr(displayExtensions, "EGL_KHR_create_context_no_error") != nullptr;
if (mConfigParams.noError && !hasKHRCreateContextNoError)
{
std::cerr << "EGL_ANGLE_create_context_backwards_compatible missing.\n";
std::cerr << "EGL_KHR_create_context_no_error missing.\n";
return EGL_NO_CONTEXT;
}
......@@ -418,15 +426,17 @@ EGLContext EGLWindow::createContext(EGLContext share) const
contextAttributes.push_back(EGL_CONTEXT_MINOR_VERSION_KHR);
contextAttributes.push_back(mClientMinorVersion);
contextAttributes.push_back(EGL_CONTEXT_OPENGL_DEBUG);
contextAttributes.push_back(mConfigParams.debug ? EGL_TRUE : EGL_FALSE);
// TODO(jmadill): Check for the extension string.
// bool hasKHRCreateContextNoError = strstr(displayExtensions,
// "EGL_KHR_create_context_no_error") != nullptr;
if (hasDebug)
{
contextAttributes.push_back(EGL_CONTEXT_OPENGL_DEBUG);
contextAttributes.push_back(mConfigParams.debug ? EGL_TRUE : EGL_FALSE);
}
contextAttributes.push_back(EGL_CONTEXT_OPENGL_NO_ERROR_KHR);
contextAttributes.push_back(mConfigParams.noError ? EGL_TRUE : EGL_FALSE);
if (hasKHRCreateContextNoError)
{
contextAttributes.push_back(EGL_CONTEXT_OPENGL_NO_ERROR_KHR);
contextAttributes.push_back(mConfigParams.noError ? EGL_TRUE : EGL_FALSE);
}
if (mConfigParams.webGLCompatibility.valid())
{
......@@ -470,6 +480,8 @@ EGLContext EGLWindow::createContext(EGLContext share) const
mConfigParams.contextProgramCacheEnabled.value() ? EGL_TRUE : EGL_FALSE);
}
bool hasBackwardsCompatibleContextExtension =
strstr(displayExtensions, "EGL_ANGLE_create_context_backwards_compatible") != nullptr;
if (hasBackwardsCompatibleContextExtension)
{
// Always request the exact context version that the config wants
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment