mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 08:58:02 +02:00
anv: Properly clamp attachment layer counts
Vulkan requires that the acutal layer count come from
VkRenderingInfo::layerCount or VkFramebufferCreateInfo::layers rather
than from the image view itself.
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17060>
(cherry picked from commit 7a8ec23c9d)
This commit is contained in:
parent
cb13e00f72
commit
404838a333
2 changed files with 25 additions and 9 deletions
|
|
@ -1597,7 +1597,7 @@
|
|||
"description": "anv: Properly clamp attachment layer counts",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null
|
||||
},
|
||||
|
|
|
|||
|
|
@ -6345,22 +6345,32 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
|
|||
if (dw == NULL)
|
||||
return;
|
||||
|
||||
struct isl_view isl_view = {};
|
||||
struct isl_depth_stencil_hiz_emit_info info = {
|
||||
.view = &isl_view,
|
||||
.mocs = anv_mocs(device, NULL, ISL_SURF_USAGE_DEPTH_BIT),
|
||||
};
|
||||
|
||||
if (gfx->depth_att.iview != NULL) {
|
||||
info.view = &gfx->depth_att.iview->planes[0].isl;
|
||||
isl_view = gfx->depth_att.iview->planes[0].isl;
|
||||
} else if (gfx->stencil_att.iview != NULL) {
|
||||
info.view = &gfx->stencil_att.iview->planes[0].isl;
|
||||
isl_view = gfx->stencil_att.iview->planes[0].isl;
|
||||
}
|
||||
|
||||
if (gfx->view_mask) {
|
||||
assert(isl_view.array_len == 0 ||
|
||||
isl_view.array_len >= util_last_bit(gfx->view_mask));
|
||||
isl_view.array_len = util_last_bit(gfx->view_mask);
|
||||
} else {
|
||||
assert(isl_view.array_len == 0 ||
|
||||
isl_view.array_len >= util_last_bit(gfx->layer_count));
|
||||
isl_view.array_len = gfx->layer_count;
|
||||
}
|
||||
|
||||
if (gfx->depth_att.iview != NULL) {
|
||||
const struct anv_image_view *iview = gfx->depth_att.iview;
|
||||
const struct anv_image *image = iview->image;
|
||||
|
||||
info.view = &iview->planes[0].isl;
|
||||
|
||||
const uint32_t depth_plane =
|
||||
anv_image_aspect_to_plane(image, VK_IMAGE_ASPECT_DEPTH_BIT);
|
||||
const struct anv_surface *depth_surface =
|
||||
|
|
@ -6401,9 +6411,6 @@ cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
|
|||
const struct anv_image_view *iview = gfx->stencil_att.iview;
|
||||
const struct anv_image *image = iview->image;
|
||||
|
||||
if (info.view == NULL)
|
||||
info.view = &iview->planes[0].isl;
|
||||
|
||||
const uint32_t stencil_plane =
|
||||
anv_image_aspect_to_plane(image, VK_IMAGE_ASPECT_STENCIL_BIT);
|
||||
const struct anv_surface *stencil_surface =
|
||||
|
|
@ -6698,10 +6705,19 @@ void genX(CmdBeginRendering)(
|
|||
gfx->color_att[i].layout = att->imageLayout;
|
||||
gfx->color_att[i].aux_usage = aux_usage;
|
||||
|
||||
struct isl_view isl_view = iview->planes[0].isl;
|
||||
if (pRenderingInfo->viewMask) {
|
||||
assert(isl_view.array_len >= util_last_bit(pRenderingInfo->viewMask));
|
||||
isl_view.array_len = util_last_bit(pRenderingInfo->viewMask);
|
||||
} else {
|
||||
assert(isl_view.array_len >= pRenderingInfo->layerCount);
|
||||
isl_view.array_len = pRenderingInfo->layerCount;
|
||||
}
|
||||
|
||||
anv_image_fill_surface_state(cmd_buffer->device,
|
||||
iview->image,
|
||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
&iview->planes[0].isl,
|
||||
&isl_view,
|
||||
ISL_SURF_USAGE_RENDER_TARGET_BIT,
|
||||
aux_usage, &fast_clear_color,
|
||||
0, /* anv_image_view_state_flags */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue