mesa: rearrange texture error checking order
This moves the width/height/depth == 0 check to the front and avoids doing any other checking when that is the case. Also moves the dimensions check after the format/type checks so that we don't bail out with success on a width/height/depth == 0 request when the format/type don't match. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91425 Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
+13
-13
@@ -928,6 +928,13 @@ dimensions_error_check(struct gl_context *ctx,
|
|||||||
const struct gl_texture_image *texImage;
|
const struct gl_texture_image *texImage;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (width == 0 || height == 0 || depth == 0) {
|
||||||
|
/* Not an error, but nothing to do. Return 'true' so that the
|
||||||
|
* caller simply returns.
|
||||||
|
*/
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (xoffset < 0) {
|
if (xoffset < 0) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "%s(xoffset = %d)", caller, xoffset);
|
_mesa_error(ctx, GL_INVALID_VALUE, "%s(xoffset = %d)", caller, xoffset);
|
||||||
return true;
|
return true;
|
||||||
@@ -1079,13 +1086,6 @@ dimensions_error_check(struct gl_context *ctx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (width == 0 || height == 0 || depth == 0) {
|
|
||||||
/* Not an error, but nothing to do. Return 'true' so that the
|
|
||||||
* caller simply returns.
|
|
||||||
*/
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1164,18 +1164,18 @@ getteximage_error_check(struct gl_context *ctx,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dimensions_error_check(ctx, texObj, target, level,
|
|
||||||
xoffset, yoffset, zoffset,
|
|
||||||
width, height, depth, caller)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = _mesa_error_check_format_and_type(ctx, format, type);
|
err = _mesa_error_check_format_and_type(ctx, format, type);
|
||||||
if (err != GL_NO_ERROR) {
|
if (err != GL_NO_ERROR) {
|
||||||
_mesa_error(ctx, err, "%s(format/type)", caller);
|
_mesa_error(ctx, err, "%s(format/type)", caller);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dimensions_error_check(ctx, texObj, target, level,
|
||||||
|
xoffset, yoffset, zoffset,
|
||||||
|
width, height, depth, caller)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (pbo_error_check(ctx, target, width, height, depth,
|
if (pbo_error_check(ctx, target, width, height, depth,
|
||||||
format, type, bufSize, pixels, caller)) {
|
format, type, bufSize, pixels, caller)) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user