Mesa (master): mesa: replace old prog_instruction:: Sampler field with Aux field

Brian Paul brianp at kemper.freedesktop.org
Fri Feb 27 01:51:04 UTC 2009


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

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Feb 23 17:50:55 2009 -0700

mesa: replace old prog_instruction::Sampler field with Aux field

The i965 driver needs an extra instruction field for color output information.
It was using the Sampler field for this.  Use the Aux field instead.  This
will probaby be revisited at some point...

---

 src/mesa/drivers/dri/i965/brw_wm_fp.c    |   11 +++++------
 src/mesa/drivers/dri/i965/brw_wm_glsl.c  |    4 ++--
 src/mesa/drivers/dri/i965/brw_wm_pass0.c |    4 ++--
 src/mesa/shader/prog_instruction.h       |   11 +++--------
 4 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c
index b2d67bd..fcd833b 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_fp.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c
@@ -869,8 +869,7 @@ static void emit_fb_write( struct brw_wm_compile *c )
    struct prog_instruction *inst, *last_inst;
    struct brw_context *brw = c->func.brw;
 
-   /* inst->Sampler is not used by backend, 
-      use it for fb write target and eot */
+   /* The inst->Aux field is used for FB write target and the EOT marker */
 
    if (brw->state.nr_draw_regions > 1) {
       for (i = 0 ; i < brw->state.nr_draw_regions; i++) {
@@ -878,15 +877,15 @@ static void emit_fb_write( struct brw_wm_compile *c )
          last_inst = inst = emit_op(c,
                                     WM_FB_WRITE, dst_mask(dst_undef(),0), 0,
                                     outcolor, payload_r0_depth, outdepth);
-         inst->Sampler = (i<<1);
+         inst->Aux = (i<<1);
          if (c->fp_fragcolor_emitted) {
             outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLR);
             last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0),
                                        0, outcolor, payload_r0_depth, outdepth);
-            inst->Sampler = (i<<1);
+            inst->Aux = (i<<1);
          }
       }
-      last_inst->Sampler |= 1; //eot
+      last_inst->Aux |= 1; //eot
    }
    else {
       /* if gl_FragData[0] is written, use it, else use gl_FragColor */
@@ -897,7 +896,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->Sampler = 1|(0<<1);
+      inst->Aux = 1|(0<<1);
    }
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
index 121cdc0..8e404bc 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
@@ -426,8 +426,8 @@ static void emit_fb_write(struct brw_wm_compile *c,
        nr += 2;
     }
 
-    target = inst->Sampler >> 1;
-    eot = inst->Sampler & 1;
+    target = inst->Aux >> 1;
+    eot = inst->Aux & 1;
     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 783545d..2debd06 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_pass0.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_pass0.c
@@ -350,8 +350,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->Sampler & 1;
-   out->target = inst->Sampler>>1;
+   out->eot = inst->Aux & 1;
+   out->target = inst->Aux >> 1;
 
    /* Args:
     */
diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/shader/prog_instruction.h
index e3bb7ac..3808644 100644
--- a/src/mesa/shader/prog_instruction.h
+++ b/src/mesa/shader/prog_instruction.h
@@ -410,20 +410,15 @@ struct prog_instruction
     */
    GLint BranchTarget;
 
-#if 01 /* XXX just use this for i965 driver for now! */
-   /**
-    * For TEX instructions in shaders, the sampler to use for the
-    * texture lookup.
-    */
-   GLint Sampler;
-#endif
-
    /** for debugging purposes */
    const char *Comment;
 
    /** Arbitrary data.  Used for OPCODE_PRINT and some drivers */
    void *Data;
 
+   /** for driver use (try to remove someday) */
+   GLint Aux;
+
    /* XXX obsolete - remove someday */
 #if FEATURE_MESA_program_debug
    GLshort StringPos;




More information about the mesa-commit mailing list