i915: Remove most of the code under gen >= 4 checks.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_fs_fp.cpp
index 9ca082a0fc9821426183aee3c1a23e0dab1fedb6..5f92955bc7b2b0515a5980fcfaa4d1d596df15db 100644 (file)
@@ -316,14 +316,10 @@ fs_visitor::emit_fragment_program_code()
       case OPCODE_LRP:
          for (int i = 0; i < 4; i++) {
             if (fpi->DstReg.WriteMask & (1 << i)) {
-               fs_reg neg_src0 = regoffset(src[0], i);
-               neg_src0.negate = !neg_src0.negate;
-               fs_reg temp = fs_reg(this, glsl_type::float_type);
-               fs_reg temp2 = fs_reg(this, glsl_type::float_type);
-               emit(ADD(temp, neg_src0, fs_reg(1.0f)));
-               emit(MUL(temp, temp, regoffset(src[2], i)));
-               emit(MUL(temp2, regoffset(src[0], i), regoffset(src[1], i)));
-               emit(ADD(regoffset(dst, i), temp, temp2));
+               fs_reg a = regoffset(src[0], i);
+               fs_reg y = regoffset(src[1], i);
+               fs_reg x = regoffset(src[2], i);
+               emit_lrp(regoffset(dst, i), x, y, a);
             }
          }
          break;
@@ -416,6 +412,7 @@ fs_visitor::emit_fragment_program_code()
          fs_reg dpdy;
          fs_reg coordinate = src[0];
          fs_reg shadow_c;
+         fs_reg sample_index;
 
          switch (fpi->Opcode) {
          case OPCODE_TEX:
@@ -504,9 +501,9 @@ fs_visitor::emit_fragment_program_code()
 
          fs_inst *inst;
          if (intel->gen >= 7) {
-            inst = emit_texture_gen7(ir, dst, coordinate, shadow_c, lod, dpdy);
+            inst = emit_texture_gen7(ir, dst, coordinate, shadow_c, lod, dpdy, sample_index);
          } else if (intel->gen >= 5) {
-            inst = emit_texture_gen5(ir, dst, coordinate, shadow_c, lod, dpdy);
+            inst = emit_texture_gen5(ir, dst, coordinate, shadow_c, lod, dpdy, sample_index);
          } else {
             inst = emit_texture_gen4(ir, dst, coordinate, shadow_c, lod, dpdy);
          }
@@ -602,33 +599,33 @@ fs_visitor::setup_fp_regs()
       }
    }
 
-   fp_input_regs = rzalloc_array(mem_ctx, fs_reg, FRAG_ATTRIB_MAX);
-   for (int i = 0; i < FRAG_ATTRIB_MAX; i++) {
+   fp_input_regs = rzalloc_array(mem_ctx, fs_reg, VARYING_SLOT_MAX);
+   for (int i = 0; i < VARYING_SLOT_MAX; i++) {
       if (fp->Base.InputsRead & BITFIELD64_BIT(i)) {
          /* Make up a dummy instruction to reuse code for emitting
           * interpolation.
           */
          ir_variable *ir = new(mem_ctx) ir_variable(glsl_type::vec4_type,
                                                     "fp_input",
-                                                    ir_var_in);
+                                                    ir_var_shader_in);
          ir->location = i;
 
          this->current_annotation = ralloc_asprintf(ctx, "interpolate input %d",
                                                     i);
 
          switch (i) {
-         case FRAG_ATTRIB_WPOS:
+         case VARYING_SLOT_POS:
             ir->pixel_center_integer = fp->PixelCenterInteger;
             ir->origin_upper_left = fp->OriginUpperLeft;
             fp_input_regs[i] = *emit_fragcoord_interpolation(ir);
             break;
-         case FRAG_ATTRIB_FACE:
+         case VARYING_SLOT_FACE:
             fp_input_regs[i] = *emit_frontfacing_interpolation(ir);
             break;
          default:
             fp_input_regs[i] = *emit_general_interpolation(ir);
 
-            if (i == FRAG_ATTRIB_FOGC) {
+            if (i == VARYING_SLOT_FOGC) {
                emit(MOV(regoffset(fp_input_regs[i], 1), fs_reg(0.0f)));
                emit(MOV(regoffset(fp_input_regs[i], 2), fs_reg(0.0f)));
                emit(MOV(regoffset(fp_input_regs[i], 3), fs_reg(1.0f)));