i965/fs: introduce blorp specific rt-write for fs_generator
authorTopi Pohjolainen <topi.pohjolainen@intel.com>
Tue, 17 Dec 2013 12:00:50 +0000 (14:00 +0200)
committerTopi Pohjolainen <topi.pohjolainen@intel.com>
Thu, 23 Jan 2014 06:46:57 +0000 (08:46 +0200)
The compiler for blorp programs likes to emit instructions for
the message construction itself meaning that the generator needs
to skip any such when blorp programs are translated for the hw.
In addition, the binding table control is special for blorp
programs and the generator does not need to update the binding
tables associated with the compiler bookkeeping (this in fact
gets thrown away as the blorp compiler sets the program data
in its own way).

v2 (Paul): do not hardcode the binding table index but use
           fs_inst::target instead.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
src/mesa/drivers/dri/i965/brw_defines.h
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 7beda72bab05fd1f126b579874f757cde0469e3a..7f4cd10e59382ebfd3d42847e510fd857fa2eaca 100644 (file)
@@ -753,6 +753,7 @@ enum opcode {
     * instructions.
     */
    FS_OPCODE_FB_WRITE = 128,
+   FS_OPCODE_BLORP_FB_WRITE,
    SHADER_OPCODE_RCP,
    SHADER_OPCODE_RSQ,
    SHADER_OPCODE_SQRT,
index 126e8cec0ddb57df729fad96a423599238faffdb..9bc698297988206352319299c6fd402e43085fce 100644 (file)
@@ -523,6 +523,7 @@ public:
 private:
    void generate_code(exec_list *instructions, FILE *dump_file);
    void generate_fb_write(fs_inst *inst);
+   void generate_blorp_fb_write(fs_inst *inst);
    void generate_pixel_xy(struct brw_reg dst, bool is_x);
    void generate_linterp(fs_inst *inst, struct brw_reg dst,
                         struct brw_reg *src);
index 17e66dda87767b4ca6ac443af7c790057c88845d..7f70b920da38fd864b48efbd00fc83b6c657757e 100644 (file)
@@ -190,6 +190,21 @@ fs_generator::generate_fb_write(fs_inst *inst)
    mark_surface_used(surf_index);
 }
 
+void
+fs_generator::generate_blorp_fb_write(fs_inst *inst)
+{
+   brw_fb_WRITE(p,
+                16 /* dispatch_width */,
+                inst->base_mrf,
+                brw_reg_from_fs_reg(&inst->src[0]),
+                BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE,
+                inst->target,
+                inst->mlen,
+                0,
+                true,
+                inst->header_present);
+}
+
 /* Computes the integer pixel x,y values from the origin.
  *
  * This is the basis of gl_FragCoord computation, but is also used
@@ -1726,6 +1741,10 @@ fs_generator::generate_code(exec_list *instructions, FILE *dump_file)
         generate_fb_write(inst);
         break;
 
+      case FS_OPCODE_BLORP_FB_WRITE:
+        generate_blorp_fb_write(inst);
+        break;
+
       case FS_OPCODE_MOV_DISPATCH_TO_FLAGS:
          generate_mov_dispatch_to_flags(inst);
          break;
index b38032ec70fbf3b9c4f0e4d1abaced4b79b9894c..45bf73091b39941fd4280950117836d70e5ad4c7 100644 (file)
@@ -406,6 +406,8 @@ brw_instruction_name(enum opcode op)
    switch (op) {
    case FS_OPCODE_FB_WRITE:
       return "fb_write";
+   case FS_OPCODE_BLORP_FB_WRITE:
+      return "blorp_fb_write";
 
    case SHADER_OPCODE_RCP:
       return "rcp";