CustomRenderTexture 2 passes / cyclic dependency error

Hi,

I’m trying to use CustomRenderTexture but having an error.
I have a liquid simulation system with 2 shaders where
shader 1 depends on texture A and generates texture B
shader 2 depends on texture B and generates texture A

so I set up the CustomRenderTexture A and B and run 2 serial updates via script. Then I have this error

Assertion failed: Custom Texture cyclic dependency should not exist.

Which is weird. Why i can’t use cyclic dependency when I run passes via script ?

Another way to do it is to run 2 different passes with just one texture on IN and OUT of those passes. but I can’t figure out how to switch passes via script because it’s not documented. i didnt find a command like SetPass() or anything
https://docs.unity3d.com/Manual/CustomRenderTextures.html

Please, tell me either how can I run 2 different passes on CustomRenderTexture via script or how can I avoid cyclic dependency on 2 CustomRenderTextures.

P/S CustomRenderTexture should be a cool thing but the way its implemented atm is bit confusing.

I have the same error and the same question

I think you need to use an extra texture as input for CustomRenderTexture B and blit A’s output between A and B.

At least that seems what they are doing with a double buffered CustomRenderTexture according to the docs: