mesa: validate texture format against GL/ES ctx
GL_ALPHA, GL_LUMINANCE and GL_LUMINANCE_ALPHA texture formats are supported in:
- GL Compatibility spec
- GLES 1.0 - GLES 3.2 spec
However, these formats are not supported in:
- GL Core spec
This patch changes a logic of validation texture formats in calls like glTexImage2D.
If the context is CORE and these formats were selected, then return "-1" and in upper layer return GL_INVALID_ENUM.
If the context is not CORE, return appropriate format.