i965/fs: Track whether we're doing dual source in a more obvious way.
authorEric Anholt <eric@anholt.net>
Tue, 25 Mar 2014 23:46:12 +0000 (16:46 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 8 Apr 2014 07:59:48 +0000 (00:59 -0700)
I'm going to be turning dual_src_output into an array in a moment.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp

index 9e1bfecb04b4ebe4efcd829fc2febca24cac853d..85a5463e020cdebc6bf0df4ad58621613a36a018 100644 (file)
@@ -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);
    }
index 408669358b2b55f89b3d75bf08fcb42659374eaa..3d21ee52cf1c168d44323b33b2dc9b93c5df3905 100644 (file)
@@ -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;
index c89f4d6a05ddc21081b2b8407de047e4affc2799..63a0ae53d7b02543f1332291cedf6a6fc7d7229a 100644 (file)
@@ -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);