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

Author: Brian Paul <bri...@vmware.com>
Date:   Fri Oct  7 14:28:21 2016 -0600

mesa: remove 'params' parameter from ctx->Driver.TexParameter()

None of the drivers which implement this hook do anything with the
texture parameter value.  Drivers just look at the pname and set a
dirty flag if needed.

We were doing some ugly casting and type conversion to setup the
argument so that all goes away.

Reviewed-by: Marek Olšák <marek.ol...@amd.com>

---

 src/mesa/drivers/dri/nouveau/nouveau_state.c |  3 +--
 src/mesa/drivers/dri/r200/r200_tex.c         |  6 +++---
 src/mesa/drivers/dri/radeon/radeon_tex.c     |  2 +-
 src/mesa/main/dd.h                           |  5 ++---
 src/mesa/main/teximage.c                     |  6 ++----
 src/mesa/main/texobj.c                       | 15 ++++++---------
 src/mesa/main/texparam.c                     | 17 ++++-------------
 src/mesa/state_tracker/st_cb_texture.c       |  3 +--
 8 files changed, 20 insertions(+), 37 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c 
b/src/mesa/drivers/dri/nouveau/nouveau_state.c
index 6189997..de36fa4 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c
@@ -395,8 +395,7 @@ nouveau_tex_env(struct gl_context *ctx, GLenum target, 
GLenum pname,
 
 static void
 nouveau_tex_parameter(struct gl_context *ctx,
-                     struct gl_texture_object *t, GLenum pname,
-                     const GLfloat *params)
+                     struct gl_texture_object *t, GLenum pname)
 {
        switch (pname) {
        case GL_TEXTURE_MAG_FILTER:
diff --git a/src/mesa/drivers/dri/r200/r200_tex.c 
b/src/mesa/drivers/dri/r200/r200_tex.c
index ca92110..2a95f2d 100644
--- a/src/mesa/drivers/dri/r200/r200_tex.c
+++ b/src/mesa/drivers/dri/r200/r200_tex.c
@@ -374,9 +374,9 @@ void r200TexUpdateParameters(struct gl_context *ctx, GLuint 
unit)
  * Changes variables and flags for a state update, which will happen at the
  * next UpdateTextureState
  */
-static void r200TexParameter( struct gl_context *ctx,
-                               struct gl_texture_object *texObj,
-                               GLenum pname, const GLfloat *params )
+static void r200TexParameter(struct gl_context *ctx,
+                             struct gl_texture_object *texObj,
+                             GLenum pname)
 {
    radeonTexObj* t = radeon_tex_obj(texObj);
 
diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.c 
b/src/mesa/drivers/dri/radeon/radeon_tex.c
index d1aa1a1..083a5e1 100644
--- a/src/mesa/drivers/dri/radeon/radeon_tex.c
+++ b/src/mesa/drivers/dri/radeon/radeon_tex.c
@@ -329,7 +329,7 @@ void radeonTexUpdateParameters(struct gl_context *ctx, 
GLuint unit)
 
 static void radeonTexParameter( struct gl_context *ctx,
                                struct gl_texture_object *texObj,
-                               GLenum pname, const GLfloat *params )
+                               GLenum pname )
 {
    radeonTexObj* t = radeon_tex_obj(texObj);
 
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 7f53271..1d75b9f 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -610,10 +610,9 @@ struct dd_function_table {
    /** Set texture environment parameters */
    void (*TexEnv)(struct gl_context *ctx, GLenum target, GLenum pname,
                   const GLfloat *param);
-   /** Set texture parameters */
+   /** Set texture parameter (callee gets param value from the texObj) */
    void (*TexParameter)(struct gl_context *ctx,
-                        struct gl_texture_object *texObj,
-                        GLenum pname, const GLfloat *params);
+                        struct gl_texture_object *texObj, GLenum pname);
    /** Set the viewport */
    void (*Viewport)(struct gl_context *ctx);
    /*@}*/
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 411ec49..bc3b76a 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5082,12 +5082,10 @@ texture_buffer_range(struct gl_context *ctx,
 
    if (ctx->Driver.TexParameter) {
       if (offset != oldOffset) {
-         ctx->Driver.TexParameter(ctx, texObj, GL_TEXTURE_BUFFER_OFFSET,
-                                  (const GLfloat *) &offset);
+         ctx->Driver.TexParameter(ctx, texObj, GL_TEXTURE_BUFFER_OFFSET);
       }
       if (size != oldSize) {
-         ctx->Driver.TexParameter(ctx, texObj, GL_TEXTURE_BUFFER_SIZE,
-                                  (const GLfloat *) &size);
+         ctx->Driver.TexParameter(ctx, texObj, GL_TEXTURE_BUFFER_SIZE);
       }
    }
 
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 9a051bc..fbd498d 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -365,15 +365,12 @@ finish_texture_init(struct gl_context *ctx, GLenum target,
          obj->Sampler.MinFilter = filter;
          obj->Sampler.MagFilter = filter;
          if (ctx->Driver.TexParameter) {
-            static const GLfloat fparam_wrap[1] = {(GLfloat) GL_CLAMP_TO_EDGE};
-            const GLfloat fparam_filter[1] = {(GLfloat) filter};
-            ctx->Driver.TexParameter(ctx, obj, GL_TEXTURE_WRAP_S, fparam_wrap);
-            ctx->Driver.TexParameter(ctx, obj, GL_TEXTURE_WRAP_T, fparam_wrap);
-            ctx->Driver.TexParameter(ctx, obj, GL_TEXTURE_WRAP_R, fparam_wrap);
-            ctx->Driver.TexParameter(ctx, obj,
-                  GL_TEXTURE_MIN_FILTER, fparam_filter);
-            ctx->Driver.TexParameter(ctx, obj,
-                  GL_TEXTURE_MAG_FILTER, fparam_filter);
+            /* XXX we probably don't need to make all these calls */
+            ctx->Driver.TexParameter(ctx, obj, GL_TEXTURE_WRAP_S);
+            ctx->Driver.TexParameter(ctx, obj, GL_TEXTURE_WRAP_T);
+            ctx->Driver.TexParameter(ctx, obj, GL_TEXTURE_WRAP_R);
+            ctx->Driver.TexParameter(ctx, obj, GL_TEXTURE_MIN_FILTER);
+            ctx->Driver.TexParameter(ctx, obj, GL_TEXTURE_MAG_FILTER);
          }
          break;
 
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index a814778..29eed07 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -807,7 +807,7 @@ _mesa_texture_parameterf(struct gl_context *ctx,
    }
 
    if (ctx->Driver.TexParameter && need_update) {
-      ctx->Driver.TexParameter(ctx, texObj, pname, &param);
+      ctx->Driver.TexParameter(ctx, texObj, pname);
    }
 }
 
@@ -874,7 +874,7 @@ _mesa_texture_parameterfv(struct gl_context *ctx,
    }
 
    if (ctx->Driver.TexParameter && need_update) {
-      ctx->Driver.TexParameter(ctx, texObj, pname, params);
+      ctx->Driver.TexParameter(ctx, texObj, pname);
    }
 }
 
@@ -919,8 +919,7 @@ _mesa_texture_parameteri(struct gl_context *ctx,
    }
 
    if (ctx->Driver.TexParameter && need_update) {
-      GLfloat fparam = (GLfloat) param;
-      ctx->Driver.TexParameter(ctx, texObj, pname, &fparam);
+      ctx->Driver.TexParameter(ctx, texObj, pname);
    }
 }
 
@@ -964,15 +963,7 @@ _mesa_texture_parameteriv(struct gl_context *ctx,
    }
 
    if (ctx->Driver.TexParameter && need_update) {
-      GLfloat fparams[4];
-      fparams[0] = INT_TO_FLOAT(params[0]);
-      if (pname == GL_TEXTURE_BORDER_COLOR ||
-          pname == GL_TEXTURE_CROP_RECT_OES) {
-         fparams[1] = INT_TO_FLOAT(params[1]);
-         fparams[2] = INT_TO_FLOAT(params[2]);
-         fparams[3] = INT_TO_FLOAT(params[3]);
-      }
-      ctx->Driver.TexParameter(ctx, texObj, pname, fparams);
+      ctx->Driver.TexParameter(ctx, texObj, pname);
    }
 }
 
diff --git a/src/mesa/state_tracker/st_cb_texture.c 
b/src/mesa/state_tracker/st_cb_texture.c
index b448e56..fa52a4e 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -2860,8 +2860,7 @@ st_ClearTexSubImage(struct gl_context *ctx,
  */
 static void
 st_TexParameter(struct gl_context *ctx,
-                struct gl_texture_object *texObj,
-                GLenum pname, const GLfloat *params)
+                struct gl_texture_object *texObj, GLenum pname)
 {
    struct st_context *st = st_context(ctx);
    struct st_texture_object *stObj = st_texture_object(texObj);

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

Reply via email to