Mesa (main): isl: Add some asserts about multisampled surfaces

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 31 14:11:28 UTC 2022


Module: Mesa
Branch: main
Commit: faa51a10edbd92cc3f9cf2c5766360f759edeea2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=faa51a10edbd92cc3f9cf2c5766360f759edeea2

Author: Jason Ekstrand <jason.ekstrand at collabora.com>
Date:   Mon May 30 09:52:10 2022 -0500

isl: Add some asserts about multisampled surfaces

This isn't really necessary because the API doesn't allow MSAA and
mipmapping at the same time but people forget that pretty often so it's
good to have it as documentation if nothing else.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14129>

---

 src/intel/isl/isl_surface_state.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/intel/isl/isl_surface_state.c b/src/intel/isl/isl_surface_state.c
index 4cbcd64d28e..914889d8a90 100644
--- a/src/intel/isl/isl_surface_state.c
+++ b/src/intel/isl/isl_surface_state.c
@@ -439,6 +439,19 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,
    s.CubeFaceEnableNegativeX = 1;
 
 #if GFX_VER >= 6
+   /* From the Broadwell PRM for "Number of Multisamples":
+    *
+    *    "If this field is any value other than MULTISAMPLECOUNT_1, Surface
+    *    Min LOD, Mip Count / LOD, and Resource Min LOD must be set to zero."
+    *
+    * This is fine because no 3D API allows multisampling and mipmapping at
+    * the same time.
+    */
+   if (info->surf->samples > 1) {
+      assert(info->view->min_lod_clamp == 0);
+      assert(info->view->base_level == 0);
+      assert(info->view->levels == 1);
+   }
    s.NumberofMultisamples = ffs(info->surf->samples) - 1;
 #if GFX_VER >= 7
    s.MultisampledSurfaceStorageFormat =



More information about the mesa-commit mailing list