external/mesa
Revisión | cecfe9b844f8f6ee6f4e26f41aad32f36d8e083f (tree) |
---|---|
Tiempo | 2020-03-07 06:59:45 |
Autor | Jason Ekstrand <jason@jlek...> |
Commiter | Eric Engestrom |
isl: Set 3DSTATE_DEPTH_BUFFER::Depth correctly for 3D surfaces
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3717>
(cherry picked from commit 9f5f4269a66eebfcaa3ae5cd7bdf91d88a7fc69c)
@@ -652,7 +652,7 @@ | ||
652 | 652 | "description": "isl: Set 3DSTATE_DEPTH_BUFFER::Depth correctly for 3D surfaces", |
653 | 653 | "nominated": true, |
654 | 654 | "nomination_type": 0, |
655 | - "resolution": 0, | |
655 | + "resolution": 1, | |
656 | 656 | "master_sha": null, |
657 | 657 | "because_sha": null |
658 | 658 | }, |
@@ -71,11 +71,15 @@ isl_genX(emit_depth_stencil_hiz_s)(const struct isl_device *dev, void *batch, | ||
71 | 71 | db.SurfaceFormat = isl_surf_get_depth_format(dev, info->depth_surf); |
72 | 72 | db.Width = info->depth_surf->logical_level0_px.width - 1; |
73 | 73 | db.Height = info->depth_surf->logical_level0_px.height - 1; |
74 | + if (db.SurfaceType == SURFTYPE_3D) | |
75 | + db.Depth = info->depth_surf->logical_level0_px.depth - 1; | |
74 | 76 | } else if (info->stencil_surf) { |
75 | 77 | db.SurfaceType = isl_to_gen_ds_surftype[info->stencil_surf->dim]; |
76 | 78 | db.SurfaceFormat = D32_FLOAT; |
77 | 79 | db.Width = info->stencil_surf->logical_level0_px.width - 1; |
78 | 80 | db.Height = info->stencil_surf->logical_level0_px.height - 1; |
81 | + if (db.SurfaceType == SURFTYPE_3D) | |
82 | + db.Depth = info->stencil_surf->logical_level0_px.depth - 1; | |
79 | 83 | } else { |
80 | 84 | db.SurfaceType = SURFTYPE_NULL; |
81 | 85 | db.SurfaceFormat = D32_FLOAT; |
@@ -83,9 +87,23 @@ isl_genX(emit_depth_stencil_hiz_s)(const struct isl_device *dev, void *batch, | ||
83 | 87 | |
84 | 88 | if (info->depth_surf || info->stencil_surf) { |
85 | 89 | /* These are based entirely on the view */ |
86 | - db.Depth = db.RenderTargetViewExtent = info->view->array_len - 1; | |
90 | + db.RenderTargetViewExtent = info->view->array_len - 1; | |
87 | 91 | db.LOD = info->view->base_level; |
88 | 92 | db.MinimumArrayElement = info->view->base_array_layer; |
93 | + | |
94 | + /* From the Haswell PRM docs for 3DSTATE_DEPTH_BUFFER::Depth | |
95 | + * | |
96 | + * "This field specifies the total number of levels for a volume | |
97 | + * texture or the number of array elements allowed to be accessed | |
98 | + * starting at the Minimum Array Element for arrayed surfaces. If the | |
99 | + * volume texture is MIP-mapped, this field specifies the depth of | |
100 | + * the base MIP level." | |
101 | + * | |
102 | + * For 3D surfaces, we set it to the correct depth above. For non-3D | |
103 | + * surfaces, this is the same as RenderTargetViewExtent. | |
104 | + */ | |
105 | + if (db.SurfaceType != SURFTYPE_3D) | |
106 | + db.Depth = db.RenderTargetViewExtent; | |
89 | 107 | } |
90 | 108 | |
91 | 109 | if (info->depth_surf) { |