Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
43828e86
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,发现更多精彩内容 >>
未验证
提交
43828e86
编写于
10月 02, 2020
作者:
J
Jason Simmons
提交者:
GitHub
10月 02, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Workaround for an Android emulator EGL bug that can cause inaccurate GL version strings (#21258)
上级
88fd4cea
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
59 addition
and
1 deletion
+59
-1
shell/gpu/gpu_surface_gl_delegate.h
shell/gpu/gpu_surface_gl_delegate.h
+1
-1
shell/platform/android/android_context_gl.cc
shell/platform/android/android_context_gl.cc
+8
-0
shell/platform/android/android_context_gl.h
shell/platform/android/android_context_gl.h
+7
-0
shell/platform/android/android_surface_gl.cc
shell/platform/android/android_surface_gl.cc
+40
-0
shell/platform/android/android_surface_gl.h
shell/platform/android/android_surface_gl.h
+3
-0
未找到文件。
shell/gpu/gpu_surface_gl_delegate.h
浏览文件 @
43828e86
...
@@ -57,7 +57,7 @@ class GPUSurfaceGLDelegate : public GPUSurfaceDelegate {
...
@@ -57,7 +57,7 @@ class GPUSurfaceGLDelegate : public GPUSurfaceDelegate {
// flushed.
// flushed.
virtual
SkMatrix
GLContextSurfaceTransformation
()
const
;
virtual
SkMatrix
GLContextSurfaceTransformation
()
const
;
sk_sp
<
const
GrGLInterface
>
GetGLInterface
()
const
;
virtual
sk_sp
<
const
GrGLInterface
>
GetGLInterface
()
const
;
// TODO(chinmaygarde): The presence of this method is to work around the fact
// TODO(chinmaygarde): The presence of this method is to work around the fact
// that not all platforms can accept a custom GL proc table. Migrate all
// that not all platforms can accept a custom GL proc table. Migrate all
...
...
shell/platform/android/android_context_gl.cc
浏览文件 @
43828e86
...
@@ -248,4 +248,12 @@ bool AndroidContextGL::ClearCurrent() {
...
@@ -248,4 +248,12 @@ bool AndroidContextGL::ClearCurrent() {
return
true
;
return
true
;
}
}
EGLContext
AndroidContextGL
::
CreateNewContext
()
const
{
bool
success
;
EGLContext
context
;
std
::
tie
(
success
,
context
)
=
CreateContext
(
environment_
->
Display
(),
config_
,
EGL_NO_CONTEXT
);
return
success
?
context
:
EGL_NO_CONTEXT
;
}
}
// namespace flutter
}
// namespace flutter
shell/platform/android/android_context_gl.h
浏览文件 @
43828e86
...
@@ -110,6 +110,13 @@ class AndroidContextGL : public AndroidContext {
...
@@ -110,6 +110,13 @@ class AndroidContextGL : public AndroidContext {
///
///
bool
ClearCurrent
();
bool
ClearCurrent
();
//----------------------------------------------------------------------------
/// @brief Create a new EGLContext using the same EGLConfig.
///
/// @return The EGLContext.
///
EGLContext
CreateNewContext
()
const
;
private:
private:
fml
::
RefPtr
<
AndroidEnvironmentGL
>
environment_
;
fml
::
RefPtr
<
AndroidEnvironmentGL
>
environment_
;
EGLConfig
config_
;
EGLConfig
config_
;
...
...
shell/platform/android/android_surface_gl.cc
浏览文件 @
43828e86
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
#include "flutter/shell/platform/android/android_surface_gl.h"
#include "flutter/shell/platform/android/android_surface_gl.h"
#include <GLES/gl.h>
#include <utility>
#include <utility>
#include "flutter/fml/logging.h"
#include "flutter/fml/logging.h"
...
@@ -12,6 +13,12 @@
...
@@ -12,6 +13,12 @@
namespace
flutter
{
namespace
flutter
{
namespace
{
// GL renderer string prefix used by the Android emulator GLES implementation.
constexpr
char
kEmulatorRendererPrefix
[]
=
"Android Emulator OpenGL ES Translator"
;
}
// anonymous namespace
AndroidSurfaceGL
::
AndroidSurfaceGL
(
AndroidSurfaceGL
::
AndroidSurfaceGL
(
std
::
shared_ptr
<
AndroidContext
>
android_context
,
std
::
shared_ptr
<
AndroidContext
>
android_context
,
std
::
shared_ptr
<
PlatformViewAndroidJNI
>
jni_facade
,
std
::
shared_ptr
<
PlatformViewAndroidJNI
>
jni_facade
,
...
@@ -133,4 +140,37 @@ ExternalViewEmbedder* AndroidSurfaceGL::GetExternalViewEmbedder() {
...
@@ -133,4 +140,37 @@ ExternalViewEmbedder* AndroidSurfaceGL::GetExternalViewEmbedder() {
return
external_view_embedder_
.
get
();
return
external_view_embedder_
.
get
();
}
}
// |GPUSurfaceGLDelegate|
sk_sp
<
const
GrGLInterface
>
AndroidSurfaceGL
::
GetGLInterface
()
const
{
// This is a workaround for a bug in the Android emulator EGL/GLES
// implementation. Some versions of the emulator will not update the
// GL version string when the process switches to a new EGL context
// unless the EGL context is being made current for the first time.
// The inaccurate version string will be rejected by Skia when it
// tries to build the GrGLInterface. Flutter can work around this
// by creating a new context, making it current to force an update
// of the version, and then reverting to the previous context.
const
char
*
gl_renderer
=
reinterpret_cast
<
const
char
*>
(
glGetString
(
GL_RENDERER
));
if
(
gl_renderer
&&
strncmp
(
gl_renderer
,
kEmulatorRendererPrefix
,
strlen
(
kEmulatorRendererPrefix
))
==
0
)
{
EGLContext
new_context
=
android_context_
->
CreateNewContext
();
if
(
new_context
!=
EGL_NO_CONTEXT
)
{
EGLContext
old_context
=
eglGetCurrentContext
();
EGLDisplay
display
=
eglGetCurrentDisplay
();
EGLSurface
draw_surface
=
eglGetCurrentSurface
(
EGL_DRAW
);
EGLSurface
read_surface
=
eglGetCurrentSurface
(
EGL_READ
);
EGLBoolean
result
=
eglMakeCurrent
(
display
,
draw_surface
,
read_surface
,
new_context
);
FML_DCHECK
(
result
==
EGL_TRUE
);
result
=
eglMakeCurrent
(
display
,
draw_surface
,
read_surface
,
old_context
);
FML_DCHECK
(
result
==
EGL_TRUE
);
result
=
eglDestroyContext
(
display
,
new_context
);
FML_DCHECK
(
result
==
EGL_TRUE
);
}
}
return
GPUSurfaceGLDelegate
::
GetGLInterface
();
}
}
// namespace flutter
}
// namespace flutter
shell/platform/android/android_surface_gl.h
浏览文件 @
43828e86
...
@@ -65,6 +65,9 @@ class AndroidSurfaceGL final : public GPUSurfaceGLDelegate,
...
@@ -65,6 +65,9 @@ class AndroidSurfaceGL final : public GPUSurfaceGLDelegate,
// |GPUSurfaceGLDelegate|
// |GPUSurfaceGLDelegate|
ExternalViewEmbedder
*
GetExternalViewEmbedder
()
override
;
ExternalViewEmbedder
*
GetExternalViewEmbedder
()
override
;
// |GPUSurfaceGLDelegate|
sk_sp
<
const
GrGLInterface
>
GetGLInterface
()
const
override
;
private:
private:
const
std
::
unique_ptr
<
AndroidExternalViewEmbedder
>
external_view_embedder_
;
const
std
::
unique_ptr
<
AndroidExternalViewEmbedder
>
external_view_embedder_
;
const
std
::
shared_ptr
<
AndroidContextGL
>
android_context_
;
const
std
::
shared_ptr
<
AndroidContextGL
>
android_context_
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录