i965/fs: Remove the param_index/param_offset indirection.
authorEric Anholt <eric@anholt.net>
Wed, 21 Nov 2012 00:26:22 +0000 (16:26 -0800)
committerEric Anholt <eric@anholt.net>
Fri, 28 Dec 2012 18:53:39 +0000 (10:53 -0800)
Now that ParameterValues doesn't change across the visitor, we don't
need to go through this.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_fs_fp.cpp
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp

index fcde3dad1b3a6c69ba915760f0edc69080fb004e..e157dc2915524a2ce93048bca9c1fe60d1411852 100644 (file)
@@ -815,10 +815,8 @@ fs_visitor::setup_uniform_values(int loc, const glsl_type *type)
    case GLSL_TYPE_INT:
    case GLSL_TYPE_BOOL:
       for (unsigned int i = 0; i < type->vector_elements; i++) {
-        unsigned int param = c->prog_data.nr_params++;
-
-        this->param_index[param] = loc;
-        this->param_offset[param] = i;
+        c->prog_data.param[c->prog_data.nr_params++] =
+            &fp->Base.Parameters->ParameterValues[loc][i].f;
       }
       return 1;
 
@@ -874,9 +872,8 @@ fs_visitor::setup_builtin_uniform_values(ir_variable *ir)
            break;
         last_swiz = swiz;
 
-        this->param_index[c->prog_data.nr_params] = index;
-        this->param_offset[c->prog_data.nr_params] = swiz;
-        c->prog_data.nr_params++;
+        c->prog_data.param[c->prog_data.nr_params++] =
+            &fp->Base.Parameters->ParameterValues[index][swiz].f;
       }
    }
 }
@@ -1179,25 +1176,6 @@ fs_visitor::emit_math(enum opcode opcode, fs_reg dst, fs_reg src0, fs_reg src1)
    return inst;
 }
 
-/**
- * To be called after the last _mesa_add_state_reference() call, to
- * set up prog_data.param[] for assign_curb_setup() and
- * setup_pull_constants().
- */
-void
-fs_visitor::setup_paramvalues_refs()
-{
-   if (dispatch_width != 8)
-      return;
-
-   /* Set up the pointers to ParamValues now that that array is finalized. */
-   for (unsigned int i = 0; i < c->prog_data.nr_params; i++) {
-      c->prog_data.param[i] =
-        (const float *)fp->Base.Parameters->ParameterValues[this->param_index[i]] +
-        this->param_offset[i];
-   }
-}
-
 void
 fs_visitor::assign_curb_setup()
 {
@@ -1528,9 +1506,6 @@ fs_visitor::remove_dead_constants()
         if (remapped == -1)
            continue;
 
-        /* We've already done setup_paramvalues_refs() so no need to worry
-         * about param_index and param_offset.
-         */
         c->prog_data.param[remapped] = c->prog_data.param[i];
       }
 
@@ -2506,7 +2481,6 @@ fs_visitor::run()
 
       split_virtual_grfs();
 
-      setup_paramvalues_refs();
       move_uniform_array_access_to_pull_constants();
       setup_pull_constants();
 
index 75d6cf739b23b7fd30572766a0a75b622a44028c..d80129887bca6aaa2af04593686a317efb377779 100644 (file)
@@ -296,7 +296,6 @@ public:
    bool run();
    void setup_payload_gen4();
    void setup_payload_gen6();
-   void setup_paramvalues_refs();
    void assign_curb_setup();
    void calculate_urb_setup();
    void assign_urb_setup();
@@ -419,11 +418,6 @@ public:
    struct brw_wm_compile *c;
    unsigned int sanity_param_count;
 
-   /* Delayed setup of c->prog_data.params[] due to realloc of
-    * ParamValues[] during compile.
-    */
-   int param_index[MAX_UNIFORMS * 4];
-   int param_offset[MAX_UNIFORMS * 4];
    int param_size[MAX_UNIFORMS * 4];
 
    int *virtual_grf_sizes;
index bebf059773d55a1d7f6d158c38ac736940ed44b5..9ca082a0fc9821426183aee3c1a23e0dab1fedb6 100644 (file)
@@ -596,9 +596,8 @@ fs_visitor::setup_fp_regs()
       for (unsigned p = 0;
            p < fp->Base.Parameters->NumParameters; p++) {
          for (unsigned int i = 0; i < 4; i++) {
-            this->param_index[c->prog_data.nr_params] = p;
-            this->param_offset[c->prog_data.nr_params] = i;
-            c->prog_data.nr_params++;
+            c->prog_data.param[c->prog_data.nr_params++] =
+               &fp->Base.Parameters->ParameterValues[p][i].f;
          }
       }
    }
index 4bde6c7fb0605f80563abfb9b507b1be05d005b0..d85d48b81beeaaaa453639422f72168cb1a6a68f 100644 (file)
@@ -1220,13 +1220,10 @@ fs_visitor::rescale_texcoord(ir_texture *ir, fs_reg coordinate,
 
       GLuint index = _mesa_add_state_reference(params,
                                               (gl_state_index *)tokens);
-
-      this->param_index[c->prog_data.nr_params] = index;
-      this->param_offset[c->prog_data.nr_params] = 0;
-      c->prog_data.nr_params++;
-      this->param_index[c->prog_data.nr_params] = index;
-      this->param_offset[c->prog_data.nr_params] = 1;
-      c->prog_data.nr_params++;
+      c->prog_data.param[c->prog_data.nr_params++] =
+         &fp->Base.Parameters->ParameterValues[index][0].f;
+      c->prog_data.param[c->prog_data.nr_params++] =
+         &fp->Base.Parameters->ParameterValues[index][1].f;
    }
 
    /* The 965 requires the EU to do the normalization of GL rectangle