st/mesa: move mipmap allocation check logic into a function
st/mesa: move mipmap allocation check logic into a function

Better readability and easier to extend.

Reviewed-by: José Fonseca <61b5a29db2c0650f7c8510f93eece059c1b09320@vmware.com>

metora/MesaGLSLCompiler,metora/MesaGLSLCompiler,metora/MesaGLSLCompiler