[Mesa-dev] [PATCH V2 06/10] i965/Gen7: Include bitfield in the sampler key for CMS layout

Chris Forbes chrisf at ijw.co.nz
Sat Nov 30 15:30:04 PST 2013


We need to emit extra shader code in this case to sample the
MCS surface first; we can't just blindly do this all the time
since IVB will sometimes try to access the MCS surface even if
disabled.

Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
 src/mesa/drivers/dri/i965/brw_program.h | 5 +++++
 src/mesa/drivers/dri/i965/brw_wm.c      | 9 +++++++++
 2 files changed, 14 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_program.h b/src/mesa/drivers/dri/i965/brw_program.h
index 07be4a0..51182ea 100644
--- a/src/mesa/drivers/dri/i965/brw_program.h
+++ b/src/mesa/drivers/dri/i965/brw_program.h
@@ -45,6 +45,11 @@ struct brw_sampler_prog_key_data {
     * For RG32F, gather4's channel select is broken.
     */
    uint16_t gather_channel_quirk_mask;
+
+   /**
+    * Whether this sampler uses the compressed multisample surface layout.
+    */
+   uint16_t compressed_multisample_layout_mask;
 };
 
 #ifdef __cplusplus
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index bc1480c..414481b 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -38,6 +38,7 @@
 #include "main/samplerobj.h"
 #include "program/prog_parameter.h"
 #include "program/program.h"
+#include "intel_mipmap_tree.h"
 
 #include "glsl/ralloc.h"
 
@@ -356,6 +357,14 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
             if (img->InternalFormat == GL_RG32F)
                key->gather_channel_quirk_mask |= 1 << s;
          }
+
+         /* If this is a multisample sampler, and uses the CMS MSAA layout, then
+          * we need to emit slightly different code to first sample the MCS surface.
+          */
+         if (brw->gen >= 7 && img->NumSamples &&
+             intel_compute_msaa_layout(brw, img->TexFormat, t->Target) == INTEL_MSAA_LAYOUT_CMS) {
+            key->compressed_multisample_layout_mask |= 1 << s;
+         }
       }
    }
 }
-- 
1.8.4.2



More information about the mesa-dev mailing list