Mask layer OR layer to texture

I found the nice Mask.fx effect/shader in the old forum (http://vvvv.org/tiki-download_file.php?fileId=729) and it works nicely in principle.

My problem is that it only takes two textures as input. I would like to animate an object (quad with a file texture on it) first and then mask the layer output of the quad.

Any idea how I can achieve that? I never dug into shaders so I don’t really now whether it would be possible to have the Mask.fx just with two layer inputs instead? Because I could of course make the file texture I use to mask be a layer by first putting it on a quad as well…

I understand that I could basically connect my quad to a renderer and then make a texture out of the renderer output, but that doesn’t really seem performance aware when dealing with multiple objects to mask individually?