[Mesa-dev] [PATCH 1/8] i965/blorp: Parameterize manual_blend() by num_samples.

Paul Berry stereotype441 at gmail.com
Wed Jul 18 09:20:59 PDT 2012


This patch adds a num_samples argument to the blorp function
manual_blend(), allowing it to be told how many samples need to be
blended together.  Previously it assumed 4x MSAA, since that was all
we supported.

We also bump up LOG2_MAX_BLEND_SAMPLES from 2 to 3, so that
manual_blend() will be able to handle 8x MSAA.
---
 src/mesa/drivers/dri/i965/brw_blorp_blit.cpp |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index 9481422..f750d42 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -458,7 +458,7 @@ private:
    void kill_if_outside_dst_rect();
    void translate_dst_to_src();
    void single_to_blend();
-   void manual_blend();
+   void manual_blend(unsigned num_samples);
    void sample(struct brw_reg dst);
    void texel_fetch(struct brw_reg dst);
    void mcs_fetch();
@@ -470,7 +470,7 @@ private:
    /**
     * Base-2 logarithm of the maximum number of samples that can be blended.
     */
-   static const unsigned LOG2_MAX_BLEND_SAMPLES = 2;
+   static const unsigned LOG2_MAX_BLEND_SAMPLES = 3;
 
    void *mem_ctx;
    struct brw_context *brw;
@@ -658,7 +658,7 @@ brw_blorp_blit_program::compile(struct brw_context *brw,
          sample(texture_data[0]);
       } else {
          /* Gen7+ hardware doesn't automaticaly blend. */
-         manual_blend();
+         manual_blend(key->src_samples);
       }
    } else {
       /* We aren't blending, which means we just want to fetch a single sample
@@ -1119,11 +1119,8 @@ inline int count_trailing_one_bits(unsigned value)
 
 
 void
-brw_blorp_blit_program::manual_blend()
+brw_blorp_blit_program::manual_blend(unsigned num_samples)
 {
-   /* TODO: support num_samples != 4 */
-   const int num_samples = 4;
-
    if (key->tex_layout == INTEL_MSAA_LAYOUT_CMS)
       mcs_fetch();
 
@@ -1163,7 +1160,7 @@ brw_blorp_blit_program::manual_blend()
    brw_op2_ptr combine_op =
       key->texture_data_type == BRW_REGISTER_TYPE_F ? brw_ADD : brw_AVG;
    unsigned stack_depth = 0;
-   for (int i = 0; i < num_samples; ++i) {
+   for (unsigned i = 0; i < num_samples; ++i) {
       assert(stack_depth == _mesa_bitcount(i)); /* Loop invariant */
 
       /* Push sample i onto the stack */
-- 
1.7.7.6



More information about the mesa-dev mailing list