i965/fs: Add builder emit method taking a variable number of source registers.
authorFrancisco Jerez <currojerez@riseup.net>
Tue, 14 Jul 2015 16:32:03 +0000 (19:32 +0300)
committerFrancisco Jerez <currojerez@riseup.net>
Wed, 29 Jul 2015 11:12:46 +0000 (14:12 +0300)
And start using it in fs_builder::LOAD_PAYLOAD().  This will be used
to emit logical send message opcodes which have an unusually large
number of arguments.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
src/mesa/drivers/dri/i965/brw_fs_builder.h

index c4ee9d4..eea1eae 100644 (file)
@@ -307,6 +307,17 @@ namespace brw {
       }
 
       /**
+       * Create and insert an instruction with a variable number of sources
+       * into the program.
+       */
+      instruction *
+      emit(enum opcode opcode, const dst_reg &dst, const src_reg srcs[],
+           unsigned n) const
+      {
+         return emit(instruction(opcode, dispatch_width(), dst, srcs, n));
+      }
+
+      /**
        * Insert a preallocated instruction into the program.
        */
       instruction *
@@ -518,9 +529,7 @@ namespace brw {
       LOAD_PAYLOAD(const dst_reg &dst, const src_reg *src,
                    unsigned sources, unsigned header_size) const
       {
-         instruction *inst = emit(instruction(SHADER_OPCODE_LOAD_PAYLOAD,
-                                              dispatch_width(), dst,
-                                              src, sources));
+         instruction *inst = emit(SHADER_OPCODE_LOAD_PAYLOAD, dst, src, sources);
          inst->header_size = header_size;
          inst->regs_written = header_size +
                               (sources - header_size) * (dispatch_width() / 8);