More flexible channels, types
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).
You could add a general maxChannels argument. Then you change the signatures for DECKGL_MUTATE_COLOR and DECKGL_CREATE_COLOR to match that. E.g. for maxChannels=3 you'd have:
fs:DECKGL_MUTATE_COLOR(inout vec3 texture1, in vec2 coord)
For maxChannels=5 you'd have:
fs:DECKGL_MUTATE_COLOR(inout vec4 texture1, inout float texture2, in vec2 coord)
Note that you'd have to update each glsl function for every possible overloading...?