[Mesa-dev] [PATCH 1/3] i965: Introduce a prog_data temporary in gen6_upload_wm_push_constants.

Kenneth Graunke kenneth at whitecape.org
Fri Sep 13 16:05:08 PDT 2013


This saves a bit of typing and shortens a few lines.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Cc: Paul Berry <stereotype441 at gmail.com>
---
 src/mesa/drivers/dri/i965/gen6_wm_state.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c b/src/mesa/drivers/dri/i965/gen6_wm_state.c
index 2b9f19c..5a6943f 100644
--- a/src/mesa/drivers/dri/i965/gen6_wm_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c
@@ -41,6 +41,8 @@ gen6_upload_wm_push_constants(struct brw_context *brw)
    /* BRW_NEW_FRAGMENT_PROGRAM */
    const struct brw_fragment_program *fp =
       brw_fragment_program_const(brw->fragment_program);
+   /* CACHE_NEW_WM_PROG */
+   const struct brw_wm_prog_data *prog_data = brw->wm.prog_data;
 
    /* Updates the ParameterValues[i] pointers for all parameters of the
     * basic type of PROGRAM_STATE_VAR.
@@ -48,25 +50,23 @@ gen6_upload_wm_push_constants(struct brw_context *brw)
    /* XXX: Should this happen somewhere before to get our state flag set? */
    _mesa_load_state_parameters(ctx, fp->program.Base.Parameters);
 
-   /* CACHE_NEW_WM_PROG */
-   if (brw->wm.prog_data->nr_params != 0) {
+   if (prog_data->nr_params != 0) {
       float *constants;
       unsigned int i;
 
       constants = brw_state_batch(brw, AUB_TRACE_WM_CONSTANTS,
-				  brw->wm.prog_data->nr_params *
-				  sizeof(float),
+				  prog_data->nr_params * sizeof(float),
 				  32, &brw->wm.base.push_const_offset);
 
-      for (i = 0; i < brw->wm.prog_data->nr_params; i++) {
-	 constants[i] = *brw->wm.prog_data->param[i];
+      for (i = 0; i < prog_data->nr_params; i++) {
+	 constants[i] = *prog_data->param[i];
       }
 
       if (0) {
 	 printf("WM constants:\n");
-	 for (i = 0; i < brw->wm.prog_data->nr_params; i++) {
+	 for (i = 0; i < prog_data->nr_params; i++) {
 	    if ((i & 7) == 0)
-	       printf("g%d: ", brw->wm.prog_data->first_curbe_grf + i / 8);
+	       printf("g%d: ", prog_data->first_curbe_grf + i / 8);
 	    printf("%8f ", constants[i]);
 	    if ((i & 7) == 7)
 	       printf("\n");
-- 
1.8.3.4



More information about the mesa-dev mailing list