[Mesa-dev] [PATCH v3 (part2) 25/56] i965/fs: Do not include the header with a pixel mask in untyped read messages

Iago Toral Quiroga itoral at igalia.com
Tue Jul 14 00:46:27 PDT 2015


We need our reads to provide well-defined results for all enabled
channels even for helper invocations, which means that we should not
use a pixel mask with them.
---
 src/mesa/drivers/dri/i965/brw_eu_emit.c      |  4 ++--
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 35 ++++------------------------
 2 files changed, 7 insertions(+), 32 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index 4d39762..448bb49 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -2886,11 +2886,11 @@ brw_untyped_surface_read(struct brw_codegen *p,
    const unsigned sfid = (devinfo->gen >= 8 || devinfo->is_haswell ?
                           HSW_SFID_DATAPORT_DATA_CACHE_1 :
                           GEN7_SFID_DATAPORT_DATA_CACHE);
-   const bool align1 = (brw_inst_access_mode(devinfo, p->current) == BRW_ALIGN_1);
+
    struct brw_inst *insn = brw_send_indirect_surface_message(
       p, sfid, dst, payload, surface, msg_length,
       brw_surface_payload_size(p, num_channels, true, true),
-      align1);
+      false);
 
    brw_set_dp_untyped_surface_read_message(
       p, insn, num_channels);
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 94d6a58..cf35556 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -1185,41 +1185,16 @@ fs_visitor::emit_untyped_surface_read(unsigned surf_index, fs_reg dst,
 {
    int reg_width = dispatch_width / 8;
 
-   fs_reg *sources = ralloc_array(mem_ctx, fs_reg, 2);
-
-   sources[0] = fs_reg(GRF, alloc.allocate(1), BRW_REGISTER_TYPE_UD);
-   /* Initialize the sample mask in the message header. */
-   bld.exec_all()
-      .MOV(sources[0], fs_reg(0u));
-
-   if (stage == MESA_SHADER_FRAGMENT) {
-      if (((brw_wm_prog_data*)this->prog_data)->uses_kill) {
-         bld.exec_all()
-            .MOV(component(sources[0], 7), brw_flag_reg(0, 1));
-      } else {
-         bld.exec_all()
-            .MOV(component(sources[0], 7),
-                 retype(brw_vec1_grf(1, 7), BRW_REGISTER_TYPE_UD));
-      }
-   } else {
-      /* The execution mask is part of the side-band information sent together with
-       * the message payload to the data port. It's implicitly ANDed with the sample
-       * mask sent in the header to compute the actual set of channels that execute
-       * the atomic operation.
-       */
-      assert(stage == MESA_SHADER_VERTEX || stage == MESA_SHADER_COMPUTE);
-      bld.exec_all()
-         .MOV(component(sources[0], 7), fs_reg(0xffffu));
-   }
+   fs_reg *sources = ralloc_array(mem_ctx, fs_reg, 1);
 
    /* Set the surface read offset. */
-   sources[1] = vgrf(glsl_type::uint_type);
-   bld.MOV(sources[1], offset);
+   sources[0] = vgrf(glsl_type::uint_type);
+   bld.MOV(sources[0], offset);
 
-   int mlen = 1 + reg_width;
+   int mlen = reg_width;
    fs_reg src_payload = fs_reg(GRF, alloc.allocate(mlen),
                                BRW_REGISTER_TYPE_UD);
-   fs_inst *inst = bld.LOAD_PAYLOAD(src_payload, sources, 2, 1);
+   fs_inst *inst = bld.LOAD_PAYLOAD(src_payload, sources, 1, 0);
 
    /* Emit the instruction. */
    inst = bld.emit(SHADER_OPCODE_UNTYPED_SURFACE_READ, dst, src_payload,
-- 
1.9.1



More information about the mesa-dev mailing list