Commit 7cd5f64a by Michael Spang Committed by Commit Bot

Move default ANGLE platform type out of main switch/case

The "default" platform type isn't really a discrete type, and treating it that way leads to duplication. Make the default platform just map to another platform enum. After this change, setting args to angle_enable_opengl=false angle_enable_vulkan=true under X11 results in a default of vulkan; previously we would hit UNREACHABLE() due to not handling this case. Bug: angleproject:3847 Change-Id: I1dc093ef8a2f5b93721cb1ebda0a8c3ec4a7d2f9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1521321Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Michael Spang <spang@chromium.org>
parent f8e8fcf8
...@@ -491,9 +491,6 @@ config("angle_backend_config") { ...@@ -491,9 +491,6 @@ config("angle_backend_config") {
} }
if (angle_enable_gl) { if (angle_enable_gl) {
defines += [ "ANGLE_ENABLE_OPENGL" ] defines += [ "ANGLE_ENABLE_OPENGL" ]
if (use_x11) {
defines += [ "ANGLE_USE_X11" ]
}
if (angle_enable_gl_null) { if (angle_enable_gl_null) {
defines += [ "ANGLE_ENABLE_OPENGL_NULL" ] defines += [ "ANGLE_ENABLE_OPENGL_NULL" ]
} }
...@@ -532,6 +529,10 @@ config("libANGLE_config") { ...@@ -532,6 +529,10 @@ config("libANGLE_config") {
libs += [ "android" ] libs += [ "android" ]
} }
} }
if (use_x11) {
defines += [ "ANGLE_USE_X11" ]
}
} }
if (angle_enable_vulkan) { if (angle_enable_vulkan) {
......
...@@ -169,7 +169,25 @@ EGLAttrib GetDisplayTypeFromEnvironment() ...@@ -169,7 +169,25 @@ EGLAttrib GetDisplayTypeFromEnvironment()
} }
#endif #endif
return EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE; #if defined(ANGLE_ENABLE_D3D11)
return EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE;
#elif defined(ANGLE_ENABLE_D3D9)
return EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE;
#elif defined(ANGLE_ENABLE_VULKAN) && defined(ANGLE_PLATFORM_ANDROID)
return EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE;
#elif defined(ANGLE_ENABLE_OPENGL)
# if defined(ANGLE_PLATFORM_ANDROID) || defined(ANGLE_USE_OZONE)
return EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE;
# else
return EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE;
# endif
#elif defined(ANGLE_ENABLE_VULKAN)
return EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE;
#elif defined(ANGLE_ENABLE_NULL)
return EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE;
#else
# error No default ANGLE platform type
#endif
} }
rx::DisplayImpl *CreateDisplayFromAttribs(const AttributeMap &attribMap, const DisplayState &state) rx::DisplayImpl *CreateDisplayFromAttribs(const AttributeMap &attribMap, const DisplayState &state)
...@@ -186,27 +204,7 @@ rx::DisplayImpl *CreateDisplayFromAttribs(const AttributeMap &attribMap, const D ...@@ -186,27 +204,7 @@ rx::DisplayImpl *CreateDisplayFromAttribs(const AttributeMap &attribMap, const D
switch (displayType) switch (displayType)
{ {
case EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE: case EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE:
#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
// Default to D3D displays
impl = new rx::DisplayD3D(state);
#elif defined(ANGLE_USE_X11)
impl = new rx::DisplayGLX(state);
#elif defined(ANGLE_PLATFORM_APPLE)
impl = new rx::DisplayCGL(state);
#elif defined(ANGLE_PLATFORM_FUCHSIA)
impl = new rx::DisplayVkFuchsia(state);
#elif defined(ANGLE_USE_OZONE)
impl = new rx::DisplayOzone(state);
#elif defined(ANGLE_PLATFORM_ANDROID)
# if defined(ANGLE_ENABLE_VULKAN)
impl = new rx::DisplayVkAndroid(state);
# else
impl = new rx::DisplayAndroid(state);
# endif
#else
// No display available
UNREACHABLE(); UNREACHABLE();
#endif
break; break;
case EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE: case EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE:
......
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