There are also a few other issues, esp with the scene referred pipeline where the data passes through stages of dynamic range and colorspace transitions.
The early pipe is raw sensor data, linear unbounded highdynamic range. Then in the middle its demosaiced, color calibrated linear rgb. The later stages are tone mapped and compressed to non-linear display data.
Applying a single mask across modules that bridge the transition from linear HDR data to compressed display space could lead to severe blending artifacts and non-physical color shifts. Maybe with other software that starts out in display space things are easier to manage that way or maybe some don’t even have a fixed processing order??
As already noted, parametric masks calculate pixel inclusion using specific channels (luminance, chromaticity, hue). A parametric mask evaluated at the beginning of a mask container would lose mathematical validity if modules “inside” that container alter the color space, saturation, or tonal distribution.
The same for anything geometric that alters pixel coordinates, aspect ratio, and image dimensions at specific points in the pipeline.
In short, darktable could be described I think as a parametric RAW converter built on a linear buffer pipeline, whereas a “mask-first” workflow would require a node or layer-based compositing engine with branching sub-pipelines.
Currently each DT module receives an incoming pixel buffer, applies its operation, evaluates its own internal mask, blends the output, and hands the modified buffer to the next module.
Mask containers would break this, I think if you want multiple modules inside a mask group this requires splitting the image stream into two branches.
Loosely you would need an unmodified baseline branch and a sub-pipeline branch that executes the grouped modules in sequence, and finally a compositing step at the end of the group that blends branch 1 and branch 2 using the mask. And I guess a means to manage multiple masks.
Branching pipelines with nested mask groups would break the pipe cache model. Tracking sub-tile ROIs across parallel branches, intermediate mask compositing buffers, and GPU OpenCL memory allocations would dramatically decrease processing speeds and increase memory consumption.
In any case I feel like its not just a simple act of reorganization and some modifications to get that model to work, I don’t think, and the modules themselves are designed around the existing pipeline model…
This would be a whole other project and vkdt is one such project making that sort of leap with technical tools “like” or in the spirit of darktable but used in a completely different operational framework to allow for nodes and parallel processing…
But I am also not a programmer so things I see as limitations or operational issues might not be. For context DT could use branching for output to branch output and display but that has been a bridge too far up until now so this seems next level… 