i965/fs: Lower 32x32 bit multiplication on BXT.
[mesa.git] / src / mesa / drivers / dri / i965 / gen6_gs_visitor.cpp
index 704a02f9c3b5001c5344fbda5ba900cedf14767c..68e443d38a5399ceb55b67805e9eb31efaf4110d 100644 (file)
@@ -35,6 +35,15 @@ const unsigned MAX_GS_INPUT_VERTICES = 6;
 
 namespace brw {
 
+void
+gen6_gs_visitor::assign_binding_table_offsets()
+{
+   /* In gen6 we reserve the first BRW_MAX_SOL_BINDINGS entries for transform
+    * feedback surfaces.
+    */
+   assign_common_binding_table_offsets(BRW_MAX_SOL_BINDINGS);
+}
+
 void
 gen6_gs_visitor::emit_prolog()
 {
@@ -138,7 +147,12 @@ gen6_gs_visitor::emit_prolog()
 }
 
 void
-gen6_gs_visitor::visit(ir_emit_vertex *)
+gen6_gs_visitor::visit(ir_emit_vertex *ir)
+{
+   gs_emit_vertex(ir->stream_id());
+}
+void
+gen6_gs_visitor::gs_emit_vertex(int stream_id)
 {
    this->current_annotation = "gen6 emit vertex";
    /* Honor max_vertex layout indication in geometry shader by ignoring any
@@ -214,6 +228,12 @@ gen6_gs_visitor::visit(ir_emit_vertex *)
 
 void
 gen6_gs_visitor::visit(ir_end_primitive *)
+{
+   gs_end_primitive();
+}
+
+void
+gen6_gs_visitor::gs_end_primitive()
 {
    this->current_annotation = "gen6 end primitive";
    /* Calling EndPrimitive() is optional for point output. In this case we set
@@ -245,7 +265,7 @@ gen6_gs_visitor::visit(ir_end_primitive *)
        * vertex.
        */
       src_reg offset(this, glsl_type::uint_type);
-      emit(ADD(dst_reg(offset), this->vertex_output_offset, brw_imm_d(-1)));
+      emit(ADD(dst_reg(offset), this->vertex_output_offset, src_reg(-1)));
 
       src_reg dst(this->vertex_output);
       dst.reladdr = ralloc(mem_ctx, src_reg);
@@ -375,7 +395,7 @@ gen6_gs_visitor::emit_thread_end()
                      dst_reg(this->temp), this->prim_count, this->svbi);
       } else {
          inst = emit(GS_OPCODE_FF_SYNC,
-                     dst_reg(this->temp), this->prim_count, brw_imm_ud(0u));
+                     dst_reg(this->temp), this->prim_count, src_reg(0u));
       }
       inst->base_mrf = base_mrf;
 
@@ -478,8 +498,8 @@ gen6_gs_visitor::emit_thread_end()
    if (c->prog_data.gen6_xfb_enabled) {
       /* When emitting EOT, set SONumPrimsWritten Increment Value. */
       src_reg data(this, glsl_type::uint_type);
-      emit(AND(dst_reg(data), this->sol_prim_written, brw_imm_ud(0xffffu)));
-      emit(SHL(dst_reg(data), data, brw_imm_ud(16u)));
+      emit(AND(dst_reg(data), this->sol_prim_written, src_reg(0xffffu)));
+      emit(SHL(dst_reg(data), data, src_reg(16u)));
       emit(GS_OPCODE_SET_DWORD_2, dst_reg(MRF, base_mrf), data);
    }
 
@@ -615,7 +635,7 @@ gen6_gs_visitor::xfb_write()
     * transform feedback is in interleaved or separate attribs mode.
     */
    src_reg sol_temp(this, glsl_type::uvec4_type);
-   emit(ADD(dst_reg(sol_temp), this->svbi, brw_imm_ud(num_verts)));
+   emit(ADD(dst_reg(sol_temp), this->svbi, src_reg(num_verts)));
 
    /* Compare SVBI calculated number with the maximum value, which is
     * in R1.4 (previously saved in this->max_svbi) for gen6.
@@ -623,7 +643,7 @@ gen6_gs_visitor::xfb_write()
    emit(CMP(dst_null_d(), sol_temp, this->max_svbi, BRW_CONDITIONAL_LE));
    emit(IF(BRW_PREDICATE_NORMAL));
    {
-      struct src_reg destination_indices_uw =
+      src_reg destination_indices_uw =
          retype(destination_indices, BRW_REGISTER_TYPE_UW);
 
       vec4_instruction *inst = emit(MOV(dst_reg(destination_indices_uw),
@@ -662,7 +682,7 @@ gen6_gs_visitor::xfb_program(unsigned vertex, unsigned num_verts)
     * (all vertices). Otherwise, avoid writing any vertices for it
     */
    emit(ADD(dst_reg(sol_temp), this->sol_prim_written, 1u));
-   emit(MUL(dst_reg(sol_temp), sol_temp, brw_imm_ud(num_verts)));
+   emit(MUL(dst_reg(sol_temp), sol_temp, src_reg(num_verts)));
    emit(ADD(dst_reg(sol_temp), sol_temp, this->svbi));
    emit(CMP(dst_null_d(), sol_temp, this->max_svbi, BRW_CONDITIONAL_LE));
    emit(IF(BRW_PREDICATE_NORMAL));
@@ -727,7 +747,7 @@ gen6_gs_visitor::xfb_program(unsigned vertex, unsigned num_verts)
              */
             emit(ADD(dst_reg(this->destination_indices),
                      this->destination_indices,
-                     brw_imm_ud(num_verts)));
+                     src_reg(num_verts)));
             emit(ADD(dst_reg(this->sol_prim_written),
                      this->sol_prim_written, 1u));
          }