Mesa (master): i965/fs: Track whether we' re doing dual source in a more obvious way.

Eric Anholt anholt at kemper.freedesktop.org
Tue Apr 8 08:24:36 UTC 2014


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

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Mar 25 16:46:12 2014 -0700

i965/fs: Track whether we're doing dual source in a more obvious way.

I'm going to be turning dual_src_output into an array in a moment.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/i965/brw_fs.cpp         |    4 ++--
 src/mesa/drivers/dri/i965/brw_fs.h           |    1 +
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp |    3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 9e1bfec..85a5463 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -3391,11 +3391,11 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c,
 
    const unsigned *assembly = NULL;
    if (brw->gen >= 8) {
-      gen8_fs_generator g(brw, c, prog, fp, v.dual_src_output.file != BAD_FILE);
+      gen8_fs_generator g(brw, c, prog, fp, v.do_dual_src);
       assembly = g.generate_assembly(&v.instructions, simd16_instructions,
                                      final_assembly_size);
    } else {
-      fs_generator g(brw, c, prog, fp, v.dual_src_output.file != BAD_FILE);
+      fs_generator g(brw, c, prog, fp, v.do_dual_src);
       assembly = g.generate_assembly(&v.instructions, simd16_instructions,
                                      final_assembly_size);
    }
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 4086693..3d21ee5 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -529,6 +529,7 @@ public:
    fs_reg outputs[BRW_MAX_DRAW_BUFFERS];
    unsigned output_components[BRW_MAX_DRAW_BUFFERS];
    fs_reg dual_src_output;
+   bool do_dual_src;
    int first_non_payload_grf;
    /** Either BRW_MAX_GRF or GEN7_MRF_HACK_START */
    int max_grf;
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index c89f4d6..63a0ae5 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -74,6 +74,7 @@ fs_visitor::visit(ir_variable *ir)
 	 assert(ir->data.location == FRAG_RESULT_DATA0);
 	 assert(ir->data.index == 1);
 	 this->dual_src_output = *reg;
+         this->do_dual_src = true;
       } else if (ir->data.location == FRAG_RESULT_COLOR) {
 	 /* Writing gl_FragColor outputs to all color regions. */
 	 for (unsigned int i = 0; i < MAX2(c->key.nr_color_regions, 1); i++) {
@@ -2730,7 +2731,6 @@ fs_visitor::emit_fb_writes()
    int base_mrf = 1;
    int nr = base_mrf;
    int reg_width = dispatch_width / 8;
-   bool do_dual_src = this->dual_src_output.file != BAD_FILE;
    bool src0_alpha_to_render_target = false;
 
    if (do_dual_src) {
@@ -2988,6 +2988,7 @@ fs_visitor::fs_visitor(struct brw_context *brw,
    this->force_uncompressed_stack = 0;
 
    this->spilled_any_registers = false;
+   this->do_dual_src = false;
 
    if (dispatch_width == 8)
       this->param_size = rzalloc_array(mem_ctx, int, stage_prog_data->nr_params);




More information about the mesa-commit mailing list