isl: don't set inconsistent fields for depth when using stencil only
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Sun, 20 Feb 2022 18:46:17 +0000 (20:46 +0200)
committerMarge Bot <emma+marge@anholt.net>
Mon, 17 Apr 2023 22:43:37 +0000 (22:43 +0000)
Since Gfx12+ 3DSTATE_STENCIL_BUFFER gained its own
Width/Depth/Format/etc... fields. So don't set those fields but leave
the address/pitch to 0.

Issue found on simulation.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15637>

src/intel/isl/isl_emit_depth_stencil.c

index f1863fe..aaa2a8e 100644 (file)
@@ -114,12 +114,20 @@ isl_genX(emit_depth_stencil_hiz_s)(const struct isl_device *dev, void *batch,
       if (db.SurfaceType == SURFTYPE_3D)
          db.Depth = info->depth_surf->logical_level0_px.depth - 1;
    } else if (info->stencil_surf) {
+      /* On Gfx12+ 3DSTATE_STENCIL_BUFFER has its own fields for all of
+       * this. No need to replicate it here.
+       */
+#if GFX_VER < 12
       db.SurfaceType = isl_encode_ds_surftype[info->stencil_surf->dim];
       db.SurfaceFormat = D32_FLOAT;
       db.Width = info->stencil_surf->logical_level0_px.width - 1;
       db.Height = info->stencil_surf->logical_level0_px.height - 1;
       if (db.SurfaceType == SURFTYPE_3D)
          db.Depth = info->stencil_surf->logical_level0_px.depth - 1;
+#else
+      db.SurfaceType = SURFTYPE_NULL;
+      db.SurfaceFormat = D32_FLOAT;
+#endif
    } else {
       db.SurfaceType = SURFTYPE_NULL;
       db.SurfaceFormat = D32_FLOAT;