[Mesa-dev] [PATCH 1/7] i965: Document conventions for counting layers in 2D multisample buffers.
Paul Berry
stereotype441 at gmail.com
Wed Dec 4 06:30:30 PST 2013
The "layer" parameters used in blorp, and the
intel_renderbuffer::mt_layer field, represent a physical layer rather
than a logical layer. This is important for 2D multisample arrays on
Gen7+ because the UMS and CMS multisample layouts use N physical
layers to represent each logical layer, where N is the number of
samples.
Also add an assertion to blorp to help catch bugs if we fail to follow
these conventions.
---
src/mesa/drivers/dri/i965/brw_blorp.cpp | 9 +++++++++
src/mesa/drivers/dri/i965/brw_blorp.h | 5 +++++
src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 8 ++++++++
src/mesa/drivers/dri/i965/intel_fbo.h | 5 +++++
4 files changed, 27 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.cpp b/src/mesa/drivers/dri/i965/brw_blorp.cpp
index 6b3600d..791769a 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp.cpp
@@ -54,6 +54,15 @@ void
brw_blorp_mip_info::set(struct intel_mipmap_tree *mt,
unsigned int level, unsigned int layer)
{
+ /* Layer is a physical layer, so if this is a 2D multisample array texture
+ * using INTEL_MSAA_LAYOUT_UMS or INTEL_MSAA_LAYOUT_CMS, then it had better
+ * be a multiple of num_samples.
+ */
+ if (mt->msaa_layout == INTEL_MSAA_LAYOUT_UMS ||
+ mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS) {
+ assert(layer % mt->num_samples == 0);
+ }
+
intel_miptree_check_level_layer(mt, level, layer);
this->mt = mt;
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h b/src/mesa/drivers/dri/i965/brw_blorp.h
index 85bf099..5163b52 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.h
+++ b/src/mesa/drivers/dri/i965/brw_blorp.h
@@ -85,6 +85,11 @@ public:
/**
* The 2D layer within the miplevel. Combined, level and layer define the
* 2D miptree slice to use.
+ *
+ * Note: if mt is a 2D multisample array texture on Gen7+ using
+ * INTEL_MSAA_LAYOUT_UMS or INTEL_MSAA_LAYOUT_CMS, layer is the physical
+ * layer holding sample 0. So, for example, if mt->num_samples == 4, then
+ * logical layer n corresponds to layer == 4*n.
*/
uint32_t layer;
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index 9c48eac..a266143 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -123,6 +123,14 @@ find_miptree(GLbitfield buffer_bit, struct intel_renderbuffer *irb)
return mt;
}
+
+/**
+ * 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
+ * the physical layer holding sample 0. So, for example, if
+ * src_mt->num_samples == 4, then logical layer n corresponds to src_layer ==
+ * 4*n.
+ */
void
brw_blorp_blit_miptrees(struct brw_context *brw,
struct intel_mipmap_tree *src_mt,
diff --git a/src/mesa/drivers/dri/i965/intel_fbo.h b/src/mesa/drivers/dri/i965/intel_fbo.h
index a198301..447611f 100644
--- a/src/mesa/drivers/dri/i965/intel_fbo.h
+++ b/src/mesa/drivers/dri/i965/intel_fbo.h
@@ -63,6 +63,11 @@ struct intel_renderbuffer
*
* For renderbuffers not created with glFramebufferTexture*(), mt_level and
* mt_layer are 0.
+ *
+ * Note: for a 2D multisample array texture on Gen7+ using
+ * INTEL_MSAA_LAYOUT_UMS or INTEL_MSAA_LAYOUT_CMS, mt_layer is the physical
+ * layer holding sample 0. So, for example, if mt->num_samples == 4, then
+ * logical layer n corresponds to mt_layer == 4*n.
*/
unsigned int mt_level;
unsigned int mt_layer;
--
1.8.4.2
More information about the mesa-dev
mailing list