I have a long pipeline of shaders in WebGL, where each shader reads from an input texture, renders to another texture, and by the end the last texture contains the desired result.
Can I reuse textures in the pipeline, as if it was ruing synchronously?
// ... init texA to contain input ...
shader1.samplingFrom(texA).renderTo(texB);
shader2.samplingFrom(texB).renderTo(texA);
shader3.samplingFrom(texA).renderTo(texB);
retu readPixels(texB); // Always the same answer?
For that matter, can I even rely on a shader finishing before the next stage starts?
// ... init texA to contain input ...
shader1.samplingFrom(texA).renderTo(texB);
shader2.samplingFrom(texB).renderTo(texC);
shader3.samplingFrom(texC).renderTo(texD);
retu readPixels(texD); // Always the same answer?
I initially thought that I could reuse textures, but I've noticed odd behavior that goes away if I stall the pipeline (implying a race condition of some kind) so now I'm not sure what guarantees are provided.
