i965: Replace initialization loops with memset().
authorMatt Turner <mattst88@gmail.com>
Mon, 25 Aug 2014 04:51:28 +0000 (21:51 -0700)
committerMatt Turner <mattst88@gmail.com>
Wed, 24 Sep 2014 16:42:46 +0000 (09:42 -0700)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp

index 323abff6744ad1ee9ad66b4d8d5213860d0ff872..cfc725dfcfbb1519bf325ae131f401a3f90becc8 100644 (file)
@@ -1514,9 +1514,8 @@ fs_visitor::calculate_urb_setup()
    brw_wm_prog_data *prog_data = (brw_wm_prog_data*) this->prog_data;
    brw_wm_prog_key *key = (brw_wm_prog_key*) this->key;
 
-   for (unsigned int i = 0; i < VARYING_SLOT_MAX; i++) {
-      prog_data->urb_setup[i] = -1;
-   }
+   memset(prog_data->urb_setup, -1,
+          sizeof(prog_data->urb_setup[0]) * VARYING_SLOT_MAX);
 
    int urb_next = 0;
    /* Figure out where each of the incoming setup attributes lands. */
@@ -1820,10 +1819,7 @@ fs_visitor::move_uniform_array_access_to_pull_constants()
       return;
 
    pull_constant_loc = ralloc_array(mem_ctx, int, uniforms);
-
-   for (unsigned int i = 0; i < uniforms; i++) {
-      pull_constant_loc[i] = -1;
-   }
+   memset(pull_constant_loc, -1, sizeof(pull_constant_loc[0]) * uniforms);
 
    /* Walk through and find array access of uniforms.  Put a copy of that
     * uniform in the pull constant buffer.
index ce0b2a730f2af0bf73bd2cff173dd602a2b80791..92990290eb4ee385a58a7aaaae3c93c404e8613f 100644 (file)
@@ -3332,10 +3332,7 @@ void
 vec4_visitor::move_grf_array_access_to_scratch()
 {
    int scratch_loc[this->virtual_grf_count];
-
-   for (int i = 0; i < this->virtual_grf_count; i++) {
-      scratch_loc[i] = -1;
-   }
+   memset(scratch_loc, -1, sizeof(scratch_loc));
 
    /* First, calculate the set of virtual GRFs that need to be punted
     * to scratch due to having any array access on them, and where in
@@ -3438,10 +3435,7 @@ void
 vec4_visitor::move_uniform_array_access_to_pull_constants()
 {
    int pull_constant_loc[this->uniforms];
-
-   for (int i = 0; i < this->uniforms; i++) {
-      pull_constant_loc[i] = -1;
-   }
+   memset(pull_constant_loc, -1, sizeof(pull_constant_loc));
 
    /* Walk through and find array access of uniforms.  Put a copy of that
     * uniform in the pull constant buffer.