<div dir="ltr">On 4 February 2013 21:48, Chris Forbes <span dir="ltr"><<a href="mailto:chrisf@ijw.co.nz" target="_blank">chrisf@ijw.co.nz</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Gen7 has an erratum affecting the ld_mcs message, making it unsafe to<br>
use when the surface doesn't have an associated MCS.<br></blockquote><div><br></div><div>Would you mind quoting the exact text of the erratum here (and citing the page number)?<br><br></div><div>With that addition, this patch is:<br>
<br></div><div>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
To allow the shader to treat all surfaces uniformly, force UMS if the<br>
surface is to be used as a multisample texture, even if CMS would have<br>
been possible.<br>
<br>
Signed-off-by: Chris Forbes <<a href="mailto:chrisf@ijw.co.nz">chrisf@ijw.co.nz</a>><br>
---<br>
 src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 15 ++++++++++++---<br>
 1 file changed, 12 insertions(+), 3 deletions(-)<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 e68285c..be13c07 100644<br>
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c<br>
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c<br>
@@ -72,7 +72,7 @@ target_to_target(GLenum target)<br>
  * created, based on the chip generation and the surface type.<br>
  */<br>
 static enum intel_msaa_layout<br>
-compute_msaa_layout(struct intel_context *intel, gl_format format)<br>
+compute_msaa_layout(struct intel_context *intel, gl_format format, GLenum target)<br>
 {<br>
    /* Prior to Gen7, all MSAA surfaces used IMS layout. */<br>
    if (intel->gen < 7)<br>
@@ -101,7 +101,16 @@ compute_msaa_layout(struct intel_context *intel, gl_format format)<br>
          assert(intel->gen == 7);<br>
          return INTEL_MSAA_LAYOUT_UMS;<br>
       } else {<br>
-         return INTEL_MSAA_LAYOUT_CMS;<br>
+         /* For now, if we're going to be texturing from this surface,<br>
+          * force UMS, so that the shader doesn't have to do different things<br>
+          * based on whether there's a multisample control surface needing sampled first.<br>
+          */<br>
+         if (target == GL_TEXTURE_2D_MULTISAMPLE ||<br>
+               target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) {<br>
+            return INTEL_MSAA_LAYOUT_UMS;<br>
+         } else {<br>
+            return INTEL_MSAA_LAYOUT_CMS;<br>
+         }<br>
       }<br>
    }<br>
 }<br>
@@ -150,7 +159,7 @@ intel_miptree_create_layout(struct intel_context *intel,<br>
<br>
    if (num_samples > 1) {<br>
       /* Adjust width/height/depth for MSAA */<br>
-      mt->msaa_layout = compute_msaa_layout(intel, format);<br>
+      mt->msaa_layout = compute_msaa_layout(intel, format, mt->target);<br>
       if (mt->msaa_layout == INTEL_MSAA_LAYOUT_IMS) {<br>
          /* In the Sandy Bridge PRM, volume 4, part 1, page 31, it says:<br>
           *<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.1.2<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>