mesa: Fix GetTextureImage error reporting, again
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Tue, 23 Jul 2019 23:39:31 +0000 (16:39 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 25 Jul 2019 18:43:40 +0000 (18:43 +0000)
commitcd02f60c1e9d0ef37e4defb8e6b00433990fd90c
treea2b2331f59a32405fc47c6267346933e9e6ce254
parent0e24d10ff5c0f2eca97afb149ad4511fcea1a39e
mesa: Fix GetTextureImage error reporting, again

Iago Toral Quiroga fixed this in commit 94f740e3fce0cb26e4d90cb9de75b,
but it recently regressed in 0d8826f723cd8868b5271f17f18a1ab4548a1199.
Quoting Iago's original commit message for the fix:

GetTex*Image should return INVALID_ENUM if target is not valid, however,
GetTextureImage does not receive a target, and instead should return
INVALID_OPERATION if the effective target is not valid.  From the
OpenGL 4.6 core profile spec, section 8.11 Texture Queries:

   "An INVALID_OPERATION error is generated by GetTextureImage if the
    effective target is not one of TEXTURE_1D, TEXTURE_2D, TEXTURE_3D,
    TEXTURE_1D_ARRAY, TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP_ARRAY,
    TEXTURE_RECTANGLE, or TEXTURE_CUBE_MAP (for GetTextureImage only)."

Note that this differs from the original ARB_direct_state_access spec.

However, the EXT_direct_state_access version does take a target
parameter, so it should continue reporting INVALID_ENUM.

Fixes KHR-GL45.direct_state_access.textures_image_query_errors.

Fixes: 0d8826f723c ("mesa: refactor get_texture_image to remove duplicate code")
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/texgetimage.c