Mesa (master): i965/msaa: Disable unsupported formats.

Paul Berry stereotype441 at kemper.freedesktop.org
Wed Jun 20 18:46:06 UTC 2012


Module: Mesa
Branch: master
Commit: 3b0279a69392a8fcc81ad462ca5623ec2a73f890
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3b0279a69392a8fcc81ad462ca5623ec2a73f890

Author: Paul Berry <stereotype441 at gmail.com>
Date:   Fri Jun 15 10:49:58 2012 -0700

i965/msaa: Disable unsupported formats.

Due to hardware limitations, MSAA is unsupported on Gen6 for formats
containing >64 bits of data per pixel.  From the Sandy Bridge PRM,
vol4 part1, p72 ("Surface Format"):

    If Number of Multisamples is set to a value other than
    MULTISAMPLECOUNT_1, this field cannot be set to the following
    formats:
    - any format with greater than 64 bits per element
    - any compressed texture format (BC*)
    - any YCRCB* format

Gen7 has a similar, but less stringent limitation: formats with >64
bits of data per pixel only support 4x MSAA.

This patch causes the unsupported formats to report
GL_FRAMEBUFFER_UNSUPPORTED.

Fixes piglit "multisample-formats" tests on Gen6.

Acked-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/i965/brw_wm_surface_state.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 4718337..d09fe6d 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -576,6 +576,19 @@ brw_render_target_supported(struct intel_context *intel,
 	rb->_BaseFormat != GL_RED) && _mesa_is_format_integer_color(format))
       return false;
 
+   /* Under some conditions, MSAA is not supported for formats whose width is
+    * more than 64 bits.
+    */
+   if (rb->NumSamples > 0 && _mesa_get_format_bytes(format) > 8) {
+      /* Gen6: MSAA on >64 bit formats is unsupported. */
+      if (intel->gen <= 6)
+         return false;
+
+      /* Gen7: 8x MSAA on >64 bit formats is unsupported. */
+      if (rb->NumSamples >= 8)
+         return false;
+   }
+
    return brw->format_supported_as_render_target[format];
 }
 




More information about the mesa-commit mailing list