summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_blorp.c
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2016-09-03 11:40:09 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2016-09-12 19:42:57 -0700
commit54db5afd2c8bd3a32658b3fef698c6896f6a297b (patch)
treefee6499bcc4ca86c58b70b3ef309a0a8546b87fb /src/mesa/drivers/dri/i965/brw_blorp.c
parentfa4627149dfe7cdb9f75d8e2f1bcaf1ad7006801 (diff)
downloadexternal_mesa3d-54db5afd2c8bd3a32658b3fef698c6896f6a297b.zip
external_mesa3d-54db5afd2c8bd3a32658b3fef698c6896f6a297b.tar.gz
external_mesa3d-54db5afd2c8bd3a32658b3fef698c6896f6a297b.tar.bz2
intel/blorp: Work in terms of logical array layers
When Ivy Bridge introduced array multisampling, someone made the decision to do lots of stuff throughout the driver in terms of physical array layers rather than logical array layers. In ISL, we use logical array layers most of the time and it really makes no sense to use physical array layers in the blorp API. Every time someone passes physical array layers into blorp for an array multisampled surface, they're always divisible by the number of samples and we divide right away. Eventually, I'd like to rework most of the GL driver internals to use logical array layers but that's going to be a big project and will probably happen as part of the ISL conversion. For now, we'll do the conversion in brw_blorp and let blorp just use the logical layers. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_blorp.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c
index 38938d4..e864915 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.c
+++ b/src/mesa/drivers/dri/i965/brw_blorp.c
@@ -274,6 +274,20 @@ swizzle_to_scs(GLenum swizzle)
return (enum isl_channel_select)((swizzle + 4) & 7);
}
+static unsigned
+physical_to_logical_layer(struct intel_mipmap_tree *mt,
+ unsigned physical_layer)
+{
+ if (mt->num_samples > 1 &&
+ (mt->msaa_layout == INTEL_MSAA_LAYOUT_UMS ||
+ mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS)) {
+ assert(physical_layer % mt->num_samples == 0);
+ return physical_layer / mt->num_samples;
+ } else {
+ return physical_layer;
+ }
+}
+
/**
* Note: if the src (or dst) is a 2D multisample array texture on Gen7+ using
* INTEL_MSAA_LAYOUT_UMS or INTEL_MSAA_LAYOUT_CMS, src_layer (dst_layer) is
@@ -358,9 +372,11 @@ brw_blorp_blit_miptrees(struct brw_context *brw,
struct blorp_batch batch;
blorp_batch_init(&brw->blorp, &batch, brw);
- blorp_blit(&batch, &src_surf, src_level, src_layer,
+ blorp_blit(&batch, &src_surf, src_level,
+ physical_to_logical_layer(src_mt, src_layer),
brw_blorp_to_isl_format(brw, src_format, false), src_isl_swizzle,
- &dst_surf, dst_level, dst_layer,
+ &dst_surf, dst_level,
+ physical_to_logical_layer(dst_mt, dst_layer),
brw_blorp_to_isl_format(brw, dst_format, true),
ISL_SWIZZLE_IDENTITY,
src_x0, src_y0, src_x1, src_y1,
@@ -677,6 +693,12 @@ set_write_disables(const struct intel_renderbuffer *irb,
return disables;
}
+static unsigned
+irb_logical_mt_layer(struct intel_renderbuffer *irb)
+{
+ return physical_to_logical_layer(irb->mt, irb->mt_layer);
+}
+
static bool
do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,
struct gl_renderbuffer *rb, unsigned buf,
@@ -764,7 +786,8 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,
blorp_batch_init(&brw->blorp, &batch, brw);
blorp_fast_clear(&batch, &surf,
(enum isl_format)brw->render_target_format[format],
- level, irb->mt_layer, num_layers, x0, y0, x1, y1);
+ level, irb_logical_mt_layer(irb), num_layers,
+ x0, y0, x1, y1);
blorp_batch_finish(&batch);
/* Now that the fast clear has occurred, put the buffer in
@@ -784,7 +807,7 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,
blorp_clear(&batch, &surf,
(enum isl_format)brw->render_target_format[format],
ISL_SWIZZLE_IDENTITY,
- level, irb->mt_layer, num_layers,
+ level, irb_logical_mt_layer(irb), num_layers,
x0, y0, x1, y1,
clear_color, color_write_disable);
blorp_batch_finish(&batch);