Mesa (master): i965/cs: Initialize gl_LocalInvocationID from payload

Jordan Justen jljusten at kemper.freedesktop.org
Sun Sep 13 17:17:36 UTC 2015


Module: Mesa
Branch: master
Commit: 43624361df1d5647665db793a38e229d89dfb851
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=43624361df1d5647665db793a38e229d89dfb851

Author: Jordan Justen <jordan.l.justen at intel.com>
Date:   Fri Nov 21 19:14:41 2014 -0800

i965/cs: Initialize gl_LocalInvocationID from payload

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>

---

 src/mesa/drivers/dri/i965/brw_cs.cpp |   25 +++++++++++++++++++++++--
 src/mesa/drivers/dri/i965/brw_fs.h   |    1 +
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_cs.cpp b/src/mesa/drivers/dri/i965/brw_cs.cpp
index d273f99..9ee5ae5 100644
--- a/src/mesa/drivers/dri/i965/brw_cs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_cs.cpp
@@ -473,8 +473,9 @@ const struct brw_tracked_state brw_cs_state = {
  * Therefore, for SIMD8, we use 3 full registers, and for SIMD16 we use 6
  * registers worth of push constant space.
  *
- * Note: Any updates to brw_cs_prog_local_id_payload_dwords or
- * fill_local_id_payload need to coordinated.
+ * Note: Any updates to brw_cs_prog_local_id_payload_dwords,
+ * fill_local_id_payload or fs_visitor::emit_cs_local_invocation_id_setup need
+ * to coordinated.
  *
  * FINISHME: There are a few easy optimizations to consider.
  *
@@ -522,6 +523,26 @@ fill_local_id_payload(const struct brw_cs_prog_data *cs_prog_data,
 }
 
 
+fs_reg *
+fs_visitor::emit_cs_local_invocation_id_setup()
+{
+   assert(stage == MESA_SHADER_COMPUTE);
+
+   fs_reg *reg = new(this->mem_ctx) fs_reg(vgrf(glsl_type::uvec3_type));
+
+   struct brw_reg src =
+      brw_vec8_grf(payload.local_invocation_id_reg, 0);
+   src = retype(src, BRW_REGISTER_TYPE_UD);
+   bld.MOV(*reg, src);
+   src.nr += dispatch_width / 8;
+   bld.MOV(offset(*reg, bld, 1), src);
+   src.nr += dispatch_width / 8;
+   bld.MOV(offset(*reg, bld, 2), src);
+
+   return reg;
+}
+
+
 /**
  * Creates a region containing the push constants for the CS on gen7+.
  *
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index c584cc7..6bfc290 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -275,6 +275,7 @@ public:
    void emit_fb_writes();
    void emit_urb_writes();
    void emit_cs_terminate();
+   fs_reg *emit_cs_local_invocation_id_setup();
 
    void emit_barrier();
 




More information about the mesa-commit mailing list