-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Summary
As discussed in #137302 , the practice of unconditionally storing the Stencil Buffer when there are backdrop filters is extremely problematic for performance on Android devices. The intention of this bug is to discuss the feasibility of one possible solution outlined there.
Overview
Rather than store the stencil buffer, instead we could replay stencil affecting commands on subsequent passes. After some investigation, this has proved to be fairly challenging to implement so I'm filling this bug to discuss the approach and as a general ask for help.
I tried a few different approaches:
- Store the actual command object, replay when flipping the entity pass texture ([Impeller] hacky test for non-restore stencil. engine#47291 )
This doesn't work because command objects themselves are only valid within a given render pass. The bound buffers refer to the specific entity pass transients and will not be valid for subsequent passes.
- Store the Entity object, replay ... at somepoint. ([Impeller] stencil buffer record/replay instead of MSAA storage. engine#47397)
This has proved challenging because I've found the entity pass state difficult to reason about. I think part of the issue is that we'll need to potentially transform the entities so that they correctly positioned, but also determining which subpasses need to replay the clip elements is also difficult.
I need to make a more minimal example application that demonstrates a backdrop filter + clip so that I can experiment without using something like wonderous.
Alternatives:
An alternative approach if we can't make this work is to 1) conditionally avoid storing the stencil buffer if there were no clips that wrote to it and 2) Convert all Axis aligned rectangle clips into scissor commands. This would lose multisampling but would otherwise be faster. This would make the advanced blend benchmark faster, but wouldn't be enough to make the wonderous advanced blends faster