i965: Remove unused param conversion code.
authorEric Anholt <eric@anholt.net>
Sat, 21 Jul 2012 00:03:57 +0000 (17:03 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 25 Jul 2012 17:29:56 +0000 (10:29 -0700)
Ever since ctx->NativeIntegers was set, the conversion flag has been
PARAM_NO_CONVERT.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_curbe.c
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
src/mesa/drivers/dri/i965/brw_wm_pass0.c
src/mesa/drivers/dri/i965/brw_wm_surface_state.c
src/mesa/drivers/dri/i965/gen6_wm_state.c

index c179c698b629824c99e975bd349ce48e3b4f95f9..8a082abce7a445cc08573d9f4d940918b596f311 100644 (file)
@@ -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
index 93ee709130956edd78ab36ce7932cccc9d05ad77..35980bb21709fd2e47ed7db329a890b4621fddb0 100644 (file)
@@ -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];
       }
    }
 
index 85345efc0a4b5e70d1fd1ce992c2a197d3795301..d06858e3c919787f79e3905f5a9d897e8dc63735 100644 (file)
@@ -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;
index 1b648aaa0bd9f6a662e80152270b9b03be1c76a5..fefe2c7d15d330e2a088af8be289caa3f4110e33 100644 (file)
@@ -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);
 
index 5a9eb0a9fbc30f9af6da709e9e2ece1be2b652ee..423e6ed7b2e3554a45022df4f22a52d121b3e431 100644 (file)
@@ -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
index 9607828fd135d7889592331ede3b27fcf8e14400..65ca2fc3f5e395887df7e45b72746fb1d6d008b4 100644 (file)
@@ -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);
 
index 05f4ab9d90c7450f4a1fcb702bb56eef88731508..63acbe3c110f69ee6515a4277bebe2a9fcf15632 100644 (file)
@@ -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) {