Mesa (staging/20.0): isl: Set 3DSTATE_DEPTH_BUFFER::Depth correctly for 3D surfaces

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Mar 7 00:42:57 UTC 2020


Module: Mesa
Branch: staging/20.0
Commit: 18508b37cb61060a3b5c493033bdb13859051511
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=18508b37cb61060a3b5c493033bdb13859051511

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Wed Feb  5 09:03:30 2020 -0600

isl: Set 3DSTATE_DEPTH_BUFFER::Depth correctly for 3D surfaces

Cc: mesa-stable at lists.freedesktop.org
Reviewed-by: Nanley Chery <nanley.g.chery at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3717>
(cherry picked from commit 9f5f4269a66eebfcaa3ae5cd7bdf91d88a7fc69c)

---

 .pick_status.json                      |  2 +-
 src/intel/isl/isl_emit_depth_stencil.c | 20 +++++++++++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 7c971f3f4a8..1f85bedabb6 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -886,7 +886,7 @@
         "description": "isl: Set 3DSTATE_DEPTH_BUFFER::Depth correctly for 3D surfaces",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/intel/isl/isl_emit_depth_stencil.c b/src/intel/isl/isl_emit_depth_stencil.c
index 4906d95a49c..b89ab3b5143 100644
--- a/src/intel/isl/isl_emit_depth_stencil.c
+++ b/src/intel/isl/isl_emit_depth_stencil.c
@@ -71,11 +71,15 @@ isl_genX(emit_depth_stencil_hiz_s)(const struct isl_device *dev, void *batch,
       db.SurfaceFormat = isl_surf_get_depth_format(dev, info->depth_surf);
       db.Width = info->depth_surf->logical_level0_px.width - 1;
       db.Height = info->depth_surf->logical_level0_px.height - 1;
+      if (db.SurfaceType == SURFTYPE_3D)
+         db.Depth = info->depth_surf->logical_level0_px.depth - 1;
    } else if (info->stencil_surf) {
       db.SurfaceType = isl_to_gen_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;
@@ -83,9 +87,23 @@ isl_genX(emit_depth_stencil_hiz_s)(const struct isl_device *dev, void *batch,
 
    if (info->depth_surf || info->stencil_surf) {
       /* These are based entirely on the view */
-      db.Depth = db.RenderTargetViewExtent = info->view->array_len - 1;
+      db.RenderTargetViewExtent = info->view->array_len - 1;
       db.LOD                  = info->view->base_level;
       db.MinimumArrayElement  = info->view->base_array_layer;
+
+      /* From the Haswell PRM docs for 3DSTATE_DEPTH_BUFFER::Depth
+       *
+       *    "This field specifies the total number of levels for a volume
+       *    texture or the number of array elements allowed to be accessed
+       *    starting at the Minimum Array Element for arrayed surfaces. If the
+       *    volume texture is MIP-mapped, this field specifies the depth of
+       *    the base MIP level."
+       *
+       * For 3D surfaces, we set it to the correct depth above.  For non-3D
+       * surfaces, this is the same as RenderTargetViewExtent.
+       */
+      if (db.SurfaceType != SURFTYPE_3D)
+         db.Depth = db.RenderTargetViewExtent;
    }
 
    if (info->depth_surf) {



More information about the mesa-commit mailing list