diff options
author | Paul Berry <[email protected]> | 2012-07-17 21:06:01 -0700 |
---|---|---|
committer | Paul Berry <[email protected]> | 2012-07-24 14:52:58 -0700 |
commit | 17eae9762cdd6cfa69a060001e26113dfc0d7c86 (patch) | |
tree | 15b68ccbbd892176b54f663947430507e31d8340 | |
parent | 4afee38a2f2f9d0aedc02f1d7ba9b780914fce27 (diff) |
i965/blorp: Parameterize manual_blend() by num_samples.
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.
Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r-- | 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 fbda7b063f4..ae60ae29e03 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp @@ -459,7 +459,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(); @@ -471,7 +471,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; @@ -659,7 +659,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 @@ -1120,11 +1120,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(); @@ -1164,7 +1161,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 */ |