[Mesa-dev] [RFC PATCH V3 07/10] i965/fs: add generator support for pixel interpolator query

Chris Forbes chrisf at ijw.co.nz
Sat Nov 23 14:02:34 PST 2013


Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
 src/mesa/drivers/dri/i965/brw_defines.h        |  1 +
 src/mesa/drivers/dri/i965/brw_fs.cpp           |  2 ++
 src/mesa/drivers/dri/i965/brw_fs.h             | 13 ++++++++++++-
 src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 19 +++++++++++++++++++
 4 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h
index 7d8f927..ef88abb 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -801,6 +801,7 @@ enum opcode {
    FS_OPCODE_UNPACK_HALF_2x16_SPLIT_X,
    FS_OPCODE_UNPACK_HALF_2x16_SPLIT_Y,
    FS_OPCODE_PLACEHOLDER_HALT,
+   FS_OPCODE_PIXEL_INTERPOLATOR_QUERY,
 
    VS_OPCODE_URB_WRITE,
    VS_OPCODE_PULL_CONSTANT_LOAD,
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 261f906..d770630 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -355,6 +355,7 @@ fs_inst::is_send_from_grf()
 {
    return (opcode == FS_OPCODE_VARYING_PULL_CONSTANT_LOAD_GEN7 ||
            opcode == SHADER_OPCODE_SHADER_TIME_ADD ||
+           opcode == FS_OPCODE_PIXEL_INTERPOLATOR_QUERY ||
            (opcode == FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD &&
             src[1].file == GRF) ||
            (is_tex() && src[0].file == GRF));
@@ -783,6 +784,7 @@ fs_visitor::implied_mrf_writes(fs_inst *inst)
       return 2;
    case SHADER_OPCODE_UNTYPED_ATOMIC:
    case SHADER_OPCODE_UNTYPED_SURFACE_READ:
+      case FS_OPCODE_PIXEL_INTERPOLATOR_QUERY:
       return 0;
    default:
       assert(!"not reached");
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 7991b87..c45faea 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -167,7 +167,14 @@ public:
    int mlen; /**< SEND message length */
    int regs_written; /**< Number of vgrfs written by a SEND message, or 1 */
    int base_mrf; /**< First MRF in the SEND message, if mlen is nonzero. */
-   uint32_t texture_offset; /**< Texture offset bitfield */
+   union {
+      uint32_t texture_offset; /**< Texture offset bitfield */
+      struct {
+         uint32_t pi_noperspective: 1;
+         uint32_t pi_msg_type: 3;
+         uint32_t pi_msg_data: 7;
+      };
+   };
    int sampler;
    int target; /**< MRT target. */
    bool eot;
@@ -557,6 +564,10 @@ private:
                                                  struct brw_reg offset);
    void generate_mov_dispatch_to_flags(fs_inst *inst);
 
+   void generate_pixel_interpolator_query(fs_inst *inst,
+                                          struct brw_reg dst,
+                                          struct brw_reg src);
+
    void generate_set_omask(fs_inst *inst,
                            struct brw_reg dst,
                            struct brw_reg sample_mask);
diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index 6626a8c..49ca946 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -973,6 +973,21 @@ fs_generator::generate_mov_dispatch_to_flags(fs_inst *inst)
    brw_pop_insn_state(p);
 }
 
+void
+fs_generator::generate_pixel_interpolator_query(fs_inst *inst,
+                                                struct brw_reg dst,
+                                                struct brw_reg src)
+{
+   brw_pixel_interpolator_query(p,
+         retype(dst, BRW_REGISTER_TYPE_UW),
+         src,
+         inst->pi_noperspective,
+         inst->pi_msg_type,
+         inst->pi_msg_data,
+         inst->mlen,
+         inst->regs_written);
+}
+
 
 static uint32_t brw_file_from_reg(fs_reg *reg)
 {
@@ -1749,6 +1764,10 @@ fs_generator::generate_code(exec_list *instructions)
          patch_discard_jumps_to_fb_writes();
          break;
 
+      case FS_OPCODE_PIXEL_INTERPOLATOR_QUERY:
+         generate_pixel_interpolator_query(inst, dst, src[0]);
+         break;
+
       default:
 	 if (inst->opcode < (int) ARRAY_SIZE(opcode_descs)) {
 	    _mesa_problem(ctx, "Unsupported opcode `%s' in FS",
-- 
1.8.4.2



More information about the mesa-dev mailing list