Skip to content

[Impeller] Transparent paths overdraw #101330

Closed
flutter/impeller
#121
@bdero

Description

Right now, we don't write to a depth or stencil buffer for draw calls that render solid strokes/fills, and overlapping triangles in the same draw call just draw on top of each other.

image

Here's the equivalent Skia Fiddle for reference:
https://fiddle.skia.org/c/027392122bec8ac2b5d5de00a4b9bbe2
image

Since we're already using the stencil check for the clip stack, one solution would be to use shallow depth attachments per render target, increment the geometry depth slightly with each draw call, draw with MTLCompareFunction.greater, and clear the depth buffer whenever we have enough solid strokes/fills drawn to the target such that we need to loop around.

@chinmaygarde Does the above seem like a reasonable approach to you? We could also trade the increased device memory for solutions with more draw calls (like increment the stencil buffer and discard fragments that don't match the current stencil height, then draw a clip restore at the previous max height), but I suspect we're doing pretty good in the device memory department right now.

Metadata

Assignees

No one assigned

    Labels

    c: renderingUI glitches reported at the engine/skia or impeller rendering levele: impellerImpeller rendering backend issues and features requestsengineflutter/engine repository. See also e: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions