anv: toggle on sample shading if it is set in the shader
authorTapani Pälli <tapani.palli@intel.com>
Sun, 14 Feb 2021 15:49:35 +0000 (17:49 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 2 Mar 2021 06:19:09 +0000 (06:19 +0000)
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4300
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9040>

src/intel/vulkan/anv_pipeline.c

index 49e67b3..cfa95e0 100644 (file)
@@ -743,6 +743,13 @@ anv_pipeline_lower_nir(struct anv_pipeline *pipeline,
    nir_shader *nir = stage->nir;
 
    if (nir->info.stage == MESA_SHADER_FRAGMENT) {
+      /* Check if sample shading is enabled in the shader and toggle
+       * it on for the pipeline independent if sampleShadingEnable is set.
+       */
+      nir_shader_gather_info(nir, nir_shader_get_entrypoint(nir));
+      if (nir->info.fs.uses_sample_shading)
+         anv_pipeline_to_graphics(pipeline)->sample_shading_enable = true;
+
       NIR_PASS_V(nir, nir_lower_wpos_center,
                  anv_pipeline_to_graphics(pipeline)->sample_shading_enable);
       NIR_PASS_V(nir, nir_lower_input_attachments,