GLSL: Extended information using texture samplers

I suggest, for each texture sampler declared, we should be able to query the texture size, number of mipmap levels, and possibly texture parameters, such as filtering modes, clamp etc.
The texture size and number of mipmap levels is really valuable information. I’ve seen so many demos passing this information in as user uniforms that it strikes me that it’s an obvious thing to add as built in uniforms, accessed by passing in the sampler you want to query as an argument.