i965/gs: Add GS_OPCODE_SET_DWORD_2_IMMED.
authorPaul Berry <stereotype441@gmail.com>
Tue, 19 Feb 2013 15:31:16 +0000 (07:31 -0800)
committerPaul Berry <stereotype441@gmail.com>
Fri, 23 Aug 2013 18:03:31 +0000 (11:03 -0700)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_defines.h
src/mesa/drivers/dri/i965/brw_shader.cpp
src/mesa/drivers/dri/i965/brw_vec4.h
src/mesa/drivers/dri/i965/brw_vec4_emit.cpp

index 2e1285fec0adb60b3143891f1777e4dccb4c6f3f..832ff55a0c002dd90bc7e6316642e3545b4b538f 100644 (file)
@@ -843,6 +843,13 @@ enum opcode {
     * - src0.x is the vertex count.  The upper 16 bits will be ignored.
     */
    GS_OPCODE_SET_VERTEX_COUNT,
+
+   /**
+    * Set DWORD 2 of dst to the immediate value in src.  Used by geometry
+    * shaders to initialize DWORD 2 of R0, which needs to be 0 in order for
+    * scratch reads and writes to operate correctly.
+    */
+   GS_OPCODE_SET_DWORD_2_IMMED,
 };
 
 #define BRW_PREDICATE_NONE             0
index cec2d6082097c4b3acdd94acbf663a7db9bd3da9..e7dbdbe89207f4322967c17b7e3f73fe92aeaf2d 100644 (file)
@@ -505,6 +505,8 @@ brw_instruction_name(enum opcode op)
       return "set_write_offset";
    case GS_OPCODE_SET_VERTEX_COUNT:
       return "set_vertex_count";
+   case GS_OPCODE_SET_DWORD_2_IMMED:
+      return "set_dword_2_immed";
 
    default:
       /* Yes, this leaks.  It's in debug code, it should never occur, and if
index 730d6b728331259cc9a775fb9ad1710778b7a6d2..5d8f0bf31ae622a4dd21fc945ecab5557021a4f4 100644 (file)
@@ -635,6 +635,7 @@ private:
                                      struct brw_reg src1);
    void generate_gs_set_vertex_count(struct brw_reg dst,
                                      struct brw_reg src);
+   void generate_gs_set_dword_2_immed(struct brw_reg dst, struct brw_reg src);
    void generate_oword_dual_block_offsets(struct brw_reg m1,
                                          struct brw_reg index);
    void generate_scratch_write(vec4_instruction *inst,
index 11eeca144f54ceea957231c848eacccfd70ebd29..8d3696c1ccd1b0874c406d3d1e0286a142e44a2e 100644 (file)
@@ -501,6 +501,20 @@ vec4_generator::generate_gs_set_vertex_count(struct brw_reg dst,
    brw_pop_insn_state(p);
 }
 
+void
+vec4_generator::generate_gs_set_dword_2_immed(struct brw_reg dst,
+                                              struct brw_reg src)
+{
+   assert(src.file == BRW_IMMEDIATE_VALUE);
+
+   brw_push_insn_state(p);
+   brw_set_access_mode(p, BRW_ALIGN_1);
+   brw_set_mask_control(p, BRW_MASK_DISABLE);
+   brw_MOV(p, suboffset(vec1(dst), 2), src);
+   brw_set_access_mode(p, BRW_ALIGN_16);
+   brw_pop_insn_state(p);
+}
+
 void
 vec4_generator::generate_oword_dual_block_offsets(struct brw_reg m1,
                                                   struct brw_reg index)
@@ -985,6 +999,10 @@ vec4_generator::generate_vec4_instruction(vec4_instruction *instruction,
       generate_gs_set_vertex_count(dst, src[0]);
       break;
 
+   case GS_OPCODE_SET_DWORD_2_IMMED:
+      generate_gs_set_dword_2_immed(dst, src[0]);
+      break;
+
    case SHADER_OPCODE_SHADER_TIME_ADD:
       brw_shader_time_add(p, src[0], SURF_INDEX_VS_SHADER_TIME);
       mark_surface_used(SURF_INDEX_VS_SHADER_TIME);