Commit 0e7ee498 by Corentin Wallez

eglGetPlatformDisplayEXT: validate device types are set only on d3d

Change-Id: I15f0651fbe90b3572ea6b62f804492fbe100e591 Reviewed-on: https://chromium-review.googlesource.com/269771Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 3c74e772
......@@ -148,6 +148,7 @@ EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_disp
bool majorVersionSpecified = false;
bool minorVersionSpecified = false;
bool enableAutoTrimSpecified = false;
bool deviceTypeSpecified = false;
if (attrib_list)
{
......@@ -214,12 +215,6 @@ EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_disp
break;
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE:
if (!clientExtensions.platformANGLED3D)
{
SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
return EGL_NO_DISPLAY;
}
switch (curAttrib[1])
{
case EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE:
......@@ -233,6 +228,7 @@ EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_disp
return EGL_NO_DISPLAY;
}
deviceType = curAttrib[1];
deviceTypeSpecified = true;
break;
default:
......@@ -263,6 +259,15 @@ EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_disp
return EGL_NO_DISPLAY;
}
if (deviceTypeSpecified &&
platformType != EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE &&
platformType != EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
{
SetGlobalError(Error(EGL_BAD_ATTRIBUTE, "EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE requires a device type of "
"EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE or EGL_PLATFORM_ANGLE_TYPE_D3D9_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