Right now I allow a maximum of 4 channels (bands) at a time in memory. At some point a user may wish to have 5 bands in a single algorithm.
A possible solution is to optionally store/allocate two image textures. I.e. right now I pass one vec4 image through the pipeline, but in the future you could pass two: vec4 image; vec4 image2.
Since I believe WebGL supports overloading, most algorithms could have code like:
vec4 sigmoidalContrast(vec4 arr, float contrast, float bias) {
...
}
vec4[2] sigmoidalContrast(vec4 arr1, vec4 arr2, float contrast, float bias) {
arr1 = sigmoidalContrast(arr1, contrast, bias);
arr2 = sigmoidalContrast(arr2, contrast, bias);
return arr1, arr2;
}
(not sure if it's possible/how to return multiple textures from a function).