On 05/25/2017 11:47 AM, Timothy Arceri wrote:


On 25/05/17 19:24, Samuel Pitoiset wrote:
While we are at it, rename obj to texObj for consistency.

Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
---
src/mesa/main/texparam.c | 74 ++++++++++++------------------------------------
  1 file changed, 18 insertions(+), 56 deletions(-)

diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 0156bbd275..97cd9b01e3 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -159,10 +159,8 @@ get_texobj_by_name(struct gl_context *ctx, GLuint texture, GLboolean get)
     texObj = _mesa_lookup_texture(ctx, texture);
     if (!texObj) {
-      /*
-       * User passed a non-generated name.
-       * Throw the error in the caller.
-       */
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "gl%sTextureParameterfv(texture)", get ? "Get" : "");

^-- This won't be correct for all functions. You might need to pass the string to this function instead.

Right, should be "gl%sTextureParameter(texture)", get ? "Get" : "");" instead, because the other error check call in this function does the same thing (ie. we don't care about 'fv', etc).


        return NULL;
     }
@@ -1112,11 +1110,8 @@ _mesa_TextureParameterfv(GLuint texture, GLenum pname, const GLfloat *params)
     GET_CURRENT_CONTEXT(ctx);
     texObj = get_texobj_by_name(ctx, texture, GL_FALSE);
-   if (!texObj) {
-      /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureParameterfv(texture)");
+   if (!texObj)
        return;
-   }
     _mesa_texture_parameterfv(ctx, texObj, pname, params, true);
  }
@@ -1128,11 +1123,8 @@ _mesa_TextureParameterf(GLuint texture, GLenum pname, GLfloat param)
     GET_CURRENT_CONTEXT(ctx);
     texObj = get_texobj_by_name(ctx, texture, GL_FALSE);
-   if (!texObj) {
-      /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureParameterf(texture)");
+   if (!texObj)
        return;
-   }
     _mesa_texture_parameterf(ctx, texObj, pname, param, true);
  }
@@ -1144,11 +1136,8 @@ _mesa_TextureParameteri(GLuint texture, GLenum pname, GLint param)
     GET_CURRENT_CONTEXT(ctx);
     texObj = get_texobj_by_name(ctx, texture, GL_FALSE);
-   if (!texObj) {
-      /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureParameteri(texture)");
+   if (!texObj)
        return;
-   }
     _mesa_texture_parameteri(ctx, texObj, pname, param, true);
  }
@@ -1161,11 +1150,8 @@ _mesa_TextureParameteriv(GLuint texture, GLenum pname,
     GET_CURRENT_CONTEXT(ctx);
     texObj = get_texobj_by_name(ctx, texture, GL_FALSE);
-   if (!texObj) {
-      /* User passed a non-generated name. */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureParameteriv(texture)");
+   if (!texObj)
        return;
-   }
     _mesa_texture_parameteriv(ctx, texObj, pname, params, true);
  }
@@ -1178,12 +1164,8 @@ _mesa_TextureParameterIiv(GLuint texture, GLenum pname, const GLint *params)
     GET_CURRENT_CONTEXT(ctx);
     texObj = get_texobj_by_name(ctx, texture, GL_FALSE);
-   if (!texObj) {
-      /* User passed a non-generated name. */
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glTextureParameterIiv(texture)");
+   if (!texObj)
        return;
-   }
     _mesa_texture_parameterIiv(ctx, texObj, pname, params, true);
  }
@@ -1195,12 +1177,8 @@ _mesa_TextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params)
     GET_CURRENT_CONTEXT(ctx);
     texObj = get_texobj_by_name(ctx, texture, GL_FALSE);
-   if (!texObj) {
-      /* User passed a non-generated name. */
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glTextureParameterIuiv(texture)");
+   if (!texObj)
        return;
-   }
     _mesa_texture_parameterIuiv(ctx, texObj, pname, params, true);
  }
@@ -2334,35 +2312,27 @@ _mesa_GetTexParameterIuiv(GLenum target, GLenum pname, GLuint *params)
  void GLAPIENTRY
_mesa_GetTextureParameterfv(GLuint texture, GLenum pname, GLfloat *params)
  {
-   struct gl_texture_object *obj;
+   struct gl_texture_object *texObj;
     GET_CURRENT_CONTEXT(ctx);
-   obj = get_texobj_by_name(ctx, texture, GL_TRUE);
-   if (!obj) {
-      /* User passed a non-generated name. */
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glGetTextureParameterfv(texture)");
+   texObj = get_texobj_by_name(ctx, texture, GL_TRUE);
+   if (!texObj)
        return;
-   }
-   get_tex_parameterfv(ctx, obj, pname, params, true);
+   get_tex_parameterfv(ctx, texObj, pname, params, true);
  }
  void GLAPIENTRY
_mesa_GetTextureParameteriv(GLuint texture, GLenum pname, GLint *params)
  {
-   struct gl_texture_object *obj;
+   struct gl_texture_object *texObj;
     GET_CURRENT_CONTEXT(ctx);
-   obj = get_texobj_by_name(ctx, texture, GL_TRUE);
-   if (!obj) {
-      /* User passed a non-generated name. */
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glGetTextureParameteriv(texture)");
+   texObj = get_texobj_by_name(ctx, texture, GL_TRUE);
+   if (!texObj)
        return;
-   }
-   get_tex_parameteriv(ctx, obj, pname, params, true);
+   get_tex_parameteriv(ctx, texObj, pname, params, true);
  }
  void GLAPIENTRY
@@ -2372,12 +2342,8 @@ _mesa_GetTextureParameterIiv(GLuint texture, GLenum pname, GLint *params)
     GET_CURRENT_CONTEXT(ctx);
     texObj = get_texobj_by_name(ctx, texture, GL_TRUE);
-   if (!texObj) {
-      /* User passed a non-generated name. */
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glGetTextureParameterIiv(texture)");
+   if (!texObj)
        return;
-   }
     get_tex_parameterIiv(ctx, texObj, pname, params, true);
  }
@@ -2390,12 +2356,8 @@ _mesa_GetTextureParameterIuiv(GLuint texture, GLenum pname, GLuint *params)
     GET_CURRENT_CONTEXT(ctx);
     texObj = get_texobj_by_name(ctx, texture, GL_TRUE);
-   if (!texObj) {
-      /* User passed a non-generated name. */
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glGetTextureParameterIuiv(texture)");
+   if (!texObj)
        return;
-   }
     get_tex_parameterIuiv(ctx, texObj, pname, params, true);
  }

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to