[Impeller] disable overdraw prevention for source draws. (flutter/engine#56403)
Overdraw prevention prevents overlapping triangles in the stroke tessellator from being visible with partially opaque draws. For fully opaque draws (or usage of src blend mode) I do not believe this will be an issue - so we can disable this to speed things up a tiny bit. This code runs after we covert opaque draws to src blend mode, so checking for src blend mode should be sufficient.
This commit is contained in:
parent
a6917332f8
commit
7f0892aaeb
@ -232,8 +232,10 @@ class ColorSourceContents : public Contents {
|
|||||||
// If overdraw prevention is enabled (like when drawing stroke paths), we
|
// If overdraw prevention is enabled (like when drawing stroke paths), we
|
||||||
// increment the stencil buffer as we draw, preventing overlapping fragments
|
// increment the stencil buffer as we draw, preventing overlapping fragments
|
||||||
// from drawing. Afterwards, we need to append another draw call to clean up
|
// from drawing. Afterwards, we need to append another draw call to clean up
|
||||||
// the stencil buffer (happens below in this method).
|
// the stencil buffer (happens below in this method). This can be skipped
|
||||||
if (geometry_result.mode == GeometryResult::Mode::kPreventOverdraw) {
|
// for draws that are fully opaque or use src blend mode.
|
||||||
|
if (geometry_result.mode == GeometryResult::Mode::kPreventOverdraw &&
|
||||||
|
options.blend_mode != BlendMode::kSource) {
|
||||||
options.stencil_mode =
|
options.stencil_mode =
|
||||||
ContentContextOptions::StencilMode::kOverdrawPreventionIncrement;
|
ContentContextOptions::StencilMode::kOverdrawPreventionIncrement;
|
||||||
}
|
}
|
||||||
@ -259,7 +261,8 @@ class ColorSourceContents : public Contents {
|
|||||||
// If we performed overdraw prevention, a subsection of the clip heightmap
|
// If we performed overdraw prevention, a subsection of the clip heightmap
|
||||||
// was incremented by 1 in order to self-clip. So simply append a clip
|
// was incremented by 1 in order to self-clip. So simply append a clip
|
||||||
// restore to clean it up.
|
// restore to clean it up.
|
||||||
if (geometry_result.mode == GeometryResult::Mode::kPreventOverdraw) {
|
if (geometry_result.mode == GeometryResult::Mode::kPreventOverdraw &&
|
||||||
|
options.blend_mode != BlendMode::kSource) {
|
||||||
return RenderClipRestore(renderer, pass, entity.GetClipDepth(),
|
return RenderClipRestore(renderer, pass, entity.GetClipDepth(),
|
||||||
GetCoverage(entity));
|
GetCoverage(entity));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user