i965/fs: Add support for translating ir_triop_fma into MAD.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_vec4_visitor.cpp
index fa32e4a6848dea037511c3c55daf2aa8e4075dd1..d0959b7333fe9e2fb9bd6d554b51f4bdf78d6f28 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include "brw_vec4.h"
+#include "brw_vs.h"
 #include "glsl/ir_uniform.h"
 extern "C" {
 #include "main/context.h"
@@ -662,40 +663,14 @@ vec4_visitor::setup_uniform_clipplane_values()
 {
    gl_clip_plane *clip_planes = brw_select_clip_planes(ctx);
 
-   if (brw->gen < 6) {
-      /* Pre-Gen6, we compact clip planes.  For example, if the user
-       * enables just clip planes 0, 1, and 3, we will enable clip planes
-       * 0, 1, and 2 in the hardware, and we'll move clip plane 3 to clip
-       * plane 2.  This simplifies the implementation of the Gen6 clip
-       * thread.
-       */
-      int compacted_clipplane_index = 0;
-      for (int i = 0; i < MAX_CLIP_PLANES; ++i) {
-        if (!(key->userclip_planes_enabled_gen_4_5 & (1 << i)))
-           continue;
-
-        this->uniform_vector_size[this->uniforms] = 4;
-        this->userplane[compacted_clipplane_index] = dst_reg(UNIFORM, this->uniforms);
-        this->userplane[compacted_clipplane_index].type = BRW_REGISTER_TYPE_F;
-        for (int j = 0; j < 4; ++j) {
-           prog_data->param[this->uniforms * 4 + j] = &clip_planes[i][j];
-        }
-        ++compacted_clipplane_index;
-        ++this->uniforms;
-      }
-   } else {
-      /* In Gen6 and later, we don't compact clip planes, because this
-       * simplifies the implementation of gl_ClipDistance.
-       */
-      for (int i = 0; i < key->nr_userclip_plane_consts; ++i) {
-        this->uniform_vector_size[this->uniforms] = 4;
-        this->userplane[i] = dst_reg(UNIFORM, this->uniforms);
-        this->userplane[i].type = BRW_REGISTER_TYPE_F;
-        for (int j = 0; j < 4; ++j) {
-           prog_data->param[this->uniforms * 4 + j] = &clip_planes[i][j];
-        }
-        ++this->uniforms;
+   for (int i = 0; i < key->nr_userclip_plane_consts; ++i) {
+      this->uniform_vector_size[this->uniforms] = 4;
+      this->userplane[i] = dst_reg(UNIFORM, this->uniforms);
+      this->userplane[i].type = BRW_REGISTER_TYPE_F;
+      for (int j = 0; j < 4; ++j) {
+         prog_data->param[this->uniforms * 4 + j] = &clip_planes[i][j];
       }
+      ++this->uniforms;
    }
 }
 
@@ -1391,12 +1366,12 @@ vec4_visitor::visit(ir_expression *ir)
       break;
    case ir_unop_neg:
       op[0].negate = !op[0].negate;
-      this->result = op[0];
+      emit(MOV(result_dst, op[0]));
       break;
    case ir_unop_abs:
       op[0].abs = true;
       op[0].negate = false;
-      this->result = op[0];
+      emit(MOV(result_dst, op[0]));
       break;
 
    case ir_unop_sign:
@@ -2813,7 +2788,8 @@ vec4_vs_visitor::emit_urb_write_opcode(bool complete)
    }
 
    vec4_instruction *inst = emit(VS_OPCODE_URB_WRITE);
-   inst->eot = complete;
+   inst->urb_write_flags = complete ?
+      BRW_URB_WRITE_EOT_COMPLETE : BRW_URB_WRITE_NO_FLAGS;
 
    return inst;
 }