summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorJian Zhao <[email protected]>2011-12-24 07:58:12 -0700
committerBrian Paul <[email protected]>2011-12-24 08:00:29 -0700
commit26195c8417e710e919352ec6b4dfff83fdc178e2 (patch)
treef5e49bc62e5a0596e4e3f6227abdaa3dadfc2bec /src/mesa
parent1fdecef8868ce1a5ca6c2cb260294fb37d3bd69d (diff)
mesa: move the format and type check before select_tex_image()
Move the format and type check before select_tex_image, or it will fail to report the mismatch error if the teximage is null. Reported-by: Anuj Phogat <[email protected]> Signed-off-by: Jian Zhao <[email protected]> Reviewed-by: Yuanhan Liu <[email protected]> Signed-off-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/texgetimage.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 3f24187292b..6ead871f63b 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -702,12 +702,6 @@ getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level,
return GL_TRUE;
}
- texImage = _mesa_select_tex_image(ctx, texObj, target, level);
- if (!texImage) {
- /* out of memory */
- return GL_TRUE;
- }
-
if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
/*GL_INVALID_OPERATION is generated by a format/type
* mismatch (see the 1.2 spec page 94, sec 3.6.4.)
@@ -716,6 +710,12 @@ getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level,
return GL_TRUE;
}
+ texImage = _mesa_select_tex_image(ctx, texObj, target, level);
+ if (!texImage) {
+ /* out of memory */
+ return GL_TRUE;
+ }
+
baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
/* Make sure the requested image format is compatible with the