i965/fs: always pass the bitsize to brw_type_for_nir_type()
authorConnor Abbott <connor.w.abbott@intel.com>
Wed, 29 Jul 2015 16:11:03 +0000 (09:11 -0700)
committerSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Tue, 10 May 2016 09:25:05 +0000 (11:25 +0200)
v2 (Sam):
- Add bitsize to brw_type_for_nir_type() in optimize_extract_to_float()

v3 (Sam):
- Fix line width (Topi).

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

index f8150c8e99e79bfb364af5a44f8f7d4f1bee6b51..60335c377efccdb484d2e45ecf4f1844e6e770a9 100644 (file)
@@ -535,7 +535,9 @@ fs_visitor::optimize_extract_to_float(nir_alu_instr *instr,
    }
 
    fs_reg op0 = get_nir_src(src0->src[0].src);
-   op0.type = brw_type_for_nir_type(nir_op_infos[src0->op].input_types[0]);
+   op0.type = brw_type_for_nir_type(
+      (nir_alu_type)(nir_op_infos[src0->op].input_types[0] |
+                     nir_src_bit_size(src0->src[0].src)));
    op0 = offset(op0, bld, src0->src[0].swizzle[0]);
 
    set_saturate(instr->dest.saturate,
@@ -628,12 +630,16 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)
    fs_inst *inst;
 
    fs_reg result = get_nir_dest(instr->dest.dest);
-   result.type = brw_type_for_nir_type(nir_op_infos[instr->op].output_type);
+   result.type = brw_type_for_nir_type(
+      (nir_alu_type)(nir_op_infos[instr->op].output_type |
+                     nir_dest_bit_size(instr->dest.dest)));
 
    fs_reg op[4];
    for (unsigned i = 0; i < nir_op_infos[instr->op].num_inputs; i++) {
       op[i] = get_nir_src(instr->src[i].src);
-      op[i].type = brw_type_for_nir_type(nir_op_infos[instr->op].input_types[i]);
+      op[i].type = brw_type_for_nir_type(
+         (nir_alu_type)(nir_op_infos[instr->op].input_types[i] |
+                        nir_src_bit_size(instr->src[i].src)));
       op[i].abs = instr->src[i].abs;
       op[i].negate = instr->src[i].negate;
    }