Module: Mesa Branch: main Commit: 7e1b62ea5b35d7bd0245d10c8667184a7a6a4882 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7e1b62ea5b35d7bd0245d10c8667184a7a6a4882
Author: Faith Ekstrand <[email protected]> Date: Tue Feb 28 11:16:06 2023 -0600 isl: Set Depth to array len for 3D storage images This is necessary for RESINFO to work properly. Reviewed-by: Lionel Landwerlin <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21376> --- src/intel/isl/isl_surface_state.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/intel/isl/isl_surface_state.c b/src/intel/isl/isl_surface_state.c index 455e2f3bbb6..4de64920a08 100644 --- a/src/intel/isl/isl_surface_state.c +++ b/src/intel/isl/isl_surface_state.c @@ -329,12 +329,32 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state, s.RenderTargetViewExtent = s.Depth; break; case SURFTYPE_3D: + assert(info->view->base_array_layer + info->view->array_len <= + isl_minify(info->surf->logical_level0_px.depth, + info->view->base_level)); + /* From the Broadwell PRM >> RENDER_SURFACE_STATE::Depth: * * If the volume texture is MIP-mapped, this field specifies the * depth of the base MIP level. */ - s.Depth = info->surf->logical_level0_px.depth - 1; + if (GFX_VER >= 9 && info->view->usage & ISL_SURF_USAGE_STORAGE_BIT) { + /* From the Kaby Lake docs for the RESINFO message: + * + * "Surface Type | ... | Blue + * --------------+-----+---------------- + * SURFTYPE_3D | ... | (Depth+1)»LOD" + * + * which isn't actually what the Vulkan or D3D specs want for storage + * images. We want the requested array size. The good news is that, + * thanks to Skylake and later using the same image layout for 3D + * images as 2D array images, we should be able to adjust the depth + * without affecting the layout. + */ + s.Depth = (info->view->array_len << info->view->base_level) - 1; + } else { + s.Depth = info->surf->logical_level0_px.depth - 1; + } /* From the Broadwell PRM >> RENDER_SURFACE_STATE::RenderTargetViewExtent: *
