Mesa (master): i965/fs: Unify the param pointer allocation for FP/non-FP.

Eric Anholt anholt at kemper.freedesktop.org
Sat Nov 17 21:05:11 UTC 2012


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

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Nov  8 14:02:22 2012 -0800

i965/fs: Unify the param pointer allocation for FP/non-FP.

Now that we're using the new backend, we may actually put things into push
constants if you have too many uniform values uploaded.  Also, correctly
account for texture rectangle params and drop the old special case for the
0.0/1.0 params from the old backend.

---

 src/mesa/drivers/dri/i965/brw_wm.c |   20 +++++++-------------
 1 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index 2c9a6a0..e2d16db 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -221,22 +221,16 @@ bool do_wm_prog(struct brw_context *brw,
     * prog_data associated with the compiled program, and which will be freed
     * by the state cache.
     */
+   int param_count;
    if (fs) {
-      int param_count = fs->num_uniform_components;
-      /* The backend also sometimes adds params for texture size. */
-      param_count += 2 * BRW_MAX_TEX_UNIT;
-
-      c->prog_data.param = rzalloc_array(NULL, const float *, param_count);
-      c->prog_data.pull_param = rzalloc_array(NULL, const float *, param_count);
+      param_count = fs->num_uniform_components;
    } else {
-      /* brw_wm_pass0.c will also add references to 0.0 and 1.0 which are
-       * uploaded as push parameters.
-       */
-      int param_count = (fp->program.Base.Parameters->NumParameters + 2) * 4;
-      c->prog_data.param = rzalloc_array(NULL, const float *, param_count);
-      /* The old backend never does pull constants. */
-      c->prog_data.pull_param = NULL;
+      param_count = fp->program.Base.Parameters->NumParameters * 4;
    }
+   /* The backend also sometimes adds params for texture size. */
+   param_count += 2 * BRW_MAX_TEX_UNIT;
+   c->prog_data.param = rzalloc_array(NULL, const float *, param_count);
+   c->prog_data.pull_param = rzalloc_array(NULL, const float *, param_count);
 
    memcpy(&c->key, key, sizeof(*key));
 




More information about the mesa-commit mailing list