[Mesa-dev] [PATCH 10/14] i965/fs: Add support for repclear without color setup

Topi Pohjolainen topi.pohjolainen at intel.com
Wed May 25 16:08:45 UTC 2016


Fast color clears and resolves ignore the payload.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/drivers/dri/i965/brw_compiler.h |  1 +
 src/mesa/drivers/dri/i965/brw_fs.cpp     | 11 ++++++-----
 src/mesa/drivers/dri/i965/brw_fs.h       |  2 +-
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_compiler.h b/src/mesa/drivers/dri/i965/brw_compiler.h
index 3c3b35a..1020288 100644
--- a/src/mesa/drivers/dri/i965/brw_compiler.h
+++ b/src/mesa/drivers/dri/i965/brw_compiler.h
@@ -130,6 +130,7 @@ enum PACKED gen6_gather_sampler_wa {
 enum {
    BRW_FS_COMPILER_OPTION_ALLOW_SPILLING = 1 << 0,
    BRW_FS_COMPILER_OPTION_REP_SEND       = 1 << 1,
+   BRW_FS_COMPILER_OPTION_IGNORE_COLOR   = 1 << 2,
 };
 
 /**
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 4d0c7aa..4ed4138 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2984,18 +2984,19 @@ fs_visitor::eliminate_find_live_channel()
  * instructions to FS_OPCODE_REP_FB_WRITE.
  */
 void
-fs_visitor::emit_repclear_shader()
+fs_visitor::emit_repclear_shader(int flags)
 {
    brw_wm_prog_key *key = (brw_wm_prog_key*) this->key;
    int base_mrf = 0;
    int color_mrf = base_mrf + 2;
    fs_inst *mov;
+   const bool ignore_color = flags & BRW_FS_COMPILER_OPTION_IGNORE_COLOR;
 
-   if (uniforms > 0) {
+   if (uniforms > 0 && !ignore_color) {
       mov = bld.exec_all().group(4, 0)
                .MOV(brw_message_reg(color_mrf),
                     fs_reg(UNIFORM, 0, BRW_REGISTER_TYPE_F));
-   } else {
+   } else if (!ignore_color) {
       struct brw_reg reg =
          brw_reg(BRW_GENERAL_REGISTER_FILE, 2, 3, 0, 0, BRW_REGISTER_TYPE_F,
                  BRW_VERTICAL_STRIDE_8, BRW_WIDTH_2, BRW_HORIZONTAL_STRIDE_4,
@@ -3032,7 +3033,7 @@ fs_visitor::emit_repclear_shader()
    assign_curb_setup();
 
    /* Now that we have the uniform assigned, go ahead and force it to a vec4. */
-   if (uniforms > 0) {
+   if (uniforms > 0 && !ignore_color) {
       assert(mov->src[0].file == FIXED_GRF);
       mov->src[0] = brw_vec4_grf(mov->src[0].nr, 0);
    }
@@ -5768,7 +5769,7 @@ fs_visitor::run_fs(int flags)
       emit_dummy_fs();
    } else if (do_rep_send) {
       assert(dispatch_width == 16);
-      emit_repclear_shader();
+      emit_repclear_shader(flags);
    } else {
       if (shader_time_index >= 0)
          emit_shader_time_begin();
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 67fd3f5..5088579 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -182,7 +182,7 @@ public:
    bool opt_combine_constants();
 
    void emit_dummy_fs();
-   void emit_repclear_shader();
+   void emit_repclear_shader(int flags);
    fs_reg *emit_fragcoord_interpolation();
    fs_inst *emit_linterp(const fs_reg &attr, const fs_reg &interp,
                          glsl_interp_qualifier interpolation_mode,
-- 
2.5.5



More information about the mesa-dev mailing list