Mesa (master): mesa/main: factor out common error-checking

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Nov 26 11:30:36 UTC 2018


Module: Mesa
Branch: master
Commit: 42820c572750c30ae86175ae58bb70439dc2e644
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=42820c572750c30ae86175ae58bb70439dc2e644

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Thu Nov 22 12:37:33 2018 +0100

mesa/main: factor out common error-checking

This error checking is the same for teximage and texsubimage getters, so
let's factor it out to its own function.

This will be useful when getteximage and gettexsubimage gets their own
error checking routines a bit later.

Signed-off-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Reviewed-by: Juan A. Suarez <jasuarez at igalia.com>

---

 src/mesa/main/texgetimage.c | 46 +++++++++++++++++++++++++++++++++------------
 1 file changed, 34 insertions(+), 12 deletions(-)

diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 8ee5cc0d72..cf316a865a 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -1211,24 +1211,20 @@ teximage_error_check(struct gl_context *ctx,
 
 
 /**
- * Do error checking for all (non-compressed) get-texture-image functions.
- * \return true if any error, false if no errors.
+ * Do common 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)
+common_error_check(struct gl_context *ctx,
+                   struct gl_texture_object *texObj,
+                   GLenum target, GLint level,
+                   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;
@@ -1246,6 +1242,32 @@ getteximage_error_check(struct gl_context *ctx,
       return true;
    }
 
+   return false;
+}
+
+
+/**
+ * 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;
+
+   assert(texObj);
+
+   if (common_error_check(ctx, texObj, target, level, width, height, depth,
+                          format, type, bufSize, pixels, caller)) {
+      return true;
+   }
+
    if (dimensions_error_check(ctx, texObj, target, level,
                               xoffset, yoffset, zoffset,
                               width, height, depth, caller)) {




More information about the mesa-commit mailing list