Mesa (staging/21.3): Revert "anv: Stop doing too much per-sample shading"

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Dec 30 10:25:11 UTC 2021


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

Author: Eric Engestrom <eric at engestrom.ch>
Date:   Wed Dec 29 22:13:06 2021 +0000

Revert "anv: Stop doing too much per-sample shading"

This reverts commit 29fcb94b9ea10c0c6a960fc0f2825f13e9344813.

---

 .pick_status.json               |  2 +-
 src/intel/vulkan/anv_pipeline.c | 41 ++++++++++++++++++++++-------------------
 2 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index f2159e2a5a9..51dbabaec65 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -3541,7 +3541,7 @@
         "description": "anv: Stop doing too much per-sample shading",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 1,
+        "resolution": 0,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index e03218ce9e2..1b5a53544e5 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -497,13 +497,6 @@ pipeline_has_coarse_pixel(const struct anv_graphics_pipeline *pipeline,
    return true;
 }
 
-static bool
-is_sample_shading(const VkPipelineMultisampleStateCreateInfo *ms_info)
-{
-   return ms_info->sampleShadingEnable &&
-      (ms_info->minSampleShading * ms_info->rasterizationSamples) > 1;
-}
-
 static void
 populate_wm_prog_key(const struct anv_graphics_pipeline *pipeline,
                      VkPipelineShaderStageCreateFlags flags,
@@ -552,8 +545,15 @@ populate_wm_prog_key(const struct anv_graphics_pipeline *pipeline,
    key->alpha_test_replicate_alpha = false;
 
    if (ms_info) {
-      key->persample_interp = is_sample_shading(ms_info);
-      key->multisample_fbo = ms_info->rasterizationSamples > 1;
+      /* We should probably pull this out of the shader, but it's fairly
+       * harmless to compute it and then let dead-code take care of it.
+       */
+      if (ms_info->rasterizationSamples > 1) {
+         key->persample_interp = ms_info->sampleShadingEnable &&
+            (ms_info->minSampleShading * ms_info->rasterizationSamples) > 1;
+         key->multisample_fbo = true;
+      }
+
       key->frag_coord_adds_sample_pos = key->persample_interp;
    }
 
@@ -2403,16 +2403,10 @@ anv_graphics_pipeline_init(struct anv_graphics_pipeline *pipeline,
                            PIPELINE_RASTERIZATION_DEPTH_CLIP_STATE_CREATE_INFO_EXT);
    pipeline->depth_clip_enable = clip_info ? clip_info->depthClipEnable : !pipeline->depth_clamp_enable;
 
-   /* If rasterization is not enabled, ms_info must be ignored. */
-   const bool raster_enabled =
-      !pCreateInfo->pRasterizationState->rasterizerDiscardEnable ||
-      (pipeline->dynamic_states &
-       ANV_CMD_DIRTY_DYNAMIC_RASTERIZER_DISCARD_ENABLE);
-
-   const VkPipelineMultisampleStateCreateInfo *ms_info =
-      raster_enabled ? pCreateInfo->pMultisampleState : NULL;
-
-   pipeline->sample_shading_enable = ms_info && is_sample_shading(ms_info);
+   pipeline->sample_shading_enable =
+      !pCreateInfo->pRasterizationState->rasterizerDiscardEnable &&
+      pCreateInfo->pMultisampleState &&
+      pCreateInfo->pMultisampleState->sampleShadingEnable;
 
    result = anv_pipeline_compile_graphics(pipeline, cache, pCreateInfo);
    if (result != VK_SUCCESS) {
@@ -2494,6 +2488,15 @@ anv_graphics_pipeline_init(struct anv_graphics_pipeline *pipeline,
          pipeline->topology = vk_to_intel_primitive_type[ia_info->topology];
    }
 
+   /* If rasterization is not enabled, ms_info must be ignored. */
+   const bool raster_enabled =
+      !pCreateInfo->pRasterizationState->rasterizerDiscardEnable ||
+      (pipeline->dynamic_states &
+       ANV_CMD_DIRTY_DYNAMIC_RASTERIZER_DISCARD_ENABLE);
+
+   const VkPipelineMultisampleStateCreateInfo *ms_info =
+      raster_enabled ? pCreateInfo->pMultisampleState : NULL;
+
    const VkPipelineRasterizationLineStateCreateInfoEXT *line_info =
       vk_find_struct_const(pCreateInfo->pRasterizationState->pNext,
                            PIPELINE_RASTERIZATION_LINE_STATE_CREATE_INFO_EXT);



More information about the mesa-commit mailing list