Commit 07044c65 by Julien Isorce Committed by Commit Bot

Reland "Instantiate rx::DisplayEGL when device type EGL is selected"

This is a reland of 7455b544 Original change's description: > Instantiate rx::DisplayEGL when device type EGL is selected > > Define EGL_PLATFORM_ANGLE_DEVICE_TYPE_EGL_ANGLE that should be > used to request a driver egl-backed implementation with ANGLE. > > Bug: angleproject:4328 > Change-Id: I6871d3a27e2bfc02af9815dcf86ae1cb6524f0cc > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2030038 > Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> > Reviewed-by: Geoff Lang <geofflang@chromium.org> Bug: angleproject:4328 Change-Id: I4e997c4fa1b5b59f081436f05bd208303ffe38e9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2093412Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Commit-Queue: Julien Isorce <julien.isorce@chromium.org>
parent 33bdab77
Name
ANGLE_platform_angle_device_type_egl_angle
Name Strings
EGL_ANGLE_platform_angle_device_type_egl_angle
Contributors
Julien Isorce, Oblong
Contacts
Julien Isorce, Oblong (jisorce 'at' oblong 'dot' com)
Status
Draft
Version
Version 1, 2020-03-03
Number
EGL Extension XXX
Extension Type
EGL client extension
Dependencies
Requires EGL_ANGLE_platform_angle_opengl.
Overview
This extension enables choosing the driver's EGL implementation when it is
available.
New Types
None
New Procedures and Functions
None
New Tokens
Accepted as values for the EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE
attribute:
EGL_PLATFORM_ANGLE_DEVICE_TYPE_EGL_ANGLE 0x348E
Additions to the EGL Specification
None.
New Behavior
When calling eglGetPlatformDisplay:
To request a driver egl-backed implementation with ANGLE, the value of
EGL_PLATFORM_ANGLE_TYPE_ANGLE should be
EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE or
EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE
and the value of EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE should be
EGL_PLATFORM_ANGLE_DEVICE_TYPE_EGL_ANGLE.
If EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE is
EGL_PLATFORM_ANGLE_DEVICE_TYPE_EGL_ANGLE and
EGL_PLATFORM_ANGLE_TYPE_ANGLE is not
EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE or is not
EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE then an EGL_BAD_ATTRIBUTE error is
is generated and EGL_NO_DISPLAY is returned.
Issues
None
Revision History
Version 1, 2020-03-03 (Julien Isorce)
- Initial draft
......@@ -97,6 +97,11 @@
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_SWIFTSHADER_ANGLE 0x3487
#endif /* EGL_ANGLE_platform_angle_device_type_swiftshader */
#ifndef EGL_ANGLE_platform_angle_device_type_egl_angle
#define EGL_ANGLE_platform_angle_device_type_egl_angle
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_EGL_ANGLE 0x348E
#endif /* EGL_ANGLE_platform_angle_device_type_egl_angle */
#ifndef EGL_ANGLE_platform_angle_context_virtualization
#define EGL_ANGLE_platform_angle_context_virtualization 1
#define EGL_PLATFORM_ANGLE_CONTEXT_VIRTUALIZATION_ANGLE 0x3481
......
......@@ -1390,6 +1390,7 @@ std::vector<std::string> ClientExtensions::getStrings() const
InsertExtensionString("EGL_ANGLE_platform_angle", platformANGLE, &extensionStrings);
InsertExtensionString("EGL_ANGLE_platform_angle_d3d", platformANGLED3D, &extensionStrings);
InsertExtensionString("EGL_ANGLE_platform_angle_d3d11on12", platformANGLED3D11ON12, &extensionStrings);
InsertExtensionString("EGL_ANGLE_platform_angle_device_type_egl_angle", platformANGLEDeviceTypeEGLANGLE, &extensionStrings);
InsertExtensionString("EGL_ANGLE_platform_angle_device_type_swiftshader", platformANGLEDeviceTypeSwiftShader, &extensionStrings);
InsertExtensionString("EGL_ANGLE_platform_angle_opengl", platformANGLEOpenGL, &extensionStrings);
InsertExtensionString("EGL_ANGLE_platform_angle_null", platformANGLENULL, &extensionStrings);
......
......@@ -1116,6 +1116,9 @@ struct ClientExtensions
// EGL_ANGLE_platform_angle_device_type_swiftshader
bool platformANGLEDeviceTypeSwiftShader = false;
// EGL_ANGLE_platform_angle_device_type_egl_angle
bool platformANGLEDeviceTypeEGLANGLE = false;
};
} // namespace egl
......
......@@ -50,14 +50,19 @@
#if defined(ANGLE_ENABLE_OPENGL)
# if defined(ANGLE_PLATFORM_WINDOWS)
# include "libANGLE/renderer/gl/wgl/DisplayWGL.h"
# elif defined(ANGLE_USE_X11)
# include "libANGLE/renderer/gl/glx/DisplayGLX.h"
# elif defined(ANGLE_PLATFORM_MACOS) || defined(ANGLE_PLATFORM_MACCATALYST)
# include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
# elif defined(ANGLE_PLATFORM_IOS)
# include "libANGLE/renderer/gl/eagl/DisplayEAGL.h"
# elif defined(ANGLE_USE_OZONE)
# include "libANGLE/renderer/gl/egl/ozone/DisplayOzone.h"
# elif defined(ANGLE_PLATFORM_LINUX)
# if defined(ANGLE_USE_OZONE)
# include "libANGLE/renderer/gl/egl/ozone/DisplayOzone.h"
# else
# include "libANGLE/renderer/gl/egl/DisplayEGL.h"
# if defined(ANGLE_USE_X11)
# include "libANGLE/renderer/gl/glx/DisplayGLX.h"
# endif
# endif
# elif defined(ANGLE_PLATFORM_ANDROID)
# include "libANGLE/renderer/gl/egl/android/DisplayAndroid.h"
# else
......@@ -216,7 +221,9 @@ EGLAttrib GetDeviceTypeFromEnvironment()
return EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE;
}
rx::DisplayImpl *CreateDisplayFromAttribs(EGLAttrib displayType, const DisplayState &state)
rx::DisplayImpl *CreateDisplayFromAttribs(EGLAttrib displayType,
EGLAttrib deviceType,
const DisplayState &state)
{
ASSERT(displayType != EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE);
rx::DisplayImpl *impl = nullptr;
......@@ -241,15 +248,26 @@ rx::DisplayImpl *CreateDisplayFromAttribs(EGLAttrib displayType, const DisplaySt
#if defined(ANGLE_ENABLE_OPENGL)
# if defined(ANGLE_PLATFORM_WINDOWS)
impl = new rx::DisplayWGL(state);
# elif defined(ANGLE_USE_X11)
impl = new rx::DisplayGLX(state);
# elif defined(ANGLE_PLATFORM_MACOS) || defined(ANGLE_PLATFORM_MACCATALYST)
impl = new rx::DisplayCGL(state);
# elif defined(ANGLE_PLATFORM_IOS)
impl = new rx::DisplayEAGL(state);
# elif defined(ANGLE_USE_OZONE)
# elif defined(ANGLE_PLATFORM_LINUX)
# if defined(ANGLE_USE_OZONE)
// This might work but has never been tried, so disallow for now.
impl = nullptr;
# else
if (deviceType == EGL_PLATFORM_ANGLE_DEVICE_TYPE_EGL_ANGLE)
{
impl = new rx::DisplayEGL(state);
}
# if defined(ANGLE_USE_X11)
else
{
impl = new rx::DisplayGLX(state);
}
# endif
# endif
# elif defined(ANGLE_PLATFORM_ANDROID)
// No GL support on this platform, fail display creation.
impl = nullptr;
......@@ -266,10 +284,21 @@ rx::DisplayImpl *CreateDisplayFromAttribs(EGLAttrib displayType, const DisplaySt
#if defined(ANGLE_ENABLE_OPENGL)
# if defined(ANGLE_PLATFORM_WINDOWS)
impl = new rx::DisplayWGL(state);
# elif defined(ANGLE_USE_X11)
impl = new rx::DisplayGLX(state);
# elif defined(ANGLE_USE_OZONE)
# elif defined(ANGLE_PLATFORM_LINUX)
# if defined(ANGLE_USE_OZONE)
impl = new rx::DisplayOzone(state);
# else
if (deviceType == EGL_PLATFORM_ANGLE_DEVICE_TYPE_EGL_ANGLE)
{
impl = new rx::DisplayEGL(state);
}
# if defined(ANGLE_USE_X11)
else
{
impl = new rx::DisplayGLX(state);
}
# endif
# endif
# elif defined(ANGLE_PLATFORM_ANDROID)
impl = new rx::DisplayAndroid(state);
# else
......@@ -431,7 +460,9 @@ Display *Display::GetDisplayFromNativeDisplay(EGLNativeDisplayType nativeDisplay
display->updateAttribsFromEnvironment(attribMap);
EGLAttrib displayType = display->mAttributeMap.get(EGL_PLATFORM_ANGLE_TYPE_ANGLE);
rx::DisplayImpl *impl = CreateDisplayFromAttribs(displayType, display->getState());
EGLAttrib deviceType = display->mAttributeMap.get(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE);
rx::DisplayImpl *impl =
CreateDisplayFromAttribs(displayType, deviceType, display->getState());
if (impl == nullptr)
{
// No valid display implementation for these attributes
......@@ -1356,6 +1387,10 @@ static ClientExtensions GenerateClientExtensions()
extensions.x11Visual = true;
#endif
#if defined(ANGLE_PLATFORM_LINUX) && !defined(ANGLE_USE_OZONE)
extensions.platformANGLEDeviceTypeEGLANGLE = true;
#endif
extensions.clientGetAllProcAddresses = true;
extensions.debug = true;
extensions.explicitContext = true;
......
......@@ -566,6 +566,14 @@ Error ValidateGetPlatformDisplayCommon(EGLenum platform,
}
break;
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_EGL_ANGLE:
if (!clientExtensions.platformANGLEDeviceTypeEGLANGLE)
{
return EglBadAttribute() << "EGL_ANGLE_platform_angle_device_type_"
"egl_angle is not supported";
}
break;
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_SWIFTSHADER_ANGLE:
if (!clientExtensions.platformANGLEDeviceTypeSwiftShader)
{
......
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