Commit 7455b544 by Julien Isorce Committed by Commit Bot

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: 's avatarGeoff Lang <geofflang@chromium.org>
parent 20c69733
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 @@ ...@@ -97,6 +97,11 @@
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_SWIFTSHADER_ANGLE 0x3487 #define EGL_PLATFORM_ANGLE_DEVICE_TYPE_SWIFTSHADER_ANGLE 0x3487
#endif /* EGL_ANGLE_platform_angle_device_type_swiftshader */ #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 #ifndef EGL_ANGLE_platform_angle_context_virtualization
#define EGL_ANGLE_platform_angle_context_virtualization 1 #define EGL_ANGLE_platform_angle_context_virtualization 1
#define EGL_PLATFORM_ANGLE_CONTEXT_VIRTUALIZATION_ANGLE 0x3481 #define EGL_PLATFORM_ANGLE_CONTEXT_VIRTUALIZATION_ANGLE 0x3481
......
...@@ -1392,6 +1392,7 @@ std::vector<std::string> ClientExtensions::getStrings() const ...@@ -1392,6 +1392,7 @@ std::vector<std::string> ClientExtensions::getStrings() const
InsertExtensionString("EGL_ANGLE_platform_angle", platformANGLE, &extensionStrings); InsertExtensionString("EGL_ANGLE_platform_angle", platformANGLE, &extensionStrings);
InsertExtensionString("EGL_ANGLE_platform_angle_d3d", platformANGLED3D, &extensionStrings); InsertExtensionString("EGL_ANGLE_platform_angle_d3d", platformANGLED3D, &extensionStrings);
InsertExtensionString("EGL_ANGLE_platform_angle_d3d11on12", platformANGLED3D11ON12, &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_device_type_swiftshader", platformANGLEDeviceTypeSwiftShader, &extensionStrings);
InsertExtensionString("EGL_ANGLE_platform_angle_opengl", platformANGLEOpenGL, &extensionStrings); InsertExtensionString("EGL_ANGLE_platform_angle_opengl", platformANGLEOpenGL, &extensionStrings);
InsertExtensionString("EGL_ANGLE_platform_angle_null", platformANGLENULL, &extensionStrings); InsertExtensionString("EGL_ANGLE_platform_angle_null", platformANGLENULL, &extensionStrings);
......
...@@ -1116,6 +1116,9 @@ struct ClientExtensions ...@@ -1116,6 +1116,9 @@ struct ClientExtensions
// EGL_ANGLE_platform_angle_device_type_swiftshader // EGL_ANGLE_platform_angle_device_type_swiftshader
bool platformANGLEDeviceTypeSwiftShader = false; bool platformANGLEDeviceTypeSwiftShader = false;
// EGL_ANGLE_platform_angle_device_type_egl_angle
bool platformANGLEDeviceTypeEGLANGLE = false;
}; };
} // namespace egl } // namespace egl
......
...@@ -50,8 +50,11 @@ ...@@ -50,8 +50,11 @@
#if defined(ANGLE_ENABLE_OPENGL) #if defined(ANGLE_ENABLE_OPENGL)
# if defined(ANGLE_PLATFORM_WINDOWS) # if defined(ANGLE_PLATFORM_WINDOWS)
# include "libANGLE/renderer/gl/wgl/DisplayWGL.h" # include "libANGLE/renderer/gl/wgl/DisplayWGL.h"
# elif defined(ANGLE_USE_X11) # elif defined(ANGLE_PLATFORM_LINUX)
# include "libANGLE/renderer/gl/glx/DisplayGLX.h" # include "libANGLE/renderer/gl/egl/DisplayEGL.h"
# if defined(ANGLE_USE_X11)
# include "libANGLE/renderer/gl/glx/DisplayGLX.h"
# endif
# elif defined(ANGLE_PLATFORM_MACOS) || defined(ANGLE_PLATFORM_MACCATALYST) # elif defined(ANGLE_PLATFORM_MACOS) || defined(ANGLE_PLATFORM_MACCATALYST)
# include "libANGLE/renderer/gl/cgl/DisplayCGL.h" # include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
# elif defined(ANGLE_PLATFORM_IOS) # elif defined(ANGLE_PLATFORM_IOS)
...@@ -216,7 +219,9 @@ EGLAttrib GetDeviceTypeFromEnvironment() ...@@ -216,7 +219,9 @@ EGLAttrib GetDeviceTypeFromEnvironment()
return EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE; 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); ASSERT(displayType != EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE);
rx::DisplayImpl *impl = nullptr; rx::DisplayImpl *impl = nullptr;
...@@ -241,8 +246,17 @@ rx::DisplayImpl *CreateDisplayFromAttribs(EGLAttrib displayType, const DisplaySt ...@@ -241,8 +246,17 @@ rx::DisplayImpl *CreateDisplayFromAttribs(EGLAttrib displayType, const DisplaySt
#if defined(ANGLE_ENABLE_OPENGL) #if defined(ANGLE_ENABLE_OPENGL)
# if defined(ANGLE_PLATFORM_WINDOWS) # if defined(ANGLE_PLATFORM_WINDOWS)
impl = new rx::DisplayWGL(state); impl = new rx::DisplayWGL(state);
# elif defined(ANGLE_USE_X11) # elif defined(ANGLE_PLATFORM_LINUX)
impl = new rx::DisplayGLX(state); 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
}
# elif defined(ANGLE_PLATFORM_MACOS) || defined(ANGLE_PLATFORM_MACCATALYST) # elif defined(ANGLE_PLATFORM_MACOS) || defined(ANGLE_PLATFORM_MACCATALYST)
impl = new rx::DisplayCGL(state); impl = new rx::DisplayCGL(state);
# elif defined(ANGLE_PLATFORM_IOS) # elif defined(ANGLE_PLATFORM_IOS)
...@@ -266,8 +280,17 @@ rx::DisplayImpl *CreateDisplayFromAttribs(EGLAttrib displayType, const DisplaySt ...@@ -266,8 +280,17 @@ rx::DisplayImpl *CreateDisplayFromAttribs(EGLAttrib displayType, const DisplaySt
#if defined(ANGLE_ENABLE_OPENGL) #if defined(ANGLE_ENABLE_OPENGL)
# if defined(ANGLE_PLATFORM_WINDOWS) # if defined(ANGLE_PLATFORM_WINDOWS)
impl = new rx::DisplayWGL(state); impl = new rx::DisplayWGL(state);
# elif defined(ANGLE_USE_X11) # elif defined(ANGLE_PLATFORM_LINUX)
impl = new rx::DisplayGLX(state); 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
}
# elif defined(ANGLE_USE_OZONE) # elif defined(ANGLE_USE_OZONE)
impl = new rx::DisplayOzone(state); impl = new rx::DisplayOzone(state);
# elif defined(ANGLE_PLATFORM_ANDROID) # elif defined(ANGLE_PLATFORM_ANDROID)
...@@ -431,7 +454,9 @@ Display *Display::GetDisplayFromNativeDisplay(EGLNativeDisplayType nativeDisplay ...@@ -431,7 +454,9 @@ Display *Display::GetDisplayFromNativeDisplay(EGLNativeDisplayType nativeDisplay
display->updateAttribsFromEnvironment(attribMap); display->updateAttribsFromEnvironment(attribMap);
EGLAttrib displayType = display->mAttributeMap.get(EGL_PLATFORM_ANGLE_TYPE_ANGLE); 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) if (impl == nullptr)
{ {
// No valid display implementation for these attributes // No valid display implementation for these attributes
...@@ -1356,6 +1381,10 @@ static ClientExtensions GenerateClientExtensions() ...@@ -1356,6 +1381,10 @@ static ClientExtensions GenerateClientExtensions()
extensions.x11Visual = true; extensions.x11Visual = true;
#endif #endif
#if defined(ANGLE_PLATFORM_LINUX)
extensions.platformANGLEDeviceTypeEGLANGLE = true;
#endif
extensions.clientGetAllProcAddresses = true; extensions.clientGetAllProcAddresses = true;
extensions.debug = true; extensions.debug = true;
extensions.explicitContext = true; extensions.explicitContext = true;
......
...@@ -566,6 +566,14 @@ Error ValidateGetPlatformDisplayCommon(EGLenum platform, ...@@ -566,6 +566,14 @@ Error ValidateGetPlatformDisplayCommon(EGLenum platform,
} }
break; 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: case EGL_PLATFORM_ANGLE_DEVICE_TYPE_SWIFTSHADER_ANGLE:
if (!clientExtensions.platformANGLEDeviceTypeSwiftShader) 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