Commit f3e23295 by Jamie Madill Committed by Commit Bot

EGL: Expose NULL driver device selection.

This makes the device type selection part of the ANGLE platform extension. We currently support NULL driver selection on all available back-ends (although on the NULL back-end, it already has no device type). Optionally we could expose certain features of this as separate extensions. This currently also supports the old hidden enum, until we can update Chrome and consolidate to the new exposed official enum. Bug: angleproject:2159 Change-Id: I85d0811098e644e8192c207673af9e18ed7c1da2 Reviewed-on: https://chromium-review.googlesource.com/846021 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent d22cc5cb
......@@ -22,7 +22,7 @@ Status
Version
Version 4, 2017-07-19
Version 5, 2017-12-28
Number
......@@ -76,6 +76,11 @@ New Tokens
EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE 0x3206
Accepted as values for the EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE attribute:
EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE 0x320A
EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE 0x345E
Additions to the EGL Specification
None.
......@@ -108,6 +113,16 @@ New Behavior
EGL_PLATFORM_ANGLE_DEBUG_LAYERS_ENABLED is implicitly set to
EGL_DONT_CARE.
If no <attrib_list> is specified to eglGetPlatformDisplayEXT, the value of
EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE is implicitly set to
EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE. Otherwise, the value of
EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE should be:
- EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE to request a hardware
accelerated device.
- EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE to request a no-op driver
for testing. If unavailable, the implementation will fall back to
EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE.
If EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE is set to EGL_DONT_CARE and
EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE is not set to EGL_DONT_CARE,
an EGL_BAD_ATTRIBUTE error is generated and EGL_NO_DISPLAY is returned.
......@@ -144,3 +159,5 @@ Revision History
- Moved descriptions of platforms to child extension specs.
Version 4, 2017-07-19 (Jamie Madill)
- Add a debug layers enabled attribute to control runtime validation.
Version 5, 2017-12-28 (Jamie Madill)
- Expose device type selection.
......@@ -62,9 +62,8 @@ New Tokens
Accepted as values for the EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE attribute:
EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE 0x320A
EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE 0x320B
EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE 0x320C
EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE 0x320B
EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE 0x320C
Additions to the EGL Specification
......@@ -92,9 +91,11 @@ New Behavior
EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE should be:
- EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE to request a hardware
accelerated device.
- EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE to request an
- EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE to request a no-op driver
for testing.
- EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE to request an
optimized software rasterizer.
- EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE to request a
- EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE to request a
reference rasterizer.
If EGL_PLATFORM_ANGLE_TYPE_ANGLE is set to
......
......@@ -51,16 +51,17 @@
#define EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE 0x3205
#define EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE 0x3206
#define EGL_PLATFORM_ANGLE_DEBUG_LAYERS_ENABLED_ANGLE 0x3451
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE 0x3209
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE 0x320A
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE 0x345E
#endif /* EGL_ANGLE_platform_angle */
#ifndef EGL_ANGLE_platform_angle_d3d
#define EGL_ANGLE_platform_angle_d3d 1
#define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3207
#define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3208
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE 0x3209
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE 0x320A
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE 0x320B
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE 0x320C
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE 0x320B
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE 0x320C
#define EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE 0x320F
#endif /* EGL_ANGLE_platform_angle_d3d */
......
......@@ -200,7 +200,8 @@ std::string ToString(const T &value)
#define GL_BGRA8_SRGB_ANGLEX 0x6AC0
// Hidden enum for the NULL D3D device type.
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE 0x6AC0
// TODO(jmadill): Remove this once Chrome is updated.
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLEX 0x6AC0
// TODO(jmadill): Clean this up at some point.
#define EGL_PLATFORM_ANGLE_PLATFORM_METHODS_ANGLEX 0x9999
......
......@@ -534,11 +534,11 @@ Renderer11::Renderer11(egl::Display *display)
mRequestedDriverType = D3D_DRIVER_TYPE_HARDWARE;
break;
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE:
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE:
mRequestedDriverType = D3D_DRIVER_TYPE_WARP;
break;
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE:
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE:
mRequestedDriverType = D3D_DRIVER_TYPE_REFERENCE;
break;
......
......@@ -99,7 +99,7 @@ Renderer9::Renderer9(egl::Display *display) : RendererD3D(display), mStateManage
mDeviceType = D3DDEVTYPE_HAL;
break;
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE:
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE:
mDeviceType = D3DDEVTYPE_REF;
break;
......
......@@ -135,6 +135,12 @@ void FunctionsGL::initialize(const egl::AttributeMap &displayAttributes)
#if defined(ANGLE_ENABLE_OPENGL_NULL)
EGLint deviceType =
static_cast<EGLint>(displayAttributes.get(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE, EGL_NONE));
// Support the old hidden enum because it is used by Chrome.
// TODO(jmadill): Remove this once Chrome is updated.
if (deviceType == EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLEX)
deviceType = EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE;
#endif // defined(ANGLE_ENABLE_GL_NULL)
switch (standard)
......
......@@ -298,13 +298,12 @@ Error ValidateGetPlatformDisplayCommon(EGLenum platform,
if (platform == EGL_PLATFORM_ANGLE_ANGLE)
{
EGLAttrib platformType = EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE;
EGLAttrib deviceType = EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE;
bool enableAutoTrimSpecified = false;
bool deviceTypeSpecified = false;
bool presentPathSpecified = false;
Optional<EGLAttrib> majorVersion;
Optional<EGLAttrib> minorVersion;
Optional<EGLAttrib> deviceType;
for (const auto &curAttrib : attribMap)
{
......@@ -368,13 +367,20 @@ Error ValidateGetPlatformDisplayCommon(EGLenum platform,
switch (value)
{
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE:
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE:
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE:
deviceTypeSpecified = true;
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE:
break;
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE:
// This is a hidden option, accepted by the OpenGL back-end.
// TODO(jmadill): Remove this once Chrome is updated.
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLEX:
break;
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE:
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE:
if (!clientExtensions.platformANGLED3D)
{
return EglBadAttribute()
<< "EGL_ANGLE_platform_angle_d3d is not supported";
}
break;
default:
......@@ -409,7 +415,7 @@ Error ValidateGetPlatformDisplayCommon(EGLenum platform,
<< "Must specify major version if you specify a minor version.";
}
if (deviceType == EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE &&
if (deviceType == EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE &&
platformType != EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
{
return EglBadAttribute() << "EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE requires a "
......@@ -429,12 +435,23 @@ Error ValidateGetPlatformDisplayCommon(EGLenum platform,
"device type of EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE.";
}
if (deviceTypeSpecified && platformType != EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE &&
platformType != EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
if (deviceType.valid())
{
return EglBadAttribute() << "EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE requires a "
"device type of EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE or "
"EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE.";
switch (deviceType.value())
{
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE:
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE:
if (platformType != EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE &&
platformType != EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
{
return EglBadAttribute()
<< "This device type requires a "
"platform type of EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE or "
"EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE.";
}
default:
break;
}
}
if (platformType == EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE)
......
......@@ -748,8 +748,8 @@ TEST_P(ProgramBinariesAcrossPlatforms, CreateAndReloadBinary)
// If the test is trying to use both the default GPU and WARP, but the default GPU *IS* WARP,
// then our expectations for the test results will be invalid.
if (firstRenderer.eglParameters.deviceType != EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE &&
secondRenderer.eglParameters.deviceType == EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE)
if (firstRenderer.eglParameters.deviceType != EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE &&
secondRenderer.eglParameters.deviceType == EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE)
{
std::string rendererString = std::string(reinterpret_cast<const char*>(glGetString(GL_RENDERER)));
angle::ToLower(&rendererString);
......
......@@ -53,7 +53,7 @@ TEST_P(RendererTest, RequestedRendererCreated)
if (platform.renderer == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
{
// Ensure that the renderer uses WARP, if we requested it.
if (platform.deviceType == EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE)
if (platform.deviceType == EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE)
{
auto basicRenderPos = rendererString.find(std::string("microsoft basic render"));
auto softwareAdapterPos = rendererString.find(std::string("software adapter"));
......
......@@ -106,13 +106,13 @@ std::ostream &operator<<(std::ostream& stream, const PlatformParameters &pp)
stream << "_NULL";
break;
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE:
stream << "_REFERENCE";
break;
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE:
stream << "_REFERENCE";
break;
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE:
stream << "_WARP";
break;
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE:
stream << "_WARP";
break;
default:
UNREACHABLE();
......@@ -176,10 +176,8 @@ EGLPlatformParameters D3D9_NULL()
EGLPlatformParameters D3D9_REFERENCE()
{
return EGLPlatformParameters(
EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE,
EGL_DONT_CARE, EGL_DONT_CARE,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE);
return EGLPlatformParameters(EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE, EGL_DONT_CARE, EGL_DONT_CARE,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE);
}
EGLPlatformParameters D3D11()
......@@ -246,98 +244,74 @@ EGLPlatformParameters D3D11_NULL()
EGLPlatformParameters D3D11_WARP()
{
return EGLPlatformParameters(
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
EGL_DONT_CARE, EGL_DONT_CARE,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE);
return EGLPlatformParameters(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, EGL_DONT_CARE, EGL_DONT_CARE,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE);
}
EGLPlatformParameters D3D11_FL11_1_WARP()
{
return EGLPlatformParameters(
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
11, 1,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE);
return EGLPlatformParameters(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, 11, 1,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE);
}
EGLPlatformParameters D3D11_FL11_0_WARP()
{
return EGLPlatformParameters(
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
11, 0,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE);
return EGLPlatformParameters(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, 11, 0,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE);
}
EGLPlatformParameters D3D11_FL10_1_WARP()
{
return EGLPlatformParameters(
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
10, 1,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE);
return EGLPlatformParameters(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, 10, 1,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE);
}
EGLPlatformParameters D3D11_FL10_0_WARP()
{
return EGLPlatformParameters(
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
10, 0,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE);
return EGLPlatformParameters(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, 10, 0,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE);
}
EGLPlatformParameters D3D11_FL9_3_WARP()
{
return EGLPlatformParameters(
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
9, 3,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE);
return EGLPlatformParameters(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, 9, 3,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE);
}
EGLPlatformParameters D3D11_REFERENCE()
{
return EGLPlatformParameters(
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
EGL_DONT_CARE, EGL_DONT_CARE,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE);
return EGLPlatformParameters(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, EGL_DONT_CARE, EGL_DONT_CARE,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE);
}
EGLPlatformParameters D3D11_FL11_1_REFERENCE()
{
return EGLPlatformParameters(
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
11, 1,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE);
return EGLPlatformParameters(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, 11, 1,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE);
}
EGLPlatformParameters D3D11_FL11_0_REFERENCE()
{
return EGLPlatformParameters(
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
11, 0,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE);
return EGLPlatformParameters(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, 11, 0,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE);
}
EGLPlatformParameters D3D11_FL10_1_REFERENCE()
{
return EGLPlatformParameters(
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
10, 1,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE);
return EGLPlatformParameters(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, 10, 1,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE);
}
EGLPlatformParameters D3D11_FL10_0_REFERENCE()
{
return EGLPlatformParameters(
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
10, 0,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE);
return EGLPlatformParameters(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, 10, 0,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE);
}
EGLPlatformParameters D3D11_FL9_3_REFERENCE()
{
return EGLPlatformParameters(
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
9, 3,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE);
return EGLPlatformParameters(EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, 9, 3,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE);
}
EGLPlatformParameters OPENGL()
......
......@@ -24,12 +24,6 @@
class OSWindow;
// A hidden define used in some renderers (currently D3D-only)
// to init a no-op renderer. Useful for performance testing.
#ifndef EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE 0x6AC0
#endif
namespace angle
{
struct PlatformMethods;
......
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