i965/fs: don't pass ir_variable * to emit_frontfacing_interpolation()
authorConnor Abbott <connor.abbott@intel.com>
Tue, 5 Aug 2014 17:29:00 +0000 (10:29 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 1 Sep 2014 07:11:16 +0000 (00:11 -0700)
We were only using it to get at its type, which we already know because
it's a builtin variable.

v2 (Ken): Rebase on Matt's optimized gl_FrontFacing calculations.

Signed-off-by: Connor Abbott <connor.abbott@intel.com>
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_fp.cpp
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp

index e700ef6e63aa6bf41bfc1d45e6c96ed49346daec..410c441e2d1188a3015a6c44ec0a830e804619cc 100644 (file)
@@ -1185,9 +1185,9 @@ fs_visitor::emit_general_interpolation(ir_variable *ir)
 }
 
 fs_reg *
-fs_visitor::emit_frontfacing_interpolation(ir_variable *ir)
+fs_visitor::emit_frontfacing_interpolation()
 {
-   fs_reg *reg = new(this->mem_ctx) fs_reg(this, ir->type);
+   fs_reg *reg = new(this->mem_ctx) fs_reg(this, glsl_type::bool_type);
 
    if (brw->gen >= 6) {
       /* Bit 15 of g0.0 is 0 if the polygon is front facing. We want to create
@@ -1217,7 +1217,7 @@ fs_visitor::emit_frontfacing_interpolation(ir_variable *ir)
        * Instead, use ASR (which will give ~0/true or 0/false) followed by an
        * AND 1.
        */
-      fs_reg asr = fs_reg(this, ir->type);
+      fs_reg asr = fs_reg(this, glsl_type::bool_type);
       fs_reg g1_6 = fs_reg(retype(brw_vec1_grf(1, 6), BRW_REGISTER_TYPE_D));
       g1_6.negate = true;
 
index c2bc1f0e1302851944f5c921b19f384b0ea85e6a..f8f38e00bb26e88b8df77e1d8e589d5a3123102a 100644 (file)
@@ -365,7 +365,7 @@ public:
    fs_inst *emit_linterp(const fs_reg &attr, const fs_reg &interp,
                          glsl_interp_qualifier interpolation_mode,
                          bool is_centroid, bool is_sample);
-   fs_reg *emit_frontfacing_interpolation(ir_variable *ir);
+   fs_reg *emit_frontfacing_interpolation();
    fs_reg *emit_samplepos_setup(ir_variable *ir);
    fs_reg *emit_sampleid_setup(ir_variable *ir);
    fs_reg *emit_general_interpolation(ir_variable *ir);
index 98df29947ef47a07905c789f7cbb404cc284f3b5..c82bd9b76aceecb5e96e2e9a608acdfaf1c35828 100644 (file)
@@ -609,7 +609,7 @@ fs_visitor::setup_fp_regs()
             fp_input_regs[i] = *emit_fragcoord_interpolation(ir);
             break;
          case VARYING_SLOT_FACE:
-            fp_input_regs[i] = *emit_frontfacing_interpolation(ir);
+            fp_input_regs[i] = *emit_frontfacing_interpolation();
             break;
          default:
             fp_input_regs[i] = *emit_general_interpolation(ir);
index 24d6bcea476104da4b57510f505f303068c2b874..df65e5e8b1d273e6076be41c3dfd8477601fbe2e 100644 (file)
@@ -60,7 +60,7 @@ fs_visitor::visit(ir_variable *ir)
       if (!strcmp(ir->name, "gl_FragCoord")) {
         reg = emit_fragcoord_interpolation(ir);
       } else if (!strcmp(ir->name, "gl_FrontFacing")) {
-        reg = emit_frontfacing_interpolation(ir);
+        reg = emit_frontfacing_interpolation();
       } else {
         reg = emit_general_interpolation(ir);
       }