/**
- * Do error checking for all (non-compressed) get-texture-image functions.
- * \return true if any error, false if no errors.
+ * Do teximage-related error checking for getting uncompressed images.
+ * \return true if there was an error
*/
static bool
-getteximage_error_check(struct gl_context *ctx,
- struct gl_texture_object *texObj,
- GLenum target, GLint level,
- GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth,
- GLenum format, GLenum type, GLsizei bufSize,
- GLvoid *pixels, const char *caller)
+teximage_error_check(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
+ GLenum format, const char *caller)
{
- struct gl_texture_image *texImage;
- GLenum baseFormat, err;
- GLint maxLevels;
-
- assert(texObj);
-
- if (texObj->Target == 0) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid texture)", caller);
- return true;
- }
-
- maxLevels = _mesa_max_texture_levels(ctx, target);
- if (level < 0 || level >= maxLevels) {
- _mesa_error(ctx, GL_INVALID_VALUE, "%s(level = %d)", caller, level);
- return true;
- }
-
- err = _mesa_error_check_format_and_type(ctx, format, type);
- if (err != GL_NO_ERROR) {
- _mesa_error(ctx, err, "%s(format/type)", caller);
- 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,
- format, type, bufSize, pixels, caller)) {
- return true;
- }
-
- texImage = select_tex_image(texObj, target, level, zoffset);
+ GLenum baseFormat;
assert(texImage);
/*
return true;
}
else if (_mesa_is_stencil_format(format)
- && !_mesa_is_depthstencil_format(baseFormat)
- && !_mesa_is_stencil_format(baseFormat)) {
+ && !_mesa_is_depthstencil_format(baseFormat)
+ && !_mesa_is_stencil_format(baseFormat)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s(format mismatch)", caller);
return true;
/**
+ * Do error checking for all (non-compressed) get-texture-image functions.
+ * \return true if any error, false if no errors.
+ */
+static bool
+getteximage_error_check(struct gl_context *ctx,
+ struct gl_texture_object *texObj,
+ GLenum target, GLint level,
+ GLint xoffset, GLint yoffset, GLint zoffset,
+ GLsizei width, GLsizei height, GLsizei depth,
+ GLenum format, GLenum type, GLsizei bufSize,
+ GLvoid *pixels, const char *caller)
+{
+ struct gl_texture_image *texImage;
+ GLenum err;
+ GLint maxLevels;
+
+ assert(texObj);
+
+ if (texObj->Target == 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid texture)", caller);
+ return true;
+ }
+
+ maxLevels = _mesa_max_texture_levels(ctx, target);
+ if (level < 0 || level >= maxLevels) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(level = %d)", caller, level);
+ return true;
+ }
+
+ err = _mesa_error_check_format_and_type(ctx, format, type);
+ if (err != GL_NO_ERROR) {
+ _mesa_error(ctx, err, "%s(format/type)", caller);
+ 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,
+ format, type, bufSize, pixels, caller)) {
+ return true;
+ }
+
+ texImage = select_tex_image(texObj, target, level, zoffset);
+ if (teximage_error_check(ctx, texImage, format, caller)) {
+ return true;
+ }
+
+ return false;
+}
+
+
+/**
* Return the width, height and depth of a texture image.
* This function must be resilient to bad parameter values since
* this is called before full error checking.