Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
da84d59f
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,发现更多精彩内容 >>
未验证
提交
da84d59f
编写于
9月 11, 2019
作者:
J
Jim Graham
提交者:
GitHub
9月 11, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Manage iOS contexts separately (#12078)" (#12233)
This reverts commit
4ac0663d
.
上级
4ac0663d
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
78 addition
and
125 deletion
+78
-125
shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h
...platform/darwin/ios/framework/Source/FlutterOverlayView.h
+2
-3
shell/platform/darwin/ios/framework/Source/FlutterOverlayView.mm
...latform/darwin/ios/framework/Source/FlutterOverlayView.mm
+3
-5
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
...tform/darwin/ios/framework/Source/FlutterPlatformViews.mm
+5
-10
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
...rwin/ios/framework/Source/FlutterPlatformViews_Internal.h
+2
-5
shell/platform/darwin/ios/framework/Source/FlutterView.h
shell/platform/darwin/ios/framework/Source/FlutterView.h
+2
-2
shell/platform/darwin/ios/framework/Source/FlutterView.mm
shell/platform/darwin/ios/framework/Source/FlutterView.mm
+7
-16
shell/platform/darwin/ios/ios_gl_context.h
shell/platform/darwin/ios/ios_gl_context.h
+6
-8
shell/platform/darwin/ios/ios_gl_context.mm
shell/platform/darwin/ios/ios_gl_context.mm
+15
-18
shell/platform/darwin/ios/ios_gl_render_target.h
shell/platform/darwin/ios/ios_gl_render_target.h
+4
-5
shell/platform/darwin/ios/ios_gl_render_target.mm
shell/platform/darwin/ios/ios_gl_render_target.mm
+13
-12
shell/platform/darwin/ios/ios_surface_gl.h
shell/platform/darwin/ios/ios_surface_gl.h
+3
-9
shell/platform/darwin/ios/ios_surface_gl.mm
shell/platform/darwin/ios/ios_surface_gl.mm
+9
-18
shell/platform/darwin/ios/ios_surface_software.mm
shell/platform/darwin/ios/ios_surface_software.mm
+1
-2
shell/platform/darwin/ios/platform_view_ios.h
shell/platform/darwin/ios/platform_view_ios.h
+1
-3
shell/platform/darwin/ios/platform_view_ios.mm
shell/platform/darwin/ios/platform_view_ios.mm
+5
-9
未找到文件。
shell/platform/darwin/ios/framework/Source/FlutterOverlayView.h
浏览文件 @
da84d59f
...
...
@@ -24,9 +24,8 @@
-
(
instancetype
)
init
NS_DESIGNATED_INITIALIZER
;
-
(
instancetype
)
initWithContentsScale
:(
CGFloat
)
contentsScale
;
-
(
std
::
unique_ptr
<
flutter
::
IOSSurface
>
)
createSurfaceWithOnscreenGLContext
:(
fml
::
WeakPtr
<
flutter
::
IOSGLContext
>
)
onscreenGLContext
resourceGLContext
:(
fml
::
WeakPtr
<
flutter
::
IOSGLContext
>
)
resourceGLContext
;
-
(
std
::
unique_ptr
<
flutter
::
IOSSurface
>
)
createSurface
:
(
std
::
shared_ptr
<
flutter
::
IOSGLContext
>
)
gl_context
;
@end
...
...
shell/platform/darwin/ios/framework/Source/FlutterOverlayView.mm
浏览文件 @
da84d59f
...
...
@@ -78,17 +78,15 @@
#endif // TARGET_IPHONE_SIMULATOR
}
-
(
std
::
unique_ptr
<
flutter
::
IOSSurface
>
)
createSurfaceWithOnscreenGLContext
:(
fml
::
WeakPtr
<
flutter
::
IOSGLContext
>
)
onscreenGLContext
resourceGLContext
:(
fml
::
WeakPtr
<
flutter
::
IOSGLContext
>
)
resourceGLContext
{
-
(
std
::
unique_ptr
<
flutter
::
IOSSurface
>
)
createSurface
:
(
std
::
shared_ptr
<
flutter
::
IOSGLContext
>
)
gl_context
{
if
([
self
.
layer
isKindOfClass
:[
CAEAGLLayer
class
]])
{
fml
::
scoped_nsobject
<
CAEAGLLayer
>
eagl_layer
(
reinterpret_cast
<
CAEAGLLayer
*>
([
self
.
layer
retain
]));
if
(
@available
(
iOS
9.0
,
*
))
{
eagl_layer
.
get
().
presentsWithTransaction
=
YES
;
}
return
std
::
make_unique
<
flutter
::
IOSSurfaceGL
>
(
std
::
move
(
eagl_layer
),
onscreenGLContext
,
resourceGLContext
);
return
std
::
make_unique
<
flutter
::
IOSSurfaceGL
>
(
std
::
move
(
eagl_layer
),
gl_context
);
#if FLUTTER_SHELL_ENABLE_METAL
}
else
if
([
self
.
layer
isKindOfClass
:[
CAMetalLayer
class
]])
{
fml
::
scoped_nsobject
<
CAMetalLayer
>
metalLayer
(
...
...
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
浏览文件 @
da84d59f
...
...
@@ -362,13 +362,12 @@ void FlutterPlatformViewsController::Reset() {
}
bool
FlutterPlatformViewsController
::
SubmitFrame
(
GrContext
*
gr_context
,
fml
::
WeakPtr
<
IOSGLContext
>
onscreen_gl_context
,
fml
::
WeakPtr
<
IOSGLContext
>
resource_gl_context
)
{
std
::
shared_ptr
<
IOSGLContext
>
gl_context
)
{
DisposeViews
();
bool
did_submit
=
true
;
for
(
int64_t
view_id
:
composition_order_
)
{
EnsureOverlayInitialized
(
view_id
,
onscreen_gl_context
,
resource_gl_context
,
gr_context
);
EnsureOverlayInitialized
(
view_id
,
std
::
move
(
gl_context
)
,
gr_context
);
auto
frame
=
overlays_
[
view_id
]
->
surface
->
AcquireFrame
(
frame_size_
);
SkCanvas
*
canvas
=
frame
->
SkiaCanvas
();
canvas
->
drawPicture
(
picture_recorders_
[
view_id
]
->
finishRecordingAsPicture
());
...
...
@@ -452,8 +451,7 @@ void FlutterPlatformViewsController::DisposeViews() {
void
FlutterPlatformViewsController
::
EnsureOverlayInitialized
(
int64_t
overlay_id
,
fml
::
WeakPtr
<
IOSGLContext
>
onscreen_gl_context
,
fml
::
WeakPtr
<
IOSGLContext
>
resource_gl_context
,
std
::
shared_ptr
<
IOSGLContext
>
gl_context
,
GrContext
*
gr_context
)
{
FML_DCHECK
(
flutter_view_
);
...
...
@@ -469,9 +467,7 @@ void FlutterPlatformViewsController::EnsureOverlayInitialized(
overlay_view
.
get
().
frame
=
flutter_view_
.
get
().
bounds
;
overlay_view
.
get
().
autoresizingMask
=
(
UIViewAutoresizingFlexibleWidth
|
UIViewAutoresizingFlexibleHeight
);
std
::
unique_ptr
<
IOSSurface
>
ios_surface
=
[
overlay_view
.
get
()
createSurfaceWithOnscreenGLContext:
fml
:
:
WeakPtr
<
flutter
:
:
IOSGLContext
>
()
resourceGLContext:
fml
::
WeakPtr
<
flutter
::
IOSGLContext
>
()];
std
::
unique_ptr
<
IOSSurface
>
ios_surface
=
[
overlay_view
.
get
()
createSurface
:
nil
];
std
::
unique_ptr
<
Surface
>
surface
=
ios_surface
->
CreateGPUSurface
();
overlays_
[
overlay_id
]
=
std
::
make_unique
<
FlutterPlatformViewLayer
>
(
std
::
move
(
overlay_view
),
std
::
move
(
ios_surface
),
std
::
move
(
surface
));
...
...
@@ -496,8 +492,7 @@ void FlutterPlatformViewsController::EnsureOverlayInitialized(
overlay_view
.
get
().
autoresizingMask
=
(
UIViewAutoresizingFlexibleWidth
|
UIViewAutoresizingFlexibleHeight
);
std
::
unique_ptr
<
IOSSurface
>
ios_surface
=
[
overlay_view
.
get
()
createSurfaceWithOnscreenGLContext
:
std
:
:
move
(
onscreen_gl_context
)
resourceGLContext:
std
::
move
(
resource_gl_context
)];
[
overlay_view
.
get
()
createSurface
:
std
:
:
move
(
gl_context
)];
std
::
unique_ptr
<
Surface
>
surface
=
ios_surface
->
CreateGPUSurface
(
gr_context
);
overlays_
[
overlay_id
]
=
std
::
make_unique
<
FlutterPlatformViewLayer
>
(
std
::
move
(
overlay_view
),
std
::
move
(
ios_surface
),
std
::
move
(
surface
));
...
...
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
浏览文件 @
da84d59f
...
...
@@ -100,9 +100,7 @@ class FlutterPlatformViewsController {
// Discards all platform views instances and auxiliary resources.
void
Reset
();
bool
SubmitFrame
(
GrContext
*
gr_context
,
fml
::
WeakPtr
<
IOSGLContext
>
onscreen_gl_context
,
fml
::
WeakPtr
<
IOSGLContext
>
resource_gl_context
);
bool
SubmitFrame
(
GrContext
*
gr_context
,
std
::
shared_ptr
<
IOSGLContext
>
gl_context
);
void
OnMethodCall
(
FlutterMethodCall
*
call
,
FlutterResult
&
result
);
...
...
@@ -164,8 +162,7 @@ class FlutterPlatformViewsController {
// Dispose the views in `views_to_dispose_`.
void
DisposeViews
();
void
EnsureOverlayInitialized
(
int64_t
overlay_id
,
fml
::
WeakPtr
<
IOSGLContext
>
onscreen_gl_context
,
fml
::
WeakPtr
<
IOSGLContext
>
resource_gl_context
,
std
::
shared_ptr
<
IOSGLContext
>
gl_context
,
GrContext
*
gr_context
);
// This will return true after pre-roll if any of the embedded views
...
...
shell/platform/darwin/ios/framework/Source/FlutterView.h
浏览文件 @
da84d59f
...
...
@@ -33,8 +33,8 @@
-
(
instancetype
)
initWithDelegate
:(
id
<
FlutterViewEngineDelegate
>
)
delegate
opaque
:(
BOOL
)
opaque
NS_DESIGNATED_INITIALIZER
;
-
(
std
::
unique_ptr
<
flutter
::
IOSSurface
>
)
createSurface
WithResourceGLContext
:
(
fml
::
WeakPtr
<
flutter
::
IOSGLContext
>
)
resourceGLC
ontext
;
-
(
std
::
unique_ptr
<
flutter
::
IOSSurface
>
)
createSurface
:
(
std
::
shared_ptr
<
flutter
::
IOSGLContext
>
)
c
ontext
;
@end
...
...
shell/platform/darwin/ios/framework/Source/FlutterView.mm
浏览文件 @
da84d59f
...
...
@@ -13,7 +13,6 @@
#include "flutter/shell/common/platform_view.h"
#include "flutter/shell/common/rasterizer.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController_Internal.h"
#include "flutter/shell/platform/darwin/ios/ios_gl_context.h"
#include "flutter/shell/platform/darwin/ios/ios_surface_gl.h"
#include "flutter/shell/platform/darwin/ios/ios_surface_software.h"
#include "third_party/skia/include/utils/mac/SkCGUtils.h"
...
...
@@ -22,10 +21,9 @@
#include "flutter/shell/platform/darwin/ios/ios_surface_metal.h"
#endif // FLUTTER_SHELL_ENABLE_METAL
@implementation
FlutterView
{
id
<
FlutterViewEngineDelegate
>
_delegate
;
std
::
unique_ptr
<
flutter
::
IOSGLContext
>
_onscreenGLContext
;
}
@implementation
FlutterView
id
<
FlutterViewEngineDelegate
>
_delegate
;
-
(
instancetype
)
init
{
@throw
([
NSException
exceptionWithName
:
@"FlutterView must initWithDelegate"
...
...
@@ -95,14 +93,8 @@
#endif // TARGET_IPHONE_SIMULATOR
}
-
(
std
::
unique_ptr
<
flutter
::
IOSSurface
>
)
createSurfaceWithResourceGLContext
:
(
fml
::
WeakPtr
<
flutter
::
IOSGLContext
>
)
resourceGLContext
{
#if !TARGET_IPHONE_SIMULATOR
if
(
!
_onscreenGLContext
)
{
_onscreenGLContext
=
resourceGLContext
->
MakeSharedContext
();
}
#endif // !TARGET_IPHONE_SIMULATOR
-
(
std
::
unique_ptr
<
flutter
::
IOSSurface
>
)
createSurface
:
(
std
::
shared_ptr
<
flutter
::
IOSGLContext
>
)
context
{
if
([
self
.
layer
isKindOfClass
:[
CAEAGLLayer
class
]])
{
fml
::
scoped_nsobject
<
CAEAGLLayer
>
eagl_layer
(
reinterpret_cast
<
CAEAGLLayer
*>
([
self
.
layer
retain
]));
...
...
@@ -113,9 +105,8 @@
eagl_layer
.
get
().
presentsWithTransaction
=
YES
;
}
}
return
std
::
make_unique
<
flutter
::
IOSSurfaceGL
>
(
_onscreenGLContext
->
GetWeakPtr
(),
std
::
move
(
resourceGLContext
),
std
::
move
(
eagl_layer
),
[
_delegate
platformViewsController
]);
return
std
::
make_unique
<
flutter
::
IOSSurfaceGL
>
(
context
,
std
::
move
(
eagl_layer
),
[
_delegate
platformViewsController
]);
#if FLUTTER_SHELL_ENABLE_METAL
}
else
if
([
self
.
layer
isKindOfClass
:[
CAMetalLayer
class
]])
{
fml
::
scoped_nsobject
<
CAMetalLayer
>
metalLayer
(
...
...
shell/platform/darwin/ios/ios_gl_context.h
浏览文件 @
da84d59f
...
...
@@ -13,32 +13,30 @@
#include "flutter/fml/macros.h"
#include "flutter/fml/platform/darwin/scoped_nsobject.h"
#include "flutter/shell/common/platform_view.h"
#include "ios_gl_render_target.h"
namespace
flutter
{
class
IOSGLContext
{
public:
IOSGLContext
();
IOSGLContext
(
EAGLSharegroup
*
sharegroup
);
~
IOSGLContext
();
std
::
unique_ptr
<
IOSGLRenderTarget
>
CreateRenderTarget
(
fml
::
scoped_nsobject
<
CAEAGLLayer
>
layer
);
bool
MakeCurrent
();
bool
BindRenderbufferStorage
(
fml
::
scoped_nsobject
<
CAEAGLLayer
>
layer
);
bool
ResourceMakeCurrent
(
);
sk_sp
<
SkColorSpace
>
ColorSpace
()
const
{
return
color_space_
;
}
std
::
unique_ptr
<
IOSGLContext
>
MakeSharedContext
();
fml
::
WeakPtr
<
IOSGLContext
>
GetWeakPtr
();
private:
fml
::
scoped_nsobject
<
EAGLContext
>
context_
;
fml
::
scoped_nsobject
<
EAGLContext
>
resource_context_
;
sk_sp
<
SkColorSpace
>
color_space_
;
std
::
unique_ptr
<
fml
::
WeakPtrFactory
<
IOSGLContext
>>
weak_factory_
;
FML_DISALLOW_COPY_AND_ASSIGN
(
IOSGLContext
);
};
...
...
shell/platform/darwin/ios/ios_gl_context.mm
浏览文件 @
da84d59f
...
...
@@ -12,16 +12,15 @@
namespace
flutter
{
IOSGLContext
::
IOSGLContext
()
:
IOSGLContext
(
nullptr
)
{}
IOSGLContext
::
IOSGLContext
(
EAGLSharegroup
*
sharegroup
)
:
weak_factory_
(
std
::
make_unique
<
fml
::
WeakPtrFactory
<
IOSGLContext
>>
(
this
))
{
context_
.
reset
([[
EAGLContext
alloc
]
initWithAPI
:
kEAGLRenderingAPIOpenGLES3
sharegroup:
sharegroup
]);
if
(
!
context_
)
{
IOSGLContext
::
IOSGLContext
()
{
resource_context_
.
reset
([[
EAGLContext
alloc
]
initWithAPI
:
kEAGLRenderingAPIOpenGLES3
]);
if
(
resource_context_
!=
nullptr
)
{
context_
.
reset
([[
EAGLContext
alloc
]
initWithAPI
:
kEAGLRenderingAPIOpenGLES3
sharegroup:
resource_context_
.
get
().
sharegroup
]);
}
else
{
resource_context_
.
reset
([[
EAGLContext
alloc
]
initWithAPI
:
kEAGLRenderingAPIOpenGLES2
]);
context_
.
reset
([[
EAGLContext
alloc
]
initWithAPI
:
kEAGLRenderingAPIOpenGLES2
sharegroup:
sharegroup
]);
sharegroup:
resource_context_
.
get
().
sharegroup
]);
}
// TODO:
...
...
@@ -45,22 +44,20 @@ IOSGLContext::IOSGLContext(EAGLSharegroup* sharegroup)
}
}
fml
::
WeakPtr
<
IOSGLContext
>
IOSGLContext
::
GetWeakPtr
()
{
return
weak_factory_
->
GetWeakPtr
();
}
IOSGLContext
::~
IOSGLContext
()
=
default
;
bool
IOSGLContext
::
BindRenderbufferStorage
(
fml
::
scoped_nsobject
<
CAEAGLLayer
>
layer
)
{
return
[
context_
.
get
()
renderbufferStorage
:
GL_RENDERBUFFER
fromDrawable
:
layer
.
get
()];
std
::
unique_ptr
<
IOSGLRenderTarget
>
IOSGLContext
::
CreateRenderTarget
(
fml
::
scoped_nsobject
<
CAEAGLLayer
>
layer
)
{
return
std
::
make_unique
<
IOSGLRenderTarget
>
(
std
::
move
(
layer
),
context_
.
get
(),
resource_context_
.
get
());
}
IOSGLContext
::~
IOSGLContext
()
=
default
;
bool
IOSGLContext
::
MakeCurrent
()
{
return
[
EAGLContext
setCurrentContext
:
context_
.
get
()];
}
std
::
unique_ptr
<
IOSGLContext
>
IOSGLContext
::
MakeSharedContex
t
()
{
return
std
::
make_unique
<
IOSGLContext
>
(
context_
.
get
().
sharegroup
)
;
bool
IOSGLContext
::
ResourceMakeCurren
t
()
{
return
[
EAGLContext
setCurrentContext
:
resource_context_
.
get
()]
;
}
}
// namespace flutter
shell/platform/darwin/ios/ios_gl_render_target.h
浏览文件 @
da84d59f
...
...
@@ -13,15 +13,14 @@
#include "flutter/fml/macros.h"
#include "flutter/fml/platform/darwin/scoped_nsobject.h"
#include "flutter/shell/common/platform_view.h"
#include "flutter/shell/platform/darwin/ios/ios_gl_context.h"
namespace
flutter
{
class
IOSGLRenderTarget
{
public:
IOSGLRenderTarget
(
fml
::
scoped_nsobject
<
CAEAGLLayer
>
layer
,
fml
::
WeakPtr
<
IOSGLContext
>
onscreen_
context
,
fml
::
WeakPtr
<
IOSGLContext
>
resource_context
);
EAGLContext
*
context
,
EAGLContext
*
resource_context
);
~
IOSGLRenderTarget
();
...
...
@@ -41,8 +40,8 @@ class IOSGLRenderTarget {
private:
fml
::
scoped_nsobject
<
CAEAGLLayer
>
layer_
;
fml
::
WeakPtr
<
IOSGLContext
>
onscreen_gl_
context_
;
fml
::
WeakPtr
<
IOSGLContext
>
resource_gl
_context_
;
fml
::
scoped_nsobject
<
EAGLContext
>
context_
;
fml
::
scoped_nsobject
<
EAGLContext
>
resource
_context_
;
GLuint
framebuffer_
;
GLuint
colorbuffer_
;
GLint
storage_size_width_
;
...
...
shell/platform/darwin/ios/ios_gl_render_target.mm
浏览文件 @
da84d59f
...
...
@@ -11,22 +11,23 @@
#include "third_party/skia/include/gpu/gl/GrGLInterface.h"
namespace
flutter
{
IOSGLRenderTarget
::
IOSGLRenderTarget
(
fml
::
scoped_nsobject
<
CAEAGLLayer
>
layer
,
fml
::
WeakPtr
<
IOSGLContext
>
onscreen_gl_
context
,
fml
::
WeakPtr
<
IOSGLContext
>
resource_gl
_context
)
EAGLContext
*
context
,
EAGLContext
*
resource
_context
)
:
layer_
(
std
::
move
(
layer
)),
onscreen_gl_context_
(
std
::
move
(
onscreen_gl_context
)
),
resource_
gl_context_
(
std
::
move
(
resource_gl_context
)
),
context_
([
context
retain
]
),
resource_
context_
([
resource_context
retain
]
),
framebuffer_
(
GL_NONE
),
colorbuffer_
(
GL_NONE
),
storage_size_width_
(
0
),
storage_size_height_
(
0
),
valid_
(
false
)
{
FML_DCHECK
(
layer_
!=
nullptr
);
FML_DCHECK
(
onscreen_gl_context_
);
FML_DCHECK
(
resource_
gl_context_
);
FML_DCHECK
(
context_
!=
nullptr
);
FML_DCHECK
(
resource_
context_
!=
nullptr
);
bool
context_current
=
onscreen_gl_context_
->
MakeCurrent
()
;
bool
context_current
=
[
EAGLContext
setCurrentContext
:
context_
]
;
FML_DCHECK
(
context_current
);
FML_DCHECK
(
glGetError
()
==
GL_NO_ERROR
);
...
...
@@ -62,7 +63,7 @@ IOSGLRenderTarget::IOSGLRenderTarget(fml::scoped_nsobject<CAEAGLLayer> layer,
IOSGLRenderTarget
::~
IOSGLRenderTarget
()
{
EAGLContext
*
context
=
EAGLContext
.
currentContext
;
onscreen_gl_context_
->
MakeCurrent
()
;
[
EAGLContext
setCurrentContext
:
context_
]
;
FML_DCHECK
(
glGetError
()
==
GL_NO_ERROR
);
// Deletes on GL_NONEs are ignored
...
...
@@ -104,7 +105,7 @@ bool IOSGLRenderTarget::UpdateStorageSizeIfNecessary() {
FML_DCHECK
(
glGetError
()
==
GL_NO_ERROR
);
if
(
!
onscreen_gl_context_
->
MakeCurrent
()
)
{
if
(
!
[
EAGLContext
setCurrentContext
:
context_
]
)
{
return
false
;
}
...
...
@@ -115,7 +116,7 @@ bool IOSGLRenderTarget::UpdateStorageSizeIfNecessary() {
glBindRenderbuffer
(
GL_RENDERBUFFER
,
colorbuffer_
);
FML_DCHECK
(
glGetError
()
==
GL_NO_ERROR
);
if
(
!
onscreen_gl_context_
->
BindRenderbufferStorage
(
layer_
)
)
{
if
(
!
[
context_
.
get
()
renderbufferStorage
:
GL_RENDERBUFFER
fromDrawable
:
layer_
.
get
()]
)
{
return
false
;
}
...
...
@@ -132,11 +133,11 @@ bool IOSGLRenderTarget::UpdateStorageSizeIfNecessary() {
}
bool
IOSGLRenderTarget
::
MakeCurrent
()
{
return
UpdateStorageSizeIfNecessary
()
&&
onscreen_gl_context_
->
MakeCurrent
()
;
return
UpdateStorageSizeIfNecessary
()
&&
[
EAGLContext
setCurrentContext
:
context_
.
get
()]
;
}
bool
IOSGLRenderTarget
::
ResourceMakeCurrent
()
{
return
resource_gl_context_
->
MakeCurrent
()
;
return
[
EAGLContext
setCurrentContext
:
resource_context_
.
get
()]
;
}
}
// namespace flutter
shell/platform/darwin/ios/ios_surface_gl.h
浏览文件 @
da84d59f
...
...
@@ -20,14 +20,11 @@ class IOSSurfaceGL final : public IOSSurface,
public
GPUSurfaceGLDelegate
,
public
ExternalViewEmbedder
{
public:
IOSSurfaceGL
(
fml
::
WeakPtr
<
IOSGLContext
>
onscreen_gl_context
,
fml
::
WeakPtr
<
IOSGLContext
>
resource_gl_context
,
IOSSurfaceGL
(
std
::
shared_ptr
<
IOSGLContext
>
context
,
fml
::
scoped_nsobject
<
CAEAGLLayer
>
layer
,
FlutterPlatformViewsController
*
platform_views_controller
);
IOSSurfaceGL
(
fml
::
scoped_nsobject
<
CAEAGLLayer
>
layer
,
fml
::
WeakPtr
<
IOSGLContext
>
onscreen_gl_context
,
fml
::
WeakPtr
<
IOSGLContext
>
resource_gl_context
);
IOSSurfaceGL
(
fml
::
scoped_nsobject
<
CAEAGLLayer
>
layer
,
std
::
shared_ptr
<
IOSGLContext
>
context
);
~
IOSSurfaceGL
()
override
;
...
...
@@ -82,10 +79,7 @@ class IOSSurfaceGL final : public IOSSurface,
bool
SubmitFrame
(
GrContext
*
context
)
override
;
private:
fml
::
WeakPtr
<
IOSGLContext
>
onscreen_gl_context_
;
fml
::
WeakPtr
<
IOSGLContext
>
resource_gl_context_
;
std
::
shared_ptr
<
IOSGLContext
>
context_
;
std
::
unique_ptr
<
IOSGLRenderTarget
>
render_target_
;
FML_DISALLOW_COPY_AND_ASSIGN
(
IOSSurfaceGL
);
...
...
shell/platform/darwin/ios/ios_surface_gl.mm
浏览文件 @
da84d59f
...
...
@@ -9,25 +9,17 @@
namespace
flutter
{
IOSSurfaceGL
::
IOSSurfaceGL
(
fml
::
WeakPtr
<
IOSGLContext
>
onscreen_gl_context
,
fml
::
WeakPtr
<
IOSGLContext
>
resource_gl_context
,
IOSSurfaceGL
::
IOSSurfaceGL
(
std
::
shared_ptr
<
IOSGLContext
>
context
,
fml
::
scoped_nsobject
<
CAEAGLLayer
>
layer
,
FlutterPlatformViewsController
*
platform_views_controller
)
:
IOSSurface
(
platform_views_controller
),
onscreen_gl_context_
(
std
::
move
(
onscreen_gl_context
)),
resource_gl_context_
(
std
::
move
(
resource_gl_context
))
{
render_target_
=
std
::
make_unique
<
IOSGLRenderTarget
>
(
std
::
move
(
layer
),
onscreen_gl_context_
,
resource_gl_context_
);
:
IOSSurface
(
platform_views_controller
),
context_
(
context
)
{
render_target_
=
context_
->
CreateRenderTarget
(
std
::
move
(
layer
));
}
IOSSurfaceGL
::
IOSSurfaceGL
(
fml
::
scoped_nsobject
<
CAEAGLLayer
>
layer
,
fml
::
WeakPtr
<
IOSGLContext
>
onscreen_gl_context
,
fml
::
WeakPtr
<
IOSGLContext
>
resource_gl_context
)
:
IOSSurface
(
nullptr
),
onscreen_gl_context_
(
std
::
move
(
onscreen_gl_context
)),
resource_gl_context_
(
std
::
move
(
resource_gl_context
))
{
render_target_
=
std
::
make_unique
<
IOSGLRenderTarget
>
(
std
::
move
(
layer
),
onscreen_gl_context_
,
resource_gl_context_
);
std
::
shared_ptr
<
IOSGLContext
>
context
)
:
IOSSurface
(
nullptr
),
context_
(
context
)
{
render_target_
=
context_
->
CreateRenderTarget
(
std
::
move
(
layer
));
}
IOSSurfaceGL
::~
IOSSurfaceGL
()
=
default
;
...
...
@@ -37,7 +29,7 @@ bool IOSSurfaceGL::IsValid() const {
}
bool
IOSSurfaceGL
::
ResourceContextMakeCurrent
()
{
return
resource_gl_context_
->
MakeCurrent
();
return
context_
->
Resource
MakeCurrent
();
}
void
IOSSurfaceGL
::
UpdateStorageSizeIfNecessary
()
{
...
...
@@ -68,7 +60,7 @@ bool IOSSurfaceGL::GLContextMakeCurrent() {
if
(
!
IsValid
())
{
return
false
;
}
return
render_target_
->
UpdateStorageSizeIfNecessary
()
&&
onscreen_gl_
context_
->
MakeCurrent
();
return
render_target_
->
UpdateStorageSizeIfNecessary
()
&&
context_
->
MakeCurrent
();
}
bool
IOSSurfaceGL
::
GLContextClearCurrent
()
{
...
...
@@ -153,8 +145,7 @@ bool IOSSurfaceGL::SubmitFrame(GrContext* context) {
return
true
;
}
bool
submitted
=
platform_views_controller
->
SubmitFrame
(
std
::
move
(
context
),
onscreen_gl_context_
,
resource_gl_context_
);
bool
submitted
=
platform_views_controller
->
SubmitFrame
(
std
::
move
(
context
),
context_
);
[
CATransaction
commit
];
return
submitted
;
}
...
...
shell/platform/darwin/ios/ios_surface_software.mm
浏览文件 @
da84d59f
...
...
@@ -184,8 +184,7 @@ bool IOSSurfaceSoftware::SubmitFrame(GrContext* context) {
if
(
platform_views_controller
==
nullptr
)
{
return
true
;
}
return
platform_views_controller
->
SubmitFrame
(
nullptr
,
fml
::
WeakPtr
<
IOSGLContext
>
(),
fml
::
WeakPtr
<
IOSGLContext
>
());
return
platform_views_controller
->
SubmitFrame
(
nullptr
,
nullptr
);
}
}
// namespace flutter
shell/platform/darwin/ios/platform_view_ios.h
浏览文件 @
da84d59f
...
...
@@ -50,7 +50,7 @@ class PlatformViewIOS final : public PlatformView {
private:
fml
::
WeakPtr
<
FlutterViewController
>
owner_controller_
;
std
::
unique_ptr
<
IOSSurface
>
ios_surface_
;
std
::
unique_ptr
<
IOSGLContext
>
resource_
gl_context_
;
std
::
shared_ptr
<
IOSGLContext
>
gl_context_
;
PlatformMessageRouter
platform_message_router_
;
std
::
unique_ptr
<
AccessibilityBridge
>
accessibility_bridge_
;
fml
::
scoped_nsprotocol
<
FlutterTextInputPlugin
*>
text_input_plugin_
;
...
...
@@ -78,8 +78,6 @@ class PlatformViewIOS final : public PlatformView {
// |PlatformView|
void
OnPreEngineRestart
()
const
override
;
void
NotifyDestroyed
()
override
;
FML_DISALLOW_COPY_AND_ASSIGN
(
PlatformViewIOS
);
};
...
...
shell/platform/darwin/ios/platform_view_ios.mm
浏览文件 @
da84d59f
...
...
@@ -23,7 +23,7 @@ PlatformViewIOS::PlatformViewIOS(PlatformView::Delegate& delegate,
flutter
::
TaskRunners
task_runners
)
:
PlatformView
(
delegate
,
std
::
move
(
task_runners
))
{
#if !TARGET_IPHONE_SIMULATOR
resource_gl_context_
=
std
::
make_unique
<
IOSGLContext
>
();
gl_context_
=
std
::
make_shared
<
IOSGLContext
>
();
#endif // !TARGET_IPHONE_SIMULATOR
}
...
...
@@ -42,20 +42,16 @@ fml::WeakPtr<FlutterViewController> PlatformViewIOS::GetOwnerViewController() co
return
owner_controller_
;
}
void
PlatformViewIOS
::
NotifyDestroyed
()
{
PlatformView
::
NotifyDestroyed
();
ios_surface_
.
reset
();
}
void
PlatformViewIOS
::
SetOwnerViewController
(
fml
::
WeakPtr
<
FlutterViewController
>
owner_controller
)
{
if
(
ios_surface_
||
!
owner_controller
)
{
NotifyDestroyed
();
ios_surface_
.
reset
();
accessibility_bridge_
.
reset
();
}
owner_controller_
=
owner_controller
;
if
(
owner_controller_
)
{
ios_surface_
=
[
static_cast
<
FlutterView
*>
(
owner_controller
.
get
().
view
)
createSurfaceWithResourceGLContext:
resource_gl_context_
->
GetWeakPtr
()
];
ios_surface_
=
[
static_cast
<
FlutterView
*>
(
owner_controller
.
get
().
view
)
createSurface
:
gl_context_
];
FML_DCHECK
(
ios_surface_
!=
nullptr
);
if
(
accessibility_bridge_
)
{
...
...
@@ -93,7 +89,7 @@ std::unique_ptr<Surface> PlatformViewIOS::CreateRenderingSurface() {
// |PlatformView|
sk_sp
<
GrContext
>
PlatformViewIOS
::
CreateResourceContext
()
const
{
if
(
!
resource_gl_context_
||
!
resource_gl_context_
->
MakeCurrent
())
{
if
(
!
gl_context_
||
!
gl_context_
->
Resource
MakeCurrent
())
{
FML_DLOG
(
INFO
)
<<
"Could not make resource context current on IO thread. "
"Async texture uploads will be disabled. On Simulators, "
"this is expected."
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录