aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <[email protected]>2019-07-23 16:39:31 -0700
committerKenneth Graunke <[email protected]>2019-07-25 18:43:40 +0000
commitcd02f60c1e9d0ef37e4defb8e6b00433990fd90c (patch)
treea2b2331f59a32405fc47c6267346933e9e6ce254 /src/mesa
parent0e24d10ff5c0f2eca97afb149ad4511fcea1a39e (diff)
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 <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/texgetimage.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index f9d24e72880..fcaaf3eee69 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -1457,10 +1457,6 @@ _get_texture_image(struct gl_context *ctx,
/* EXT/ARB direct_state_access variants don't call _get_texture_image
* with a NULL texObj */
bool is_dsa = texObj != NULL;
- if (!legal_getteximage_target(ctx, target, is_dsa)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "%s", caller);
- return;
- }
if (!is_dsa) {
texObj = _mesa_get_current_tex_object(ctx, target);
@@ -1489,6 +1485,11 @@ _mesa_GetnTexImageARB(GLenum target, GLint level, GLenum format, GLenum type,
GET_CURRENT_CONTEXT(ctx);
static const char *caller = "glGetnTexImageARB";
+ if (!legal_getteximage_target(ctx, target, false)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s", caller);
+ return;
+ }
+
_get_texture_image(ctx, NULL, target, level, format, type,
bufSize, pixels, caller);
}
@@ -1501,6 +1502,11 @@ _mesa_GetTexImage(GLenum target, GLint level, GLenum format, GLenum type,
GET_CURRENT_CONTEXT(ctx);
static const char *caller = "glGetTexImage";
+ if (!legal_getteximage_target(ctx, target, false)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s", caller);
+ return;
+ }
+
_get_texture_image(ctx, NULL, target, level, format, type,
INT_MAX, pixels, caller);
}
@@ -1519,6 +1525,11 @@ _mesa_GetTextureImage(GLuint texture, GLint level, GLenum format, GLenum type,
return;
}
+ if (!legal_getteximage_target(ctx, texObj->Target, true)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s", caller);
+ return;
+ }
+
_get_texture_image(ctx, texObj, texObj->Target, level, format, type,
bufSize, pixels, caller);
}
@@ -1538,6 +1549,11 @@ _mesa_GetTextureImageEXT(GLuint texture, GLenum target, GLint level,
return;
}
+ if (!legal_getteximage_target(ctx, target, true)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s", caller);
+ return;
+ }
+
_get_texture_image(ctx, texObj, target, level, format, type,
INT_MAX, pixels, caller);
}