mesa/main: Fix GetTextureImage error reporting
authorIago Toral Quiroga <itoral@igalia.com>
Tue, 5 Sep 2017 11:06:37 +0000 (13:06 +0200)
committerIago Toral Quiroga <itoral@igalia.com>
Wed, 6 Sep 2017 06:19:53 +0000 (08:19 +0200)
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)."

Fixes:
KHR-GL45.direct_state_access.textures_image_query_errors

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/mesa/main/texgetimage.c

index 715bc249be12182954d90ba108bdc42493844d3c..26cf3e5644efd835c6ceeca3d3056cc46dd8403f 100644 (file)
@@ -1430,7 +1430,7 @@ _mesa_GetTextureImage(GLuint texture, GLint level, GLenum format, GLenum type,
    }
 
    if (!legal_getteximage_target(ctx, texObj->Target, true)) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "%s", caller);
+      _mesa_error(ctx, GL_INVALID_OPERATION, "%s", caller);
       return;
    }