Right now in D3D I can do this:
// C++ code
context->PSSetShaderResources (0, 1, &texture);
// HLSL code
SamplerState sampler0 : register(s0);
SamplerState sampler1 : register(s1);
Texture2D tex0 : register(t0);
tex0.Sample (sampler0, ...);
tex0.Sample (sampler1, ...);
As in, bind the texture to the pipeline once and once only, taking up just a single texture unit, but sample it twice using different sampling parameters each time. This is useful for post-processing effects where you may have different “control” images in each colour channel of a single texture, and may wish one to be clamped but others to be wrapped, for example.
In GL I can’t; I need to bind the texture twice, to two separate texture units, owing to the way sampler objects use the same texture units as texture objects. This (1) is awkward, (2) burns an extra texture unit unnecessarily, and (3) not really reflective of the way hardware works.
The solution is simple - define a separate set of “sampler units” using an API similar to glVertexAttribBinding - let’s call it “glTextureSamplerBinding”. Two GLuint params, one for the texture unit and one for the sampler unit to “bind” it to (not too happy about use of the word “bind” here - I’d prefer “attach”, but precedent is set by glVertexAttribBinding so “bind” is at least consistent); a texture unit may be “bound” (attached) to more than one sampler unit, and the default is that each texture unit is “bound” (attached) to the same sampler unit as it’s number (i.e. texture unit 0 “bound” (attached) to sampler unit 0 and so on).