Hi!
There is a newer API that should help with this: SkImageFilters::RuntimeShader. It works similarly to SkImageFilters::Shader, but was designed for use with custom SkSL shaders (SkRuntimeEffect). One side effect of how it's built is that any `uniform shader` variables in your SkSL can be dynamically bound to image filter inputs. There's a bit to unpack, but two different tests in this file show how it works:
Two things that might be useful to notice: Binding one of the named inputs to nullptr will cause that `uniform shader` to be the "default" contents of the image filter evaluation - in your case, that would be the layer contents during the restore process. Secondly, if the shaders you want to apply to the content already exist (as builtin shaders), you can pretty easily make a pass-through SkSL shader that just forwards the content:
uniform shader child;
vec4 main(vec2 coord) { return child.eval(coord); }
Of course, if you were already planning to apply a custom SkSL shader for your processing, you can just write that code in the SkSL you supply (as is being done in the examples I linked).