Module: Mesa
Branch: master
Commit: a8d233e509a2c1aada7cd4e83b126ba06cb90565
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a8d233e509a2c1aada7cd4e83b126ba06cb90565

Author: Brian Paul <bri...@vmware.com>
Date:   Thu Oct 29 14:29:55 2009 -0600

i965: use macros to get/set prog_instruction::Aux field

This makes things a bit easier to remember/understand.

---

 src/mesa/drivers/dri/i965/brw_wm.h       |    6 ++++++
 src/mesa/drivers/dri/i965/brw_wm_fp.c    |    8 ++++----
 src/mesa/drivers/dri/i965/brw_wm_glsl.c  |    4 ++--
 src/mesa/drivers/dri/i965/brw_wm_pass0.c |    4 ++--
 4 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm.h 
b/src/mesa/drivers/dri/i965/brw_wm.h
index 872b1f3..f13a958 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.h
+++ b/src/mesa/drivers/dri/i965/brw_wm.h
@@ -271,6 +271,12 @@ struct brw_wm_compile {
 };
 
 
+/** Bits for prog_instruction::Aux field */
+#define INST_AUX_EOT      0x1
+#define INST_AUX_TARGET(T)  (T << 1)
+#define INST_AUX_GET_TARGET(AUX) ((AUX) >> 1)
+
+
 GLuint brw_wm_nr_args( GLuint opcode );
 GLuint brw_wm_is_scalar_result( GLuint opcode );
 
diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c 
b/src/mesa/drivers/dri/i965/brw_wm_fp.c
index 4ef437e..d33fd9a 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_fp.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c
@@ -973,15 +973,15 @@ static void emit_fb_write( struct brw_wm_compile *c )
          outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DATA0 + i);
          last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(), 0),
                                     0, outcolor, payload_r0_depth, outdepth);
-         inst->Aux = (i<<1);
+         inst->Aux = INST_AUX_TARGET(i);
          if (c->fp_fragcolor_emitted) {
             outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLOR);
             last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(), 
0),
                                        0, outcolor, payload_r0_depth, 
outdepth);
-            inst->Aux = (i<<1);
+            inst->Aux = INST_AUX_TARGET(i);
          }
       }
-      last_inst->Aux |= 1; //eot
+      last_inst->Aux |= INST_AUX_EOT;
    }
    else {
       /* if gl_FragData[0] is written, use it, else use gl_FragColor */
@@ -992,7 +992,7 @@ static void emit_fb_write( struct brw_wm_compile *c )
 
       inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0),
                      0, outcolor, payload_r0_depth, outdepth);
-      inst->Aux = 1|(0<<1);
+      inst->Aux = INST_AUX_EOT | INST_AUX_TARGET(0);
    }
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c 
b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
index c9fe1dd..28d6d4e 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
@@ -841,8 +841,8 @@ static void emit_fb_write(struct brw_wm_compile *c,
         nr += 2;
    }
 
-    target = inst->Aux >> 1;
-    eot = inst->Aux & 1;
+    target = INST_AUX_GET_TARGET(inst->Aux);
+    eot = inst->Aux & INST_AUX_EOT;
     fire_fb_write(c, 0, nr, target, eot);
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass0.c 
b/src/mesa/drivers/dri/i965/brw_wm_pass0.c
index 6279258..602b135 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_pass0.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_pass0.c
@@ -322,8 +322,8 @@ translate_insn(struct brw_wm_compile *c,
    out->tex_unit = inst->TexSrcUnit;
    out->tex_idx = inst->TexSrcTarget;
    out->tex_shadow = inst->TexShadow;
-   out->eot = inst->Aux & 1;
-   out->target = inst->Aux >> 1;
+   out->eot = inst->Aux & INST_AUX_EOT;
+   out->target = INST_AUX_GET_TARGET(inst->Aux);
 
    /* Args:
     */

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to