mesa: Fix glFramebufferTexture* error codes (v2)

If check_textarget() determined that textarget was incorrect, it emitted
GL_INVALID_OPERATION.  This is the correct behavior when target and
textarget are mismatched but textarget is a valid textarget enum.

When textarget is not a valid textarget enum, the GL spec requires that
GL_INVALID_ENUM be emitted.

Fixes test dEQP-GLES3.functional.negative_api.buffer.framebuffer_texture2d.

v2:
  - Continue emitting GL_INVALID_OPERATION when textarget is
    a valid textarget enum mismatched with target. [idr and imirkin]

Cc: mesa-stable@lists.freedesktop.org
Cc: Ian Romanick <idr@freedesktop.org>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Haixia Shi <hshi@chromium.org>
Change-Id: I86c492f228720ec8cf9939e741cfc99a5d9fa1bc
1 file changed