[Mesa-dev] [v2 19/23] i965/blorp: wrap brw_IF/ELSE/ENDIF() into eu-emitter

Topi Pohjolainen topi.pohjolainen at intel.com
Wed Jan 22 09:17:11 PST 2014


v2 (Paul): renamed emit_if() to emit_cmp_if()

Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
Reviewed-by: Paul Berry <stereotype441 at gmail.com>
---
 src/mesa/drivers/dri/i965/brw_blorp_blit.cpp  | 14 +++++---------
 src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h | 18 ++++++++++++++++++
 2 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index aae0704..6454d2a 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -1548,9 +1548,7 @@ brw_blorp_blit_program::manual_blend_average(unsigned num_samples)
           * Since we have already sampled from sample 0, all we need to do is
           * skip the remaining fetches and averaging if MCS is zero.
           */
-         brw_CMP(&func, vec16(brw_null_reg()), BRW_CONDITIONAL_NZ,
-                 mcs_data, brw_imm_ud(0));
-         brw_IF(&func, BRW_EXECUTE_16);
+         emit_cmp_if(BRW_CONDITIONAL_NZ, mcs_data, brw_imm_ud(0));
       }
 
       /* Do count_trailing_one_bits(i) times */
@@ -1583,7 +1581,7 @@ brw_blorp_blit_program::manual_blend_average(unsigned num_samples)
    }
 
    if (key->tex_layout == INTEL_MSAA_LAYOUT_CMS)
-      brw_ENDIF(&func);
+      emit_endif();
 }
 
 void
@@ -1673,23 +1671,21 @@ brw_blorp_blit_program::manual_blend_bilinear(unsigned num_samples)
 
       if (num_samples == 8) {
          /* Map the sample index to a sample number */
-         brw_CMP(&func, vec16(brw_null_reg()), BRW_CONDITIONAL_L,
-                 S, brw_imm_d(4));
-         brw_IF(&func, BRW_EXECUTE_16);
+         emit_cmp_if(BRW_CONDITIONAL_L, S, brw_imm_d(4));
          {
             emit_mov(vec16(t2), brw_imm_d(5));
             emit_if_eq_mov(S, 1, vec16(t2), 2);
             emit_if_eq_mov(S, 2, vec16(t2), 4);
             emit_if_eq_mov(S, 3, vec16(t2), 6);
          }
-         brw_ELSE(&func);
+         emit_else();
          {
             emit_mov(vec16(t2), brw_imm_d(0));
             emit_if_eq_mov(S, 5, vec16(t2), 3);
             emit_if_eq_mov(S, 6, vec16(t2), 7);
             emit_if_eq_mov(S, 7, vec16(t2), 1);
          }
-         brw_ENDIF(&func);
+         emit_endif();
          emit_mov(vec16(S), t2);
       }
       texel_fetch(texture_data[i]);
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h
index 07c96b0..736f5b0 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h
@@ -149,6 +149,24 @@ protected:
       brw_RNDD(&func, dst, src);
    }
 
+   inline void emit_cmp_if(int op,
+                           const struct brw_reg &x,
+                           const struct brw_reg &y)
+   {
+      brw_CMP(&func, vec16(brw_null_reg()), op, x, y);
+      brw_IF(&func, BRW_EXECUTE_16);
+   }
+
+   inline void emit_else(void)
+   {
+      brw_ELSE(&func);
+   }
+
+   inline void emit_endif(void)
+   {
+      brw_ENDIF(&func);
+   }
+
    void *mem_ctx;
    struct brw_compile func;
 };
-- 
1.8.3.1



More information about the mesa-dev mailing list