i965/fs: Add SHADER_OPCODE_LOAD_PAYLOAD.
authorMatt Turner <mattst88@gmail.com>
Wed, 28 May 2014 01:47:40 +0000 (18:47 -0700)
committerMatt Turner <mattst88@gmail.com>
Tue, 17 Jun 2014 16:38:05 +0000 (09:38 -0700)
Will be used to simplify the handling of large virtual GRFs in SSA form.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/brw_defines.h
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_fs_generator.cpp
src/mesa/drivers/dri/i965/brw_shader.cpp

index 3afd399ab1d1e8190a3d25b3f3057478464cd2ee..a962c7b7787429d17d313dc8e4fc6faa10028d63 100644 (file)
@@ -798,6 +798,20 @@ enum opcode {
    SHADER_OPCODE_TG4,
    SHADER_OPCODE_TG4_OFFSET,
 
+   /**
+    * Combines multiple sources of size 1 into a larger virtual GRF.
+    * For example, parameters for a send-from-GRF message.  Or, updating
+    * channels of a size 4 VGRF used to store vec4s such as texturing results.
+    *
+    * This will be lowered into MOVs from each source to consecutive reg_offsets
+    * of the destination VGRF.
+    *
+    * src[0] may be BAD_FILE.  If so, the lowering pass skips emitting the MOV,
+    * but still reserves the first channel of the destination VGRF.  This can be
+    * used to reserve space for, say, a message header set up by the generators.
+    */
+   SHADER_OPCODE_LOAD_PAYLOAD,
+
    SHADER_OPCODE_SHADER_TIME_ADD,
 
    SHADER_OPCODE_UNTYPED_ATOMIC,
index be461ac20c1b54a207f76849f8337d7487005c13..fa00c11cfb40d0c5ddca56f77cfc4ec3c4bbe9f6 100644 (file)
@@ -241,6 +241,16 @@ fs_visitor::CMP(fs_reg dst, fs_reg src0, fs_reg src1, uint32_t condition)
    return inst;
 }
 
+fs_inst *
+fs_visitor::LOAD_PAYLOAD(const fs_reg &dst, fs_reg *src, int sources)
+{
+   fs_inst *inst = new(mem_ctx) fs_inst(SHADER_OPCODE_LOAD_PAYLOAD, dst, src,
+                                        sources);
+   inst->regs_written = sources;
+
+   return inst;
+}
+
 exec_list
 fs_visitor::VARYING_PULL_CONSTANT_LOAD(const fs_reg &dst,
                                        const fs_reg &surf_index,
index f9e0daff17560cedcc392b5e202c40260f9ab603..4ce5fa319e17fbb7f31e2a0c7c1c181eb617a0c8 100644 (file)
@@ -338,6 +338,8 @@ public:
                                           fs_inst *end,
                                           const fs_reg &reg);
 
+   fs_inst *LOAD_PAYLOAD(const fs_reg &dst, fs_reg *src, int sources);
+
    exec_list VARYING_PULL_CONSTANT_LOAD(const fs_reg &dst,
                                         const fs_reg &surf_index,
                                         const fs_reg &varying_offset,
index 5e1174c72ef9621ecda7095cf980931213660707..e8daf347ed25b5f846cc23d56270d87b923297e0 100644 (file)
@@ -1749,6 +1749,10 @@ fs_generator::generate_code(exec_list *instructions)
            _mesa_problem(ctx, "Unsupported opcode %d in FS", inst->opcode);
         }
         abort();
+
+      case SHADER_OPCODE_LOAD_PAYLOAD:
+         assert(!"Should be lowered by lower_load_payload()");
+         break;
       }
 
       if (inst->conditional_mod) {
index 687356bcd042f9c7992074ec31f02f84433651a5..103c70b8cd55c0724c0e80d6a7125b4f06e7910b 100644 (file)
@@ -454,6 +454,9 @@ brw_instruction_name(enum opcode op)
    case SHADER_OPCODE_SHADER_TIME_ADD:
       return "shader_time_add";
 
+   case SHADER_OPCODE_LOAD_PAYLOAD:
+      return "load_payload";
+
    case SHADER_OPCODE_GEN4_SCRATCH_READ:
       return "gen4_scratch_read";
    case SHADER_OPCODE_GEN4_SCRATCH_WRITE: