Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
36b960e2
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
36b960e2
编写于
11月 12, 2020
作者:
G
George Wright
提交者:
GitHub
11月 12, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add D3D9 fallback path for ANGLE and ensure fallbacks are actually attempted (#22412)
上级
bef3fd0d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
58 addition
and
53 deletion
+58
-53
shell/platform/windows/angle_surface_manager.cc
shell/platform/windows/angle_surface_manager.cc
+55
-53
shell/platform/windows/angle_surface_manager.h
shell/platform/windows/angle_surface_manager.h
+3
-0
未找到文件。
shell/platform/windows/angle_surface_manager.cc
浏览文件 @
36b960e2
...
...
@@ -5,6 +5,7 @@
#include "flutter/shell/platform/windows/angle_surface_manager.h"
#include <iostream>
#include <vector>
namespace
flutter
{
...
...
@@ -19,6 +20,31 @@ AngleSurfaceManager::~AngleSurfaceManager() {
CleanUp
();
}
bool
AngleSurfaceManager
::
InitializeEGL
(
const
EGLint
*
attributes
)
{
PFNEGLGETPLATFORMDISPLAYEXTPROC
eglGetPlatformDisplayEXT
=
reinterpret_cast
<
PFNEGLGETPLATFORMDISPLAYEXTPROC
>
(
eglGetProcAddress
(
"eglGetPlatformDisplayEXT"
));
if
(
!
eglGetPlatformDisplayEXT
)
{
std
::
cerr
<<
"EGL: eglGetPlatformDisplayEXT not available"
<<
std
::
endl
;
return
false
;
}
egl_display_
=
eglGetPlatformDisplayEXT
(
EGL_PLATFORM_ANGLE_ANGLE
,
EGL_DEFAULT_DISPLAY
,
attributes
);
if
(
egl_display_
==
EGL_NO_DISPLAY
)
{
std
::
cerr
<<
"EGL: Failed to get a compatible EGLdisplay"
<<
std
::
endl
;
return
false
;
}
if
(
eglInitialize
(
egl_display_
,
nullptr
,
nullptr
)
==
EGL_FALSE
)
{
std
::
cerr
<<
"EGL: Failed to initialize"
;
return
false
;
}
return
true
;
}
bool
AngleSurfaceManager
::
Initialize
()
{
const
EGLint
configAttributes
[]
=
{
EGL_RED_SIZE
,
8
,
EGL_GREEN_SIZE
,
8
,
EGL_BLUE_SIZE
,
8
,
EGL_ALPHA_SIZE
,
8
,
...
...
@@ -28,10 +54,10 @@ bool AngleSurfaceManager::Initialize() {
const
EGLint
display_context_attributes
[]
=
{
EGL_CONTEXT_CLIENT_VERSION
,
2
,
EGL_NONE
};
const
EGLint
default_display_attributes
[]
=
{
// These are prefered display attributes and request ANGLE's D3D11
// renderer. eglInitialize will only succeed with these attributes if the
// hardware supports D3D11 Feature Level 10_0+.
// These are prefered display attributes and request ANGLE's D3D11
// renderer. eglInitialize will only succeed with these attributes if the
// hardware supports D3D11 Feature Level 10_0+.
const
EGLint
d3d11_display_attributes
[]
=
{
EGL_PLATFORM_ANGLE_TYPE_ANGLE
,
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE
,
...
...
@@ -43,9 +69,9 @@ bool AngleSurfaceManager::Initialize() {
EGL_NONE
,
};
const
EGLint
fl9_3_display_attributes
[]
=
{
// These are used to request ANGLE's D3D11 renderer, with D3D11 Feature
// Level 9_3.
// These are used to request ANGLE's D3D11 renderer, with D3D11 Feature
// Level 9_3.
const
EGLint
d3d11_fl_9_3_display_attributes
[]
=
{
EGL_PLATFORM_ANGLE_TYPE_ANGLE
,
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE
,
EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE
,
...
...
@@ -57,9 +83,9 @@ bool AngleSurfaceManager::Initialize() {
EGL_NONE
,
};
const
EGLint
warp_display_attributes
[]
=
{
// These attributes request D3D11 WARP (software rendering fallback) as a
// last resort.
// These attributes request D3D11 WARP (software rendering fallback) in case
// hardware-backed D3D11 is unavailable.
const
EGLint
d3d11_warp_display_attributes
[]
=
{
EGL_PLATFORM_ANGLE_TYPE_ANGLE
,
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE
,
EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE
,
...
...
@@ -67,51 +93,27 @@ bool AngleSurfaceManager::Initialize() {
EGL_NONE
,
};
PFNEGLGETPLATFORMDISPLAYEXTPROC
eglGetPlatformDisplayEXT
=
reinterpret_cast
<
PFNEGLGETPLATFORMDISPLAYEXTPROC
>
(
eglGetProcAddress
(
"eglGetPlatformDisplayEXT"
));
if
(
!
eglGetPlatformDisplayEXT
)
{
std
::
cerr
<<
"EGL: eglGetPlatformDisplayEXT not available"
<<
std
::
endl
;
return
false
;
}
// Try to initialize EGL to D3D11 Feature Level 10_0+.
egl_display_
=
eglGetPlatformDisplayEXT
(
EGL_PLATFORM_ANGLE_ANGLE
,
EGL_DEFAULT_DISPLAY
,
default_display_attributes
);
if
(
egl_display_
==
EGL_NO_DISPLAY
)
{
std
::
cerr
<<
"EGL: Failed to get a compatible EGLdisplay"
<<
std
::
endl
;
return
false
;
}
// These are used to request ANGLE's D3D9 renderer as a fallback if D3D11
// is not available.
const
EGLint
d3d9_display_attributes
[]
=
{
EGL_PLATFORM_ANGLE_TYPE_ANGLE
,
EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE
,
EGL_TRUE
,
EGL_NONE
,
};
if
(
eglInitialize
(
egl_display_
,
nullptr
,
nullptr
)
==
EGL_FALSE
)
{
// If above failed, try to initialize EGL to D3D11 Feature Level 9_3, if
// 10_0+ is unavailable.
egl_display_
=
eglGetPlatformDisplayEXT
(
EGL_PLATFORM_ANGLE_ANGLE
,
EGL_DEFAULT_DISPLAY
,
fl9_3_display_attributes
);
if
(
egl_display_
==
EGL_NO_DISPLAY
)
{
std
::
cerr
<<
"EGL: Failed to get a compatible 9.3 EGLdisplay"
<<
std
::
endl
;
return
false
;
}
std
::
vector
<
const
EGLint
*>
display_attributes_configs
=
{
d3d11_display_attributes
,
d3d11_fl_9_3_display_attributes
,
d3d11_warp_display_attributes
,
d3d9_display_attributes
,
};
if
(
eglInitialize
(
egl_display_
,
nullptr
,
nullptr
)
==
EGL_FALSE
)
{
// If all else fails, attempt D3D11 Feature Level 11_0 on WARP as a last
// resort
egl_display_
=
eglGetPlatformDisplayEXT
(
EGL_PLATFORM_ANGLE_ANGLE
,
EGL_DEFAULT_DISPLAY
,
warp_display_attributes
);
if
(
egl_display_
==
EGL_NO_DISPLAY
)
{
std
::
cerr
<<
"EGL: Failed to get a compatible WARP EGLdisplay"
<<
std
::
endl
;
return
false
;
}
if
(
eglInitialize
(
egl_display_
,
nullptr
,
nullptr
)
==
EGL_FALSE
)
{
std
::
cerr
<<
"EGL: Failed to initialize EGL"
<<
std
::
endl
;
return
false
;
}
// Attempt to initialize ANGLE's renderer in order of: D3D11, D3D11 Feature
// Level 9_3, D3D11 WARP and finally D3D9.
for
(
auto
config
:
display_attributes_configs
)
{
if
(
InitializeEGL
(
config
))
{
break
;
}
}
...
...
shell/platform/windows/angle_surface_manager.h
浏览文件 @
36b960e2
...
...
@@ -75,6 +75,9 @@ class AngleSurfaceManager {
void
CleanUp
();
private:
// Attempts to initialize EGL with a particular ANGLE configuration.
bool
InitializeEGL
(
const
EGLint
*
attributes
);
// EGL representation of native display.
EGLDisplay
egl_display_
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录