i965/fs: Read all components of a SSBO field with one send
authorKristian Høgsberg Kristensen <krh@bitplanet.net>
Sat, 17 Oct 2015 04:58:14 +0000 (21:58 -0700)
committerKristian Høgsberg Kristensen <krh@bitplanet.net>
Fri, 23 Oct 2015 16:42:28 +0000 (09:42 -0700)
Instead of looping through single-component reads, read all components
in one go.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Kristian Høgsberg Kristensen <krh@bitplanet.net>
src/mesa/drivers/dri/i965/brw_fs_nir.cpp

index acb51c023ad8bff54af65c91982057ef2d84c590..5dc63c95a9522bc04254af45af132c92a6084c42 100644 (file)
@@ -1532,24 +1532,13 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
       }
 
       /* Read the vector */
-      for (int i = 0; i < instr->num_components; i++) {
-         fs_reg read_result = emit_untyped_read(bld, surf_index, offset_reg,
-                                                1 /* dims */, 1 /* size */,
-                                                BRW_PREDICATE_NONE);
-         read_result.type = dest.type;
-         bld.MOV(dest, read_result);
-         dest = offset(dest, bld, 1);
-
-         /* Vector components are stored contiguous in memory */
-         if (i < instr->num_components) {
-            if (!has_indirect) {
-               const_offset_bytes += 4;
-               bld.MOV(offset_reg, fs_reg(const_offset_bytes));
-            } else {
-               bld.ADD(offset_reg, offset_reg, brw_imm_ud(4));
-            }
-         }
-      }
+      fs_reg read_result = emit_untyped_read(bld, surf_index, offset_reg,
+                                             1 /* dims */,
+                                             instr->num_components,
+                                             BRW_PREDICATE_NONE);
+      read_result.type = dest.type;
+      for (int i = 0; i < instr->num_components; i++)
+         bld.MOV(offset(dest, bld, i), offset(read_result, bld, i));
 
       break;
    }