From: Eric Anholt Date: Wed, 21 Nov 2012 00:26:22 +0000 (-0800) Subject: i965/fs: Remove the param_index/param_offset indirection. X-Git-Tag: android-x86-4.4-r1~2170 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f189570ccf60ab665cbe9feeff52685600f8163d;p=android-x86%2Fexternal-mesa.git i965/fs: Remove the param_index/param_offset indirection. Now that ParameterValues doesn't change across the visitor, we don't need to go through this. Reviewed-by: Kenneth Graunke --- diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index fcde3dad1b3..e157dc29155 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -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(); diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 75d6cf739b2..d80129887bc 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -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; diff --git a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp index bebf059773d..9ca082a0fc9 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp @@ -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; } } } diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 4bde6c7fb06..d85d48b81be 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -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