If I wanted to do some sort of Shader where the Sh...
# compose-desktop
a
If I wanted to do some sort of Shader where the Shader code is dependent on the previous shader result (e.g. in a simulation, or some motion blur). How would I do this? Can I render the shader result in a temporary buffer somehow and load that into the next render frame into a
uniform
?
r
Yes you can link shaders using uniform shader types.
a
Thanks, I am aware that is possible. But unless I am misunderstanding it this is subtly different then what I mean. I want a shader that has as a uniform input the shader result from the last frame(s). This way you can do things like motion blur.
r
Ah, no there’s no easy way to do this
You’d have to render into a bitmap yourself and feed that back to your shader
k
Getting shader output off of the GPU path and into software-managed bitmaps is not going to be good for performance
If possible, I would suggest using another shader that is a “step behind” your primary one, and use that as a child shader to feed that previous frame
r
Technically they don’t have to be software managed bitmaps
Not sure what Skiko provides but that’s what volatile images are in Java2D, and Android has hardware buffers
a
I think I need to understand the pipeline better first before I can do these things. But thanks for your help!