[Mesa-dev] [PATCH 07/18] i965/cs: Support CS_OPCODE_CS_TERMINATE

Jordan Justen jordan.l.justen at intel.com
Sat Mar 14 21:54:17 PDT 2015


Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 src/mesa/drivers/dri/i965/brw_defines.h      |  5 +++++
 src/mesa/drivers/dri/i965/brw_fs.h           |  1 +
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 11 +++++++++++
 src/mesa/drivers/dri/i965/brw_shader.cpp     |  2 ++
 4 files changed, 19 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h
index da6ed5b..9c7aafa 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -1102,6 +1102,11 @@ enum opcode {
     *   and number of SO primitives needed.
     */
    GS_OPCODE_FF_SYNC_SET_PRIMITIVES,
+
+   /**
+    * Terminate the compute shader.
+    */
+   CS_OPCODE_CS_TERMINATE,
 };
 
 enum brw_urb_write_flags {
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 7716529..faf7893 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -378,6 +378,7 @@ public:
                                  bool use_2nd_half = false);
    void emit_fb_writes();
    void emit_urb_writes();
+   void emit_cs_terminate();
 
    void emit_shader_time_begin();
    void emit_shader_time_end();
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 5d4b166..88df0a2 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -3962,6 +3962,17 @@ fs_visitor::resolve_ud_negate(fs_reg *reg)
  * If we need a proper boolean value, we have to fix it up to be 0 or ~0.
  */
 void
+fs_visitor::emit_cs_terminate()
+{
+   int base_mrf = 1;
+   fs_inst *inst = emit(CS_OPCODE_CS_TERMINATE);
+   inst->base_mrf = base_mrf;
+   inst->mlen = 0;
+   inst->eot = true;
+   inst->header_present = false;
+}
+
+void
 fs_visitor::resolve_bool_comparison(ir_rvalue *rvalue, fs_reg *reg)
 {
    assert(brw->gen <= 5);
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index ff0ef4b..499bd94 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -572,6 +572,8 @@ brw_instruction_name(enum opcode op)
       return "gs_svb_set_dst_index";
    case GS_OPCODE_FF_SYNC_SET_PRIMITIVES:
       return "gs_ff_sync_set_primitives";
+   case CS_OPCODE_CS_TERMINATE:
+      return "cs_terminate";
    }
 
    unreachable("not reached");
-- 
2.1.4



More information about the mesa-dev mailing list