mirror of
https://github.com/godotengine/godot-angle-static.git
synced 2026-01-07 06:09:57 +03:00
eglGetPlatformDisplayEXT: validate device types are set only on d3d
Change-Id: I15f0651fbe90b3572ea6b62f804492fbe100e591 Reviewed-on: https://chromium-review.googlesource.com/269771 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user