From 153d148e9e1f89a567b5079003b4b8070925ddcd Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Sun, 24 Aug 2014 21:51:28 -0700 Subject: [PATCH] i965: Replace initialization loops with memset(). Reviewed-by: Topi Pohjolainen --- src/mesa/drivers/dri/i965/brw_fs.cpp | 10 +++------- src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 10 ++-------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 323abff..cfc725d 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -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. diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp index ce0b2a7..9299029 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp @@ -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. -- 2.7.4