Mesa (master): i965: Add EU code for dword scattered reads ( constant buffer array indexing).

Eric Anholt anholt at kemper.freedesktop.org
Tue Oct 26 21:12:23 UTC 2010


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

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Oct 25 11:23:13 2010 -0700

i965: Add EU code for dword scattered reads (constant buffer array indexing).

---

 src/mesa/drivers/dri/i965/brw_eu.h      |    5 ++++
 src/mesa/drivers/dri/i965/brw_eu_emit.c |   40 +++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h
index 15c2f23..b4538e6 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.h
+++ b/src/mesa/drivers/dri/i965/brw_eu.h
@@ -914,6 +914,11 @@ void brw_oword_block_write_scratch(struct brw_compile *p,
 				   int num_regs,
 				   GLuint offset);
 
+void brw_dword_scattered_read(struct brw_compile *p,
+			      struct brw_reg dest,
+			      struct brw_reg mrf,
+			      uint32_t bind_table_index);
+
 void brw_dp_READ_4_vs( struct brw_compile *p,
                        struct brw_reg dest,
                        GLuint location,
diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index fe3a029..feb13e7 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -1566,6 +1566,46 @@ void brw_oword_block_read(struct brw_compile *p,
    brw_pop_insn_state(p);
 }
 
+/**
+ * Read a set of dwords from the data port Data Cache (const buffer).
+ *
+ * Location (in buffer) appears as UD offsets in the register after
+ * the provided mrf header reg.
+ */
+void brw_dword_scattered_read(struct brw_compile *p,
+			      struct brw_reg dest,
+			      struct brw_reg mrf,
+			      uint32_t bind_table_index)
+{
+   mrf = retype(mrf, BRW_REGISTER_TYPE_UD);
+
+   brw_push_insn_state(p);
+   brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+   brw_set_compression_control(p, BRW_COMPRESSION_NONE);
+   brw_set_mask_control(p, BRW_MASK_DISABLE);
+   brw_MOV(p, mrf, retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UD));
+   brw_pop_insn_state(p);
+
+   struct brw_instruction *insn = next_insn(p, BRW_OPCODE_SEND);
+   insn->header.destreg__conditionalmod = mrf.nr;
+
+   /* cast dest to a uword[8] vector */
+   dest = retype(vec8(dest), BRW_REGISTER_TYPE_UW);
+
+   brw_set_dest(insn, dest);
+   brw_set_src0(insn, brw_null_reg());
+
+   brw_set_dp_read_message(p->brw,
+			   insn,
+			   bind_table_index,
+			   BRW_DATAPORT_DWORD_SCATTERED_BLOCK_8DWORDS,
+			   BRW_DATAPORT_READ_MESSAGE_DWORD_SCATTERED_READ,
+			   0, /* source cache = data cache */
+			   2, /* msg_length */
+			   1, /* response_length */
+			   0); /* eot */
+}
+
 
 
 /**




More information about the mesa-commit mailing list