From: Eric Anholt Date: Sat, 21 Jul 2012 00:03:57 +0000 (-0700) Subject: i965: Remove unused param conversion code. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cc44aa77490e1360b099eb0b887266f434298b4f;p=mesa.git i965: Remove unused param conversion code. Ever since ctx->NativeIntegers was set, the conversion flag has been PARAM_NO_CONVERT. Reviewed-by: Ian Romanick Reviewed-by: Kenneth Graunke --- diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index c179c698b62..8a082abce7a 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -283,14 +283,6 @@ struct brw_shader_program { struct gl_shader_program base; }; -enum param_conversion { - PARAM_NO_CONVERT, - PARAM_CONVERT_F2I, - PARAM_CONVERT_F2U, - PARAM_CONVERT_F2B, - PARAM_CONVERT_ZERO, -}; - /* Data about a particular attempt to compile a program. Note that * there can be many of these, each in a different GL state * corresponding to a different brw_wm_prog_key struct, with different @@ -323,9 +315,7 @@ struct brw_wm_prog_data { * _mesa_load_state_parameters has been called at runtime). */ const float *param[MAX_UNIFORMS * 4]; /* should be: BRW_MAX_CURBE */ - enum param_conversion param_convert[MAX_UNIFORMS * 4]; const float *pull_param[MAX_UNIFORMS * 4]; - enum param_conversion pull_param_convert[MAX_UNIFORMS * 4]; }; /** @@ -1219,37 +1209,6 @@ brw_fragment_program_const(const struct gl_fragment_program *p) return (const struct brw_fragment_program *) p; } -static inline -float convert_param(enum param_conversion conversion, const float *param) -{ - union { - float f; - uint32_t u; - int32_t i; - } fi; - - switch (conversion) { - case PARAM_NO_CONVERT: - return *param; - case PARAM_CONVERT_F2I: - fi.i = *param; - return fi.f; - case PARAM_CONVERT_F2U: - fi.u = *param; - return fi.f; - case PARAM_CONVERT_F2B: - if (*param != 0.0) - fi.i = 1; - else - fi.i = 0; - return fi.f; - case PARAM_CONVERT_ZERO: - return 0.0; - default: - return *param; - } -} - /** * Pre-gen6, the register file of the EUs was shared between threads, * and each thread used some subset allocated on a 16-register block diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 93ee7091309..35980bb2170 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -205,8 +205,7 @@ brw_upload_constant_buffer(struct brw_context *brw) /* copy float constants */ for (i = 0; i < brw->wm.prog_data->nr_params; i++) { - buf[offset + i] = convert_param(brw->wm.prog_data->param_convert[i], - brw->wm.prog_data->param[i]); + buf[offset + i] = *brw->wm.prog_data->param[i]; } } diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 85345efc0a4..d06858e3c91 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -530,28 +530,6 @@ fs_visitor::setup_uniform_values(int loc, const glsl_type *type) assert(param < ARRAY_SIZE(c->prog_data.param)); - if (ctx->Const.NativeIntegers) { - c->prog_data.param_convert[param] = PARAM_NO_CONVERT; - } else { - switch (type->base_type) { - case GLSL_TYPE_FLOAT: - c->prog_data.param_convert[param] = PARAM_NO_CONVERT; - break; - case GLSL_TYPE_UINT: - c->prog_data.param_convert[param] = PARAM_CONVERT_F2U; - break; - case GLSL_TYPE_INT: - c->prog_data.param_convert[param] = PARAM_CONVERT_F2I; - break; - case GLSL_TYPE_BOOL: - c->prog_data.param_convert[param] = PARAM_CONVERT_F2B; - break; - default: - assert(!"not reached"); - c->prog_data.param_convert[param] = PARAM_NO_CONVERT; - break; - } - } this->param_index[param] = loc; this->param_offset[param] = i; } @@ -609,8 +587,6 @@ fs_visitor::setup_builtin_uniform_values(ir_variable *ir) break; last_swiz = swiz; - c->prog_data.param_convert[c->prog_data.nr_params] = - PARAM_NO_CONVERT; this->param_index[c->prog_data.nr_params] = index; this->param_offset[c->prog_data.nr_params] = swiz; c->prog_data.nr_params++; @@ -1170,7 +1146,6 @@ fs_visitor::remove_dead_constants() * about param_index and param_offset. */ c->prog_data.param[remapped] = c->prog_data.param[i]; - c->prog_data.param_convert[remapped] = c->prog_data.param_convert[i]; } c->prog_data.nr_params = new_nr_params; @@ -1258,8 +1233,6 @@ fs_visitor::setup_pull_constants() for (int i = 0; i < pull_uniform_count; i++) { c->prog_data.pull_param[i] = c->prog_data.param[pull_uniform_base + i]; - c->prog_data.pull_param_convert[i] = - c->prog_data.param_convert[pull_uniform_base + i]; } c->prog_data.nr_params -= pull_uniform_count; c->prog_data.nr_pull_params = pull_uniform_count; diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 1b648aaa0bd..fefe2c7d15d 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -1211,11 +1211,6 @@ fs_visitor::visit(ir_texture *ir) return; } - c->prog_data.param_convert[c->prog_data.nr_params] = - PARAM_NO_CONVERT; - c->prog_data.param_convert[c->prog_data.nr_params + 1] = - PARAM_NO_CONVERT; - scale_x = fs_reg(UNIFORM, c->prog_data.nr_params); scale_y = fs_reg(UNIFORM, c->prog_data.nr_params + 1); diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass0.c b/src/mesa/drivers/dri/i965/brw_wm_pass0.c index 5a9eb0a9fbc..423e6ed7b2e 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_pass0.c +++ b/src/mesa/drivers/dri/i965/brw_wm_pass0.c @@ -113,7 +113,6 @@ static const struct brw_wm_ref *get_param_ref( struct brw_wm_compile *c, struct brw_wm_ref *ref = get_ref(c); c->prog_data.param[i] = param_ptr; - c->prog_data.param_convert[i] = PARAM_NO_CONVERT; c->nr_creg = (i+16)/16; /* Push the offsets into hw_reg. These will be added to the diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 9607828fd13..65ca2fc3f5e 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -937,8 +937,7 @@ brw_upload_wm_pull_constants(struct brw_context *brw) drm_intel_gem_bo_map_gtt(brw->wm.const_bo); constants = brw->wm.const_bo->virtual; for (i = 0; i < brw->wm.prog_data->nr_pull_params; i++) { - constants[i] = convert_param(brw->wm.prog_data->pull_param_convert[i], - brw->wm.prog_data->pull_param[i]); + constants[i] = *brw->wm.prog_data->pull_param[i]; } drm_intel_gem_bo_unmap_gtt(brw->wm.const_bo); diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c b/src/mesa/drivers/dri/i965/gen6_wm_state.c index 05f4ab9d90c..63acbe3c110 100644 --- a/src/mesa/drivers/dri/i965/gen6_wm_state.c +++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c @@ -60,8 +60,7 @@ gen6_upload_wm_push_constants(struct brw_context *brw) 32, &brw->wm.push_const_offset); for (i = 0; i < brw->wm.prog_data->nr_params; i++) { - constants[i] = convert_param(brw->wm.prog_data->param_convert[i], - brw->wm.prog_data->param[i]); + constants[i] = *brw->wm.prog_data->param[i]; } if (0) {