GL: fall back to WGL if EGL_ANGLE_surface_orientation unset

When an app attempts to use the GL backend on Windows, there is
currently an undocumented hard requirement for
EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE. This is caused by
EGL_ANGLE_surface_orientation not being fully implemented, so
instead let ANGLE fall back to the slow WGL pipeline.

See: I012168531d8c2e5b189671533cea9f57ec713538

BUG: angleproject:8201
Change-Id: I28c6a948a5fc0e3ebfff86c4cbf95c666f5c7cd4
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4614646
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
This commit is contained in:
L. E. Segovia
2023-06-14 23:27:31 -03:00
committed by Angle LUCI CQ
parent 174742fd66
commit a62cc521f8

View File

@@ -42,8 +42,8 @@ std::string GetErrorMessage()
DWORD errorCode = GetLastError();
LPSTR messageBuffer = nullptr;
size_t size = FormatMessageA(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, errorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, NULL);
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, errorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, NULL);
std::string message(messageBuffer, size);
if (size == 0)
{
@@ -226,7 +226,7 @@ egl::Error DisplayWGL::initializeImpl(egl::Display *display)
const egl::AttributeMap &displayAttributes = display->getAttributeMap();
EGLint requestedDisplayType = static_cast<EGLint>(displayAttributes.get(
EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE));
EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE));
if (requestedDisplayType == EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE &&
!mFunctionsWGL->hasExtension("WGL_EXT_create_context_es2_profile") &&
!mFunctionsWGL->hasExtension("WGL_EXT_create_context_es_profile"))
@@ -412,7 +412,10 @@ SurfaceImpl *DisplayWGL::createWindowSurface(const egl::SurfaceState &state,
const egl::AttributeMap &attribs)
{
EGLint orientation = static_cast<EGLint>(attribs.get(EGL_SURFACE_ORIENTATION_ANGLE, 0));
if (mUseDXGISwapChains)
// TODO(crbug.com/540829, anglebug.com/8201) other orientations
// are still unsupported, so allow fallback instead of crashing
// later in eglCreateWindowSurface
if (mUseDXGISwapChains && orientation == EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE)
{
egl::Error error = initializeD3DDevice();
if (error.isError())