intel/compiler: disable per-sample interpolation modes with non-per-sample dispatch
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Wed, 16 Aug 2023 06:32:05 +0000 (09:32 +0300)
committerMarge Bot <emma+marge@anholt.net>
Tue, 29 Aug 2023 23:19:12 +0000 (23:19 +0000)
Fixes hangs in dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.*

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 5644011f06 ("intel/compiler: Convert wm_prog_key::persample_interp to a tri-state")
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24716>

src/intel/compiler/brw_compiler.h

index 36148b6..b1deca3 100644 (file)
@@ -1172,9 +1172,13 @@ wm_prog_data_barycentric_modes(const struct brw_wm_prog_data *prog_data,
 {
    uint32_t modes = prog_data->barycentric_interp_modes;
 
-   if (pushed_msaa_flags & BRW_WM_MSAA_FLAG_PERSAMPLE_INTERP) {
-      assert(pushed_msaa_flags & BRW_WM_MSAA_FLAG_ENABLE_DYNAMIC);
+   /* In the non dynamic case, we can just return the computed modes from
+    * compilation time.
+    */
+   if (!(pushed_msaa_flags & BRW_WM_MSAA_FLAG_ENABLE_DYNAMIC))
+      return modes;
 
+   if (pushed_msaa_flags & BRW_WM_MSAA_FLAG_PERSAMPLE_INTERP) {
       assert(prog_data->persample_dispatch == BRW_ALWAYS ||
              (pushed_msaa_flags & BRW_WM_MSAA_FLAG_PERSAMPLE_DISPATCH));
 
@@ -1211,6 +1215,18 @@ wm_prog_data_barycentric_modes(const struct brw_wm_prog_data *prog_data,
          modes &= ~BITFIELD_BIT(sample_mode);
          modes |= BITFIELD_BIT(BRW_BARYCENTRIC_NONPERSPECTIVE_SAMPLE);
       }
+   } else {
+      /* If we're not using per-sample interpolation, we need to disable the
+       * per-sample bits.
+       *
+       * SKL PRMs, Volume 2a: Command Reference: Instructions,
+       * 3DSTATE_WM:Barycentric Interpolation Mode:
+
+       *    "MSDISPMODE_PERSAMPLE is required in order to select Perspective
+       *     Sample or Non-perspective Sample barycentric coordinates."
+       */
+      modes &= ~(BITFIELD_BIT(BRW_BARYCENTRIC_PERSPECTIVE_SAMPLE) |
+                 BITFIELD_BIT(BRW_BARYCENTRIC_NONPERSPECTIVE_SAMPLE));
    }
 
    return modes;