Thanks a lot for the prompt answer.
I will investigate more the internals to understand how to proceed. Currently, this optimization would prevent me from using the
SkImageFilter API, as I don't see an easy way to mix the concatenation of
SkImageFilter with
SkRuntimeEffects that are concatenated using
SkRuntimeShaderBuilder. (The way I mentioned in the previous message doesn't seem feasible).
For example, if I have 3
SkRuntimeEffects, A, B, and C, where B and C are children of A and I want them to be concatenated in a single
SkShader (and thus A+B+C is a single
SkShader), there is no way for me to specify the inputs of B and C as
SkImageFilters AFAIS:
SkImageFilters.runtimeShader allows me to set the direct children of the
SkRuntimeEffect referenced by the
SkRuntimeShaderBuilder (A), but not the children of the children effects (B, C).
If I want to do this optimization I have to opt out of
SkImageFilter and keep references to the
SkRuntimeShaderBuilder all the way to the rendering phase, when I would finally specify the inputs by taking an image snapshot of the last rendering pass(es), getting the
SkShaders for those intermediate images and specify them as inputs to the leaf nodes of my
SkRuntimeShaderBuilder tree, and then recursively build the
SkShaders all the way up to the last
SkRuntimeEffect I want to concatenate in the next rendering pass.
This is quite painful and it would be much smoother to just create the description of the tree using
SkImageFilters and let Skia do the magic :D. I would also lose all the other optimizations of
SkImageFilter, such as the intermediate caches and some ROI (or crop rect) analysis that is embedded in the
SkImageFilters implementation, right?
Is there a rough estimate of when could this optimization be prioritized (months, years, never)? I see that the
SkImageFilters and
SkRuntimeEffects APIs are already available to the Android developers in the latest Android releases.
Also, what are the other optimizations included in the
SkImageFilter implementation that I'd lose by implementing the render passes manually?
Thanks a lot!