[Mesa-dev] [PATCH 11/20] i965/fs: Allow emit_uniformize() to broadcast a specific channel

Matt Turner mattst88 at gmail.com
Thu Jul 6 23:48:21 UTC 2017


This function will be used to implement read_invocation (by specifying a
specific channel) and read_first_invocation (by not specifying a
channel).
---
 src/intel/compiler/brw_fs_builder.h | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/intel/compiler/brw_fs_builder.h b/src/intel/compiler/brw_fs_builder.h
index 87394bc17b..144ee54916 100644
--- a/src/intel/compiler/brw_fs_builder.h
+++ b/src/intel/compiler/brw_fs_builder.h
@@ -393,7 +393,7 @@ namespace brw {
        * Copy any live channel from \p src to the first channel of the result.
        */
       src_reg
-      emit_uniformize(const src_reg &src) const
+      emit_uniformize(const src_reg &src, dst_reg chan_index = dst_reg()) const
       {
          /* FIXME: We use a vector chan_index and dst to allow constant and
           * copy propagration to move result all the way into the consuming
@@ -403,10 +403,13 @@ namespace brw {
           * should go back to scalar destinations here.
           */
          const fs_builder ubld = exec_all();
-         const dst_reg chan_index = vgrf(BRW_REGISTER_TYPE_UD);
          const dst_reg dst = vgrf(src.type);
 
-         ubld.emit(SHADER_OPCODE_FIND_LIVE_CHANNEL, chan_index);
+         if (chan_index.file == BAD_FILE) {
+            chan_index = vgrf(BRW_REGISTER_TYPE_UD);
+            ubld.emit(SHADER_OPCODE_FIND_LIVE_CHANNEL, chan_index);
+         }
+
          ubld.emit(SHADER_OPCODE_BROADCAST, dst, src, component(chan_index, 0));
 
          return src_reg(component(dst, 0));
-- 
2.13.0



More information about the mesa-dev mailing list