nir: Sampler derefs everywhere, track texture binding bitfields properly
I wanted to be able to track a bitfield of texture bindings used by a shader. We have prog->SamplersUsed, populated by the linker, but that includes textures that NIR may have eliminated via link-time optimizations. Plus, it's not available in shader_info. We were already gathering a bitfield of textures used by texelFetch, but botching it pretty badly. Fixing this turned out to be rather tricky, as we sometimes had sampler derefs, sometimes generated direct texture_index/sampler_index (which radeonsi doesn't even use), sometimes had filled out bindings based on uniform storage, and sometimes not. We couldn't rely on being in any particular state when nir_shader_gather_info was called, as it was called pre-lowering, post-lowering, or without lowering at all.
This series unifies the situation by moving most things to use sampler derefs, and making GLSL, ARB, and built-in shaders all rely on the same core lowering pass - which is also the one radeonsi uses. It gathers texture bitfields at the point in time when we know bindings are set, and derefs still exist. This seems to work fairly well.
A couple passes still run post-lowering, like nir_lower_tex and multi-planar stuff. Hopefully this is okay. I may have missed things. I've tested this with both i965 and iris. Iris in particular uses it to size and fill out binding tables. No regressions.