121 Commits

Author SHA1 Message Date
liyuqian
84bf72917c
Revert PRs to unblock David and Jim's work (#14088)
* Revert "Add flow test fixtures and tests (#13986)"

This reverts commit 620f5281b819f304e8e9e945222e26b17b087cc3.

* Revert "Dynamically determine whether to use offscreen surface based on need (#13976)"

This reverts commit a86ef946563b020108320bbfb974bf7343284fd3.
2019-12-03 12:02:37 -08:00
Jim Graham
a86ef94656
Dynamically determine whether to use offscreen surface based on need (#13976)
Only use an offscreen surface on iOS if a layer which reads back from the destination surface, such as BackdropFilter, is present.
2019-11-27 15:01:25 -08:00
Chinmay Garde
5924eebd0c
Add virtual destructor to GPUSurfaceSoftwareDelegate. (#13918) 2019-11-19 10:15:34 -08:00
Todd Volkert
762294cf2d
Revert "RendererContextSwitch guard flutter's gl context rework. (#13812)" (#13906)
This reverts commit f456423cfb820d07bb36e9a8979e3d75cc9d8d76.

This is being reverted because it caused flutter/flutter#45098
(images don't load on iOS).
2019-11-18 18:28:04 -08:00
Chris Yang
f456423cfb
RendererContextSwitch guard flutter's gl context rework. (#13812) 2019-11-14 11:50:45 -08:00
Chris Yang
6d66993b1d
Revert "Reland "Guarding EAGLContext used by Flutter #13314" (#13759)" (#13788)
This reverts commit 2dcfaaeb5d3caee2bf7488e90abadf0456f43922.
2019-11-11 17:17:18 -08:00
Chris Yang
2dcfaaeb5d
Reland "Guarding EAGLContext used by Flutter #13314" (#13759) 2019-11-08 20:09:18 -08:00
Chris Yang
f5754357b6
Revert "Reland "Guarding EAGLContext used by Flutter #13314" (#13755)" (#13757)
This reverts commit 618e6666ced77bf497311876fbe968c6b9d72041.
2019-11-08 13:44:29 -08:00
Chris Yang
618e6666ce
Reland "Guarding EAGLContext used by Flutter #13314" (#13755) 2019-11-08 12:26:48 -08:00
Chris Yang
2036530c4d
Revert "Always use IOSGLContextSwitch to access EAGLContexts to prevent plugins from polluting Flutter's EAGLContext (#13314)" (#13753) 2019-11-08 10:59:45 -08:00
Chris Yang
bec554211b
Always use IOSGLContextSwitch to access EAGLContexts to prevent plugins from polluting Flutter's EAGLContext (#13314) 2019-11-08 10:02:23 -08:00
Chinmay Garde
7b968ff95f
Ensure that the CAMetalLayer FBO attachments can be read from. (#13643)
By default, the CAMetalLayer backing store is a framebuffer attachment that is
only optimized for display. However, effects such as backdrop filters require
renderbuffer readback. Making this calls will result in exceptions. Disable the
write only optimization on such backing store.

Fixes https://github.com/flutter/flutter/issues/43555
2019-11-04 17:28:51 -08:00
Chinmay Garde
4044876a78
Delay metal drawable acquisition till frame submission. (#13367)
Uses the new `SkSurface::MakeFromCAMetalLayer` Skia API.
2019-10-28 13:24:22 -07:00
liyuqian
139051fd58
Change IO thread shader cache strategy (#13121)
So it's the same with the GPU thread.

Otherwise, some shaders may be cached in binary on the IO thread, and we will lose them when we do the SkSL precompile.

For b/140174804
2019-10-14 13:05:05 -07:00
liyuqian
df0e911c67
SkSL precompile (#12412)
For https://github.com/flutter/flutter/issues/40686

Unit tests added:
- CacheSkSLWorks
- VisitFilesCanBeCalledTwice
- CanListFilesRecursively
2019-10-08 11:51:28 -07:00
Dan Field
66636eaded
Platform View implemenation for Metal (#11070) 2019-08-23 16:15:41 -07:00
Chinmay Garde
139a9a799c
Avoid root surface acquisition during custom composition with software renderer. (#11394)
Uses the same technique used during OpenGL composition to elide root surface access. The refactoring of this approach is tracked in https://github.com/flutter/flutter/issues/38466

Fixes https://github.com/flutter/flutter/issues/39009.
2019-08-23 13:52:06 -07:00
Chinmay Garde
e8f954409d
Allow embedder controlled composition of Flutter layers. (#10195)
This patch allows embedders to split the Flutter layer tree into multiple
chunks. These chunks are meant to be composed one on top of another. This gives
embedders a chance to interleave their own contents between these chunks.

The Flutter embedder API already provides hooks for the specification of
textures for the Flutter engine to compose within its own hierarchy (for camera
feeds, video, etc..). However, not all embedders can render the contents of such
sources into textures the Flutter engine can accept. Moreover, this composition
model may have overheads that are non-trivial for certain use cases. In such
cases, the embedder may choose to specify multiple render target for Flutter to
render into instead of just one.

The use of this API allows embedders to perform composition very similar to the
iOS embedder. This composition model is used on that platform for the embedding
of UIKit view such and web view and map views within the Flutter hierarchy.
However, do note that iOS also has threading configurations that are currently
not available to custom embedders.

The embedder API updates in this patch are ABI stable and existing embedders
will continue to work are normal. For embedders that want to enable this
composition mode, the API is designed to make it easy to opt into the same in an
incremental manner.

Rendering of contents into the “root” rendering surface remains unchanged.
However, now the application can push “platform views” via a scene builder.
These platform views need to handled by a FlutterCompositor specified in a new
field at the end of the FlutterProjectArgs struct.

When a new platform view in introduced within the layer tree, the compositor
will ask the embedder to create a new render target for that platform view.
Render targets can currently be OpenGL framebuffers, OpenGL textures or software
buffers. The type of the render target returned by the embedder must be
compatible with the root render surface. That is, if the root render surface is
an OpenGL framebuffer, the render target for each platform view must either be a
texture or a framebuffer in the same OpenGL context. New render target types as
well as root renderers for newer APIs like Metal & Vulkan can and will be added
in the future. The addition of these APIs will be done in an ABI & API stable
manner.

As Flutter renders frames, it gives the embedder a callback with information
about the position of the various platform views in the effective hierarchy.
The embedder is then meant to put the contents of the render targets that it
setup and had previously given to the engine onto the screen (of course
interleaving the contents of the platform views).

Unit-tests have been added that test not only the structure and properties of
layer hierarchy given to the compositor, but also the contents of the texels
rendered by a test compositor using both the OpenGL and software rendering
backends.

Fixes b/132812775
Fixes flutter/flutter#35410
2019-08-13 14:53:19 -07:00
Dan Field
960501721b
Reland Skia Caching improvements (#10434) 2019-08-02 19:31:57 -07:00
Dan Field
564f53f0a6
Revert "Improve caching limits for Skia (#9503)" (#9740)
This reverts commit 63c2c3316d667e7677782d10be57982dd4a7595c.
2019-07-10 12:09:42 -07:00
Dan Field
63c2c3316d
Improve caching limits for Skia (#9503) 2019-06-26 16:21:46 -07:00
Chinmay Garde
ece4f59377
Update Metal backend to account for Skia updates. (#9383)
Also makes it so that folks don't have to patch the buildroot manually when
building for Metal.
2019-06-19 15:24:26 -07:00
Zachary Anderson
0a2e28d797
Revert tracing changes (#9296)
* Revert "[fuchsia] Fix alignment of Fuchsia/non-Fuchsia tracing (#9289)"

This reverts commit f80ac5f571479053b134e60bca77603269b2ce2a.

* Revert "Align fuchsia and non-fuchsia tracing (#9199)"

This reverts commit 78265484623037c6544dfd5380367bca29fa27b0.
2019-06-12 10:25:49 -07:00
Dan Field
7826548462
Align fuchsia and non-fuchsia tracing (#9199) 2019-06-05 15:14:27 -07:00
Matthew Dempsky
3cdfa807fa Replace ararysize macro with fml::size function (#8975)
This is forward compatible with std::size and similar to how Chromium
removed use of the arraysize macro.
2019-05-15 12:43:47 -07:00
Chinmay Garde
5526884e78
Wire up the Skia Metal backend on iOS. (#8936) 2019-05-11 15:21:26 -07:00
liyuqian
8ff631f3df
Rename flow namespace to flutter (#8615)
This follows our namespace change from shell to flutter: https://github.com/flutter/engine/pull/8520.
2019-04-17 14:38:45 -07:00
Chinmay Garde
e356dbca2c
Merge flutter/synchronization contents into fml. (#8525)
When flutter/synchronization was first authored, we did not own fml (it was called fxl then). Now we do, so use a single spot for such utilities. The pipeline was meant to be a general purpose utility that was only ever used by the animator (it even has animator specific tracing), so move that to shell instead (where the animator resides).
2019-04-09 19:18:51 -07:00
Chinmay Garde
56052c70af
Rename the shell namespace to flutter. (#8520) 2019-04-09 17:10:46 -07:00
Chris Bracken
6e6020d299
Eliminate .member = foo struct initialization (#7899)
This breaks MSVC:
```
[3049/3506] CXX obj/flutter/shell/gpu/gpu_surface_gl.gpu_surface_gl_delegate.obj
FAILED: obj/flutter/shell/gpu/gpu_surface_gl.gpu_surface_gl_delegate.obj
ninja -t msvc -e environment.x64 -- E:\b\c\goma_cache\client/gomacc.exe "E:\b\depot_tools\win_toolchain\vs_files\3bc0ec615cf20ee342f3bc29bc991b5ad66d8d2c\VC\Tools\MSVC\14.14.26428\bin\HostX64\x64/cl.exe" /nologo /showIncludes /FC @obj/flutter/shell/gpu/gpu_surface_gl.gpu_surface_gl_delegate.obj.rsp /c ../../flutter/shell/gpu/gpu_surface_gl_delegate.cc /Foobj/flutter/shell/gpu/gpu_surface_gl.gpu_surface_gl_delegate.obj /Fdobj/flutter/shell/gpu/gpu_surface_gl_cc.pdb
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(70): error C2059: syntax error: '.'
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(71): error C2143: syntax error: missing ';' before '}'
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(76): error C2061: syntax error: identifier 'ProcResolverContext'
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(78): error C3536: 'proc_resolver_context': cannot be used before it is initialized
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(78): error C2227: left of '->resolver' must point to class/struct/union/generic type
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(78): note: type is 'int'
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(82): error C2059: syntax error: 'if'
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(82): error C2143: syntax error: missing ';' before '{'
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(82): error C2447: '{': missing function header (old-style formal list?)
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(87): error C2059: syntax error: 'if'
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(87): error C2143: syntax error: missing ';' before '{'
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(87): error C2447: '{': missing function header (old-style formal list?)
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(91): error C2059: syntax error: '('
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(91): error C2059: syntax error: ')'
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(92): error C2059: syntax error: 'return'
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(95): error C2653: 'GPUSurfaceGLDelegate': is not a class or namespace name
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(95): error C2270: 'GetGLInterface': modifiers not allowed on nonmember functions
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(96): error C3861: 'GetGLProcResolver': identifier not found
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(96): error C3861: 'CreateGLInterface': identifier not found
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(100): error C2653: 'GPUSurfaceGLDelegate': is not a class or namespace name
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(101): error C3861: 'CreateGLInterface': identifier not found
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(104): error C2059: syntax error: '}'
e:\b\rr\tmpahx5uo\w\src\flutter\shell\gpu\gpu_surface_gl_delegate.cc(104): error C2143: syntax error: missing ';' before '}'
```
2019-02-20 23:37:26 -08:00
Chinmay Garde
684c9394c0
Respect the custom GL proc table when creating the resource context on the IO thread. (#7893)
Fixes https://github.com/flutter/flutter/issues/28229
2019-02-20 17:23:14 -08:00
Chinmay Garde
4d3a112279
Document GPUSurfaceGLDelegate methods and move it to its own file. (#7755) 2019-02-08 14:21:47 -08:00
Brian Osman
50ddc3712f
Remove SkColorSpaceXformCanvas, use color-managed SkSurfaces instead (#7548)
Behavior (visual) changes should be very minor. Things that are to be expected:
* A few things were not color managed correctly by the transform canvas (color emoji, some color filters). Those will be handled correctly with the tagged surfaces (although we're always transforming to sRGB, so nothing should change until we target a wider gamut).
* Image filtering will happen in the source color space, rather than the destination. Very minor.
* The transform canvas did caching of images in the destination color space. Now, the conversion happens at draw time. If there are performance issues, images can be pre-converted to the destination with makeColorSpace().
2019-01-22 15:34:51 -05:00
Michael Goderbauer
2f706bea07
Fix EXIF orentation problem (#6974) 2018-11-27 14:12:13 -08:00
Michael Goderbauer
09ef73ff6e
Fix code smells reported by chrome's clang plugin (#6833) 2018-11-12 19:59:29 -08:00
Jason Simmons
4dbdf94aaf
Ensure that the EGL rendering context is bound to the GPU thread in Rasterizer::MakeRasterSnapshot (#6816)
Fixes https://github.com/flutter/flutter/issues/24083
2018-11-09 17:05:05 -08:00
Amir Hardon
099b4eeada
Support platform view overlays with GL rendering (#6769)
Moved the frame buffer specific logic from IOSGLContext to IOSGLRenderTarget.

use recording canvases for overlays

Support platform view overlays with gl rendering.

This also changes the overlay canvases (for both software and gl
rendering) be recording canvases, and only rasterize them after
finishing the paint traversal.
2018-11-08 19:52:43 -08:00
Mehmet Fidanboylu
94dd7165ef
Skia Cleanup (#6786) 2018-11-07 15:29:52 -08:00
Michael Goderbauer
70a1106b50
Unify copyright lines (#6757) 2018-11-07 12:24:35 -08:00
Amir Hardon
124f20f404
Clear the on-screen surface every frame. (#6753)
We are currently clearing the offscreen surface before rasterizing, but
as we draw the image snapshot of the offscreen surface into the onscreen
surface transparent pixels are blended with the current contents of the onscreen surface instead of replacing them. This is
particularly noticeable when embedding platform views.
2018-11-05 15:08:07 -08:00
Chinmay Garde
ba8f6aa71c
Handle Windows headers defining ERROR to 0 in log levels. (#6677) 2018-10-26 16:47:14 -07:00
Amir Hardon
df85722fa0
Plumb the iOS PlatformViewsController into flow. (#6603)
For flow to manipulate the embedded UIViews during the paint traversal
it needs some hook in PaintContext.
This PR introduces a ViewEmbeder interface that is implemented by the
iOS PlatformViewsController and plumbs it into PaintContext.

The ViewEmbedder interface is mainly a place holder at this point, as
this PR is focused on just the plumbing.
2018-10-26 14:26:59 -07:00
Chinmay Garde
10f9cab4c5
Ensure that the platform view is created and destroyed when running the shell unittests. (#6560) 2018-10-16 14:30:19 -07:00
Jason Simmons
7767c785b4
Provide a default GL function resolver in the embedder (#6523)
Also check whether the implementation behind the resolver is OpenGL or
OpenGL ES
2018-10-12 15:07:46 -07:00
Chinmay Garde
f2a3df97e2
Wire up the Skia persistent GPU related artifacts cache. (#6278)
Also teaches FML to create files and directories.
2018-09-26 14:54:09 -07:00
Chinmay Garde
b9523318ca
Allow embedders to specify a custom GL proc address resolver. (#6204)
This updates the embedder API but introduces no breaking ABI/API
changes.
2018-09-07 18:25:38 -07:00
Chinmay Garde
47a1ce0e62
Allow embedders to set the root surface transformation. (#6085) 2018-08-28 14:13:49 -07:00
Chinmay Garde
3087090149
Allow embedders to invalidate FBO bindings after present. (#6084) 2018-08-24 16:53:13 -07:00
Chinmay Garde
9f8285ac6c
Remove all dependencies on Garnet. (#5869) 2018-07-26 12:49:34 -07:00
Chinmay Garde
336c23f846
Remove //flutter/glue and use FML directly. (#5862) 2018-07-25 13:20:48 -07:00