Allow surface implementations to control when the raster cache may be enabled. (flutter/engine#32213)
This commit is contained in:
@@ -22,4 +22,8 @@ bool Surface::AllowsDrawingWhenGpuDisabled() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Surface::EnableRasterCache() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
@@ -35,6 +35,8 @@ class Surface {
|
||||
|
||||
virtual bool AllowsDrawingWhenGpuDisabled() const;
|
||||
|
||||
virtual bool EnableRasterCache() const;
|
||||
|
||||
private:
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(Surface);
|
||||
};
|
||||
|
||||
@@ -576,8 +576,11 @@ RasterStatus Rasterizer::DrawToSurfaceUnsafe(
|
||||
}
|
||||
}
|
||||
|
||||
RasterStatus raster_status =
|
||||
compositor_frame->Raster(layer_tree, false, damage.get());
|
||||
RasterStatus raster_status = compositor_frame->Raster(
|
||||
layer_tree, // layer tree
|
||||
!surface_->EnableRasterCache(), // ignore raster cache
|
||||
damage.get() // frame damage
|
||||
);
|
||||
if (raster_status == RasterStatus::kFailed ||
|
||||
raster_status == RasterStatus::kSkipAndRetry) {
|
||||
return raster_status;
|
||||
|
||||
@@ -43,6 +43,9 @@ class SK_API_AVAILABLE_CA_METAL_LAYER GPUSurfaceMetalImpeller : public Surface {
|
||||
// |Surface|
|
||||
bool AllowsDrawingWhenGpuDisabled() const override;
|
||||
|
||||
// |Surface|
|
||||
bool EnableRasterCache() const override;
|
||||
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(GPUSurfaceMetalImpeller);
|
||||
};
|
||||
|
||||
|
||||
@@ -121,4 +121,9 @@ bool GPUSurfaceMetalImpeller::AllowsDrawingWhenGpuDisabled() const {
|
||||
return delegate_->AllowsDrawingWhenGpuDisabled();
|
||||
}
|
||||
|
||||
// |Surface|
|
||||
bool GPUSurfaceMetalImpeller::EnableRasterCache() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace flutter
|
||||
|
||||
Reference in New Issue
Block a user