This is very much abstracted away in Mesa already, particularly if you use NIR and your driver lives in Gallium.
Like, the classic "Intel OpenGL driver" in Mesa (i.e., i965) doesn't use Gallium and NIR, and hence has to implement each graphics API itself, whereas their modern "Iris" driver using Gallium presumably just handles NIR -> hardware?
Or does the Gallium approach still require some knowledge of higher-level constructs and some knowledge of things above NIR?