-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
On the Metal and Vulkan backends of Impeller, the process for enabling DRM is fairly straightforward, though there are a few Impeller specific implementation changes and some required benchmarking.
To start with, the damage rect will be fully computed before Impeller has started the frame workload. Flow will inform Impeller of this damage rect indirectly by first applying a clip to the canvas: https://github.com/flutter/engine/blob/main/flow/compositor_context.cc#L153-L169
For Impeller, we should device a better technique of sending the clip rect that lets us actually reduce surface sizes. Additionally, sending the ClipRect and then clearing will force more work from impeller than vice versa.
Now, the expectation is that the texture we acquire from the metal layer will be rendered into with a load instead of a clear so that the older content persists. However, in Impeller we use this texture as the resolve texture for the root multisample render pass. It does not seem like we can use a resolve texture without implicitly clearing it. See WrapCurrentMetalLayerDrawable in surface_mtl.mm.
If so, we may need to use a different texture for the resolve texture and the blit that texture (according to the damage) rect into the actual metal layer's texture. This would be marginally more expensive, so we'd need to benchmark. We could perform this operation conditionally based on whether or not the damage rect was sufficiently large.
FYI @knopp