[Mesa-dev] [PATCH 3/3] i965/blorp: Use hardware for layered clears
Topi Pohjolainen
topi.pohjolainen at intel.com
Thu Apr 28 11:12:20 UTC 2016
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/mesa/drivers/dri/i965/brw_blorp_clear.cpp | 43 +++++++--------------------
1 file changed, 11 insertions(+), 32 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
index ed537ba..0fd8fdf 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
@@ -224,25 +224,20 @@ brw_blorp_const_color_program::compile(struct brw_context *brw,
static bool
-do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,
- struct gl_renderbuffer *rb, unsigned buf,
- bool partial_clear, bool encode_srgb, unsigned layer)
+do_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,
+ struct gl_renderbuffer *rb, unsigned buf,
+ bool partial_clear, bool encode_srgb)
{
struct gl_context *ctx = &brw->ctx;
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
- mesa_format format = irb->mt->format;
struct brw_blorp_params params;
brw_blorp_params_init(¶ms);
+ params.num_layers = MAX2(1, fb->MaxNumLayers);
- if (!encode_srgb && _mesa_get_format_color_encoding(format) == GL_SRGB)
- format = _mesa_get_srgb_format_linear(format);
-
- brw_blorp_surface_info_init(brw, ¶ms.dst, irb->mt, irb->mt_level,
- layer, format, true);
-
- /* Override the surface format according to the context's sRGB rules. */
- params.dst.brw_surfaceformat = brw->render_target_format[format];
+ params.dst.num_samples = irb->mt->num_samples;
+ params.dst.mt = NULL;
+ params.dst.rb = rb;
params.x0 = fb->_Xmin;
params.x1 = fb->_Xmax;
@@ -331,8 +326,8 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,
else
clear_type = "slow";
- DBG("%s (%s) to mt %p level %d layer %d\n", __FUNCTION__, clear_type,
- irb->mt, irb->mt_level, irb->mt_layer);
+ DBG("%s (%s) to mt %p level %d layer(s) %d/%d\n", __FUNCTION__, clear_type,
+ irb->mt, irb->mt_level, irb->mt_layer, params.num_layers);
brw_blorp_exec(brw, ¶ms);
@@ -368,24 +363,8 @@ brw_blorp_clear_color(struct brw_context *brw, struct gl_framebuffer *fb,
if (rb == NULL)
continue;
- if (fb->MaxNumLayers > 0) {
- unsigned layer_multiplier =
- (irb->mt->msaa_layout == INTEL_MSAA_LAYOUT_UMS ||
- irb->mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS) ?
- irb->mt->num_samples : 1;
- unsigned num_layers = irb->layer_count;
- for (unsigned layer = 0; layer < num_layers; layer++) {
- if (!do_single_blorp_clear(
- brw, fb, rb, buf, partial_clear, encode_srgb,
- irb->mt_layer + layer * layer_multiplier)) {
- return false;
- }
- }
- } else {
- unsigned layer = irb->mt_layer;
- if (!do_single_blorp_clear(brw, fb, rb, buf, partial_clear,
- encode_srgb, layer))
- return false;
+ if (!do_blorp_clear(brw, fb, rb, buf, partial_clear, encode_srgb)) {
+ return false;
}
irb->need_downsample = true;
--
2.5.5
More information about the mesa-dev
mailing list