Commit 0110e172 by Cooper Partin Committed by Jamie Madill

Update ANGLE_platform_angle_d3d to be able to disable automatic trim.

BUG=angleproject:946 Change-Id: I5652495842b057998318b1583f8e1a586eba39aa Reviewed-on: https://chromium-review.googlesource.com/258940Tested-by: 's avatarCooper Partin <coopp@microsoft.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent c05f7065
......@@ -58,6 +58,7 @@ New Tokens
eglGetPlatformDisplayEXT:
EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE 0x3209
EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE 0x320F
Accepted as values for the EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE attribute:
......@@ -96,14 +97,34 @@ New Behavior
- EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE to request a
reference rasterizer.
If EGL_PLATFORM_ANGLE_TYPE_ANGLE is set to
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, the display can automatically respond
to trim events from the operating system. If the attribute
EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE is unspecified, it is
implicitly set to EGL_FALSE. Otherwise, the value of
EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE should be EGL_TRUE or
EGL_FALSE.
If EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE is set to
EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE and EGL_PLATFORM_ANGLE_TYPE_ANGLE
is not set to EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, an EGL_BAD_ATTRIBUTE
error is generated and EGL_NO_DISPLAY is returned.
If EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE is specified when
EGL_PLATFORM_ANGLE_TYPE_ANGLE is not EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE
or a value other than EGL_TRUE or EGL_FALSE is used, an EGL_BAD_ATTRIBUTE
error is generated and EGL_NO_DISPLAY is returned.
Issues
None
1) Some multithreaded applications can crash if the display automatically
responds to trim events while the application is rendering from another
thread.
RESOLVED: Added an EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE
enum to specify if the display should respond to trim events.
Applications that do multithreaded rendering should disable automatic
trim and handle the trim events on their own.
Revision History
......@@ -115,3 +136,5 @@ Revision History
EGL_ANGLE_platform_angle spec to EGL_ANGLE_platform_angle_d3d.
Version 3, 2014-11-26 (Geoff Lang)
- Remove the USE_WARP bool and replace it with a DEVICE_TYPE enum.
Version 4, 2015-03-11 (Geoff Lang)
- Add the ENABLE_AUTOMATIC_TRIM enum.
......@@ -455,6 +455,7 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSu
#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_ENABLE_AUTOMATIC_TRIM_ANGLE 0x320F
#endif /* EGL_ANGLE_platform_angle_d3d */
#ifndef EGL_ANGLE_platform_angle_opengl
......
......@@ -480,8 +480,17 @@ void Renderer11::initializeDevice()
ASSERT(!mClear);
mClear = new Clear11(this);
ASSERT(!mTrim);
mTrim = new Trim11(this);
const auto &attributes = mDisplay->getAttributeMap();
// If automatic trim is enabled, DXGIDevice3::Trim( ) is called for the application
// automatically when an application is suspended by the OS. This feature is currently
// only supported for Windows Store applications.
EGLint enableAutoTrim = attributes.get(EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, EGL_FALSE);
if (enableAutoTrim == EGL_TRUE)
{
ASSERT(!mTrim);
mTrim = new Trim11(this);
}
ASSERT(!mPixelTransfer);
mPixelTransfer = new PixelTransfer11(this);
......
......@@ -132,7 +132,7 @@ EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_disp
case EGL_PLATFORM_ANGLE_ANGLE:
if (!clientExtensions.platformANGLE)
{
SetGlobalError(Error(EGL_SUCCESS));
SetGlobalError(Error(EGL_BAD_PARAMETER));
return EGL_NO_DISPLAY;
}
break;
......@@ -146,6 +146,7 @@ EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_disp
EGLint deviceType = EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE;
bool majorVersionSpecified = false;
bool minorVersionSpecified = false;
bool enableAutoTrimSpecified = false;
if (attrib_list)
{
......@@ -163,7 +164,7 @@ EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_disp
case EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE:
if (!clientExtensions.platformANGLED3D)
{
SetGlobalError(Error(EGL_SUCCESS));
SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
return EGL_NO_DISPLAY;
}
break;
......@@ -172,13 +173,13 @@ EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_disp
case EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE:
if (!clientExtensions.platformANGLEOpenGL)
{
SetGlobalError(Error(EGL_SUCCESS));
SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
return EGL_NO_DISPLAY;
}
break;
default:
SetGlobalError(Error(EGL_SUCCESS));
SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
return EGL_NO_DISPLAY;
}
platformType = curAttrib[1];
......@@ -198,10 +199,23 @@ EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_disp
}
break;
case EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE:
switch (curAttrib[1])
{
case EGL_TRUE:
case EGL_FALSE:
break;
default:
SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
return EGL_NO_DISPLAY;
}
enableAutoTrimSpecified = true;
break;
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE:
if (!clientExtensions.platformANGLED3D)
{
SetGlobalError(Error(EGL_SUCCESS));
SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
return EGL_NO_DISPLAY;
}
......@@ -214,7 +228,7 @@ EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_disp
break;
default:
SetGlobalError(Error(EGL_SUCCESS));
SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
return EGL_NO_DISPLAY;
}
deviceType = curAttrib[1];
......@@ -240,6 +254,14 @@ EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_disp
return EGL_NO_DISPLAY;
}
if (enableAutoTrimSpecified &&
platformType != EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
{
SetGlobalError(Error(EGL_BAD_ATTRIBUTE, "EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE requires a device type of "
"EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE."));
return EGL_NO_DISPLAY;
}
SetGlobalError(Error(EGL_SUCCESS));
EGLNativeDisplayType displayId = static_cast<EGLNativeDisplayType>(native_display);
......
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