On 21 July 2012 17:36, Chad Versace <span dir="ltr"><<a href="mailto:chad.versace@linux.intel.com" target="_blank">chad.versace@linux.intel.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Actually, this patch forces an automatic downsample during<br>
intel_miptree_map.  And this should occur only due to glReadPixels.<br>
<br>
CC: Eric Anholt <<a href="mailto:eric@anholt.net">eric@anholt.net</a>><br>
CC: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br>
Signed-off-by: Chad Versace <<a href="mailto:chad.versace@linux.intel.com">chad.versace@linux.intel.com</a>><br>
---<br>
 src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 10 ++++++++++<br>
 1 file changed, 10 insertions(+)<br>
<br>
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c<br>
index c4496ea..26002c2 100644<br>
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c<br>
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c<br>
@@ -1339,6 +1339,15 @@ intel_miptree_map(struct intel_context *intel,<br>
 {<br>
    struct intel_miptree_map *map;<br>
<br>
+   if (mt->num_samples > 0 && (mode & GL_MAP_WRITE_BIT)) {<br>
+      /* We choose not support swrast on multisample buffers because<br>
+       * it would require an upsample on unmap. As of 2012-07-20, this<br>
+       * warning occurs only on glDrawPixels(GL_STENCIL_INDEX).<br>
+       */<br>
+      _mesa_warning(&intel->ctx, "unsupported fallback to software "<br>
+                    "rasterization on a multisample buffer");<br>
+   }<br>
+<br>
    map = calloc(1, sizeof(struct intel_miptree_map));<br>
    if (!map){<br>
       *out_ptr = NULL;<br>
@@ -1354,6 +1363,7 @@ intel_miptree_map(struct intel_context *intel,<br>
    map->w = w;<br>
    map->h = h;<br>
<br>
+   intel_miptree_downsample(intel, mt);<br>
    intel_miptree_slice_resolve_depth(intel, mt, level, slice);<br>
    if (map->mode & GL_MAP_WRITE_BIT) {<br>
       intel_miptree_slice_set_needs_hiz_resolve(mt, level, slice);<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.11.2<br>
<br>
</font></span></blockquote></div><br>It seems to me that we also need to write some code to ensure that glReadPixels() reads from mt->singlesample_mt rather than mt.  (Otherwise, on Gen6, glReadPixels() will see something awful, and on Gen7, glReadPixels() will read from the first slice of the UMS/CMS buffer, which will look ok like no multisampled occurred).  Or am I missing something?<br>