Mesa (staging/22.0): anv: fix dynamic sample locations on Gen7/7.5

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 21 16:31:24 UTC 2022


Module: Mesa
Branch: staging/22.0
Commit: bd49bc978638bbd453aff614ab38a8115e22631c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bd49bc978638bbd453aff614ab38a8115e22631c

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Wed Mar 16 00:25:17 2022 +0200

anv: fix dynamic sample locations on Gen7/7.5

3DSTATE_MULTISAMPLE should be baked into the pipeline if not dynamic.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Fixes: 27ee40f4c9d8 ("anv: Add support for sample locations")
Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15310>
(cherry picked from commit 6f5f817c0fa414d23b7e843fc27237053b072a2c)

---

 .pick_status.json                |  2 +-
 src/intel/vulkan/genX_pipeline.c | 38 ++++++++++++++++----------------------
 2 files changed, 17 insertions(+), 23 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index c93bfdd1218..9acb4a35e9c 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -8644,7 +8644,7 @@
         "description": "anv: fix dynamic sample locations on Gen7/7.5",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 5,
+        "resolution": 1,
         "because_sha": "27ee40f4c9d86ed9190a8fee6d230e7416b288e3"
     },
     {
diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
index 598b2093b29..77fb2c1cc88 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -913,34 +913,28 @@ emit_ms_state(struct anv_graphics_pipeline *pipeline,
               const VkPipelineMultisampleStateCreateInfo *info,
               uint32_t dynamic_states)
 {
-   /* Only lookup locations if the extensions is active, otherwise the default
-    * ones will be used either at device initialization time or through
-    * 3DSTATE_MULTISAMPLE on Gfx7/7.5 by passing NULL locations.
-    */
-   if (pipeline->base.device->vk.enabled_extensions.EXT_sample_locations) {
-      /* If the sample locations are dynamic, 3DSTATE_MULTISAMPLE on Gfx7/7.5
-       * will be emitted dynamically, so skip it here. On Gfx8+
-       * 3DSTATE_SAMPLE_PATTERN will be emitted dynamically, so skip it here.
-       */
-      if (!(dynamic_states & ANV_CMD_DIRTY_DYNAMIC_SAMPLE_LOCATIONS)) {
 #if GFX_VER >= 8
-         genX(emit_sample_pattern)(&pipeline->base.batch,
-                                   pipeline->dynamic_state.sample_locations.samples,
-                                   pipeline->dynamic_state.sample_locations.locations);
+   /* On Gfx8+ 3DSTATE_MULTISAMPLE only holds the number of samples. */
+   genX(emit_multisample)(&pipeline->base.batch,
+                          info ? info->rasterizationSamples : 1,
+                          NULL);
 #endif
-      }
 
+   /* If EXT_sample_locations is enabled and the sample locations are not
+    * dynamic, then we need to emit those position in the pipeline batch. On
+    * Gfx8+ this is part of 3DSTATE_SAMPLE_PATTERN, prior to that this is in
+    * 3DSTATE_MULTISAMPLE.
+    */
+   if (pipeline->base.device->vk.enabled_extensions.EXT_sample_locations &&
+       !(dynamic_states & ANV_CMD_DIRTY_DYNAMIC_SAMPLE_LOCATIONS)) {
+#if GFX_VER >= 8
+      genX(emit_sample_pattern)(&pipeline->base.batch,
+                                pipeline->dynamic_state.sample_locations.samples,
+                                pipeline->dynamic_state.sample_locations.locations);
+#else
       genX(emit_multisample)(&pipeline->base.batch,
                              pipeline->dynamic_state.sample_locations.samples,
                              pipeline->dynamic_state.sample_locations.locations);
-   } else {
-      /* On Gfx8+ 3DSTATE_MULTISAMPLE does not hold anything we need to modify
-       * for sample locations, so we don't have to emit it dynamically.
-       */
-#if GFX_VER >= 8
-      genX(emit_multisample)(&pipeline->base.batch,
-                             info ? info->rasterizationSamples : 1,
-                             NULL);
 #endif
    }
 



More information about the mesa-commit mailing list