i965/blorp: move emission of pixel kill into eu-emitter
authorTopi Pohjolainen <topi.pohjolainen@intel.com>
Mon, 2 Dec 2013 09:09:19 +0000 (11:09 +0200)
committerTopi Pohjolainen <topi.pohjolainen@intel.com>
Thu, 23 Jan 2014 06:44:52 +0000 (08:44 +0200)
The combination of four separate comparison operations and
and the masked "and" require special treatment when moving
to FS LIR.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp
src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h

index f9c355b372ac8ac58e77d62c76eb4db88e370fac..03fabd62f714be78cb09497f91a1077ff5db51fe 100644 (file)
@@ -640,7 +640,6 @@ private:
    void translate_tiling(bool old_tiled_w, bool new_tiled_w);
    void encode_msaa(unsigned num_samples, intel_msaa_layout layout);
    void decode_msaa(unsigned num_samples, intel_msaa_layout layout);
-   void kill_if_outside_dst_rect();
    void translate_dst_to_src();
    void clamp_tex_coords(struct brw_reg regX, struct brw_reg regY,
                          struct brw_reg clampX0, struct brw_reg clampY0,
@@ -833,7 +832,9 @@ brw_blorp_blit_program::compile(struct brw_context *brw,
     */
 
    if (key->use_kill)
-      kill_if_outside_dst_rect();
+      emit_kill_if_outside_rect(x_coords[xy_coord_index],
+                                y_coords[xy_coord_index],
+                                dst_x0, dst_x1, dst_y0, dst_y1);
 
    /* Next, apply a translation to obtain coordinates in the source image. */
    translate_dst_to_src();
@@ -1374,29 +1375,6 @@ brw_blorp_blit_program::decode_msaa(unsigned num_samples,
    }
 }
 
-/**
- * Emit code that kills pixels whose X and Y coordinates are outside the
- * boundary of the rectangle defined by the push constants (dst_x0, dst_y0,
- * dst_x1, dst_y1).
- */
-void
-brw_blorp_blit_program::kill_if_outside_dst_rect()
-{
-   struct brw_reg f0 = brw_flag_reg(0, 0);
-   struct brw_reg g1 = retype(brw_vec1_grf(1, 7), BRW_REGISTER_TYPE_UW);
-   struct brw_reg null32 = vec16(retype(brw_null_reg(), BRW_REGISTER_TYPE_UD));
-
-   brw_CMP(&func, null32, BRW_CONDITIONAL_GE, X, dst_x0);
-   brw_CMP(&func, null32, BRW_CONDITIONAL_GE, Y, dst_y0);
-   brw_CMP(&func, null32, BRW_CONDITIONAL_L, X, dst_x1);
-   brw_CMP(&func, null32, BRW_CONDITIONAL_L, Y, dst_y1);
-
-   brw_set_predicate_control(&func, BRW_PREDICATE_NONE);
-
-   struct brw_instruction *inst = brw_AND(&func, g1, f0, g1);
-   inst->header.mask_control = BRW_MASK_DISABLE;
-}
-
 /**
  * Emit code to translate from destination (X, Y) coordinates to source (X, Y)
  * coordinates.
index 8d723d640520ad733236c4d6fea7245a3ba4747b..161c6798a578048e0691e76699e3f2e25ea04bdf 100644 (file)
@@ -63,3 +63,31 @@ brw_blorp_eu_emitter::get_program(unsigned *program_size, FILE *dump_file)
 
    return brw_get_program(&func, program_size);
 }
+
+/**
+ * Emit code that kills pixels whose X and Y coordinates are outside the
+ * boundary of the rectangle defined by the push constants (dst_x0, dst_y0,
+ * dst_x1, dst_y1).
+ */
+void
+brw_blorp_eu_emitter::emit_kill_if_outside_rect(const struct brw_reg &x,
+                                                const struct brw_reg &y,
+                                                const struct brw_reg &dst_x0,
+                                                const struct brw_reg &dst_x1,
+                                                const struct brw_reg &dst_y0,
+                                                const struct brw_reg &dst_y1)
+{
+   struct brw_reg f0 = brw_flag_reg(0, 0);
+   struct brw_reg g1 = retype(brw_vec1_grf(1, 7), BRW_REGISTER_TYPE_UW);
+   struct brw_reg null32 = vec16(retype(brw_null_reg(), BRW_REGISTER_TYPE_UD));
+
+   brw_CMP(&func, null32, BRW_CONDITIONAL_GE, x, dst_x0);
+   brw_CMP(&func, null32, BRW_CONDITIONAL_GE, y, dst_y0);
+   brw_CMP(&func, null32, BRW_CONDITIONAL_L, x, dst_x1);
+   brw_CMP(&func, null32, BRW_CONDITIONAL_L, y, dst_y1);
+
+   brw_set_predicate_control(&func, BRW_PREDICATE_NONE);
+
+   struct brw_instruction *inst = brw_AND(&func, g1, f0, g1);
+   inst->header.mask_control = BRW_MASK_DISABLE;
+}
index 1bcb0d98bff27603dac97588744661bd0f9c8e04..3f74e0e9925a3ab05cc018c73241de9f678888f9 100644 (file)
@@ -35,6 +35,13 @@ protected:
 
    const unsigned *get_program(unsigned *program_size, FILE *dump_file);
 
+   void emit_kill_if_outside_rect(const struct brw_reg &x,
+                                  const struct brw_reg &y,
+                                  const struct brw_reg &dst_x0,
+                                  const struct brw_reg &dst_x1,
+                                  const struct brw_reg &dst_y0,
+                                  const struct brw_reg &dst_y1);
+
    void *mem_ctx;
    struct brw_compile func;
 };