lavapipe: use framebuffer attachment_count member instead of renderpass

according to spec, these must be equal

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13349>
This commit is contained in:
Mike Blumenkrantz 2021-10-01 14:48:23 -04:00 committed by Marge Bot
parent dd70ff3b8c
commit afd8820d66
1 changed files with 10 additions and 7 deletions

View File

@ -1734,25 +1734,28 @@ static void begin_render_pass(const VkRenderPassBeginInfo *render_pass_begin,
state->pass = pass; state->pass = pass;
state->vk_framebuffer = framebuffer; state->vk_framebuffer = framebuffer;
state->render_area = render_pass_begin->renderArea; state->render_area = render_pass_begin->renderArea;
unsigned attachment_count;
if (attachment_info) { if (attachment_info) {
state->imageless_views = realloc(state->imageless_views, sizeof(*state->imageless_views) * attachment_info->attachmentCount); state->imageless_views = realloc(state->imageless_views, sizeof(*state->imageless_views) * attachment_info->attachmentCount);
for (unsigned i = 0; i < attachment_info->attachmentCount; i++) for (unsigned i = 0; i < attachment_info->attachmentCount; i++)
state->imageless_views[i] = lvp_image_view_from_handle(attachment_info->pAttachments[i]); state->imageless_views[i] = lvp_image_view_from_handle(attachment_info->pAttachments[i]);
} attachment_count = attachment_info->attachmentCount;
} else
attachment_count = framebuffer->attachment_count;
state->framebuffer.width = state->vk_framebuffer->width; state->framebuffer.width = state->vk_framebuffer->width;
state->framebuffer.height = state->vk_framebuffer->height; state->framebuffer.height = state->vk_framebuffer->height;
state->framebuffer.layers = state->vk_framebuffer->layers; state->framebuffer.layers = state->vk_framebuffer->layers;
if (state->num_pending_aspects < state->pass->attachment_count) { if (state->num_pending_aspects < attachment_count) {
state->pending_clear_aspects = realloc(state->pending_clear_aspects, sizeof(VkImageAspectFlags) * state->pass->attachment_count); state->pending_clear_aspects = realloc(state->pending_clear_aspects, sizeof(VkImageAspectFlags) * attachment_count);
state->cleared_views = realloc(state->cleared_views, sizeof(uint32_t) * state->pass->attachment_count); state->cleared_views = realloc(state->cleared_views, sizeof(uint32_t) * attachment_count);
state->num_pending_aspects = state->pass->attachment_count; state->num_pending_aspects = attachment_count;
} }
state->attachments = realloc(state->attachments, sizeof(*state->attachments) * pass->attachment_count); state->attachments = realloc(state->attachments, sizeof(*state->attachments) * attachment_count);
for (unsigned i = 0; i < state->pass->attachment_count; i++) { for (unsigned i = 0; i < attachment_count; i++) {
struct lvp_render_pass_attachment *att = &pass->attachments[i]; struct lvp_render_pass_attachment *att = &pass->attachments[i];
VkImageAspectFlags att_aspects = vk_format_aspects(att->format); VkImageAspectFlags att_aspects = vk_format_aspects(att->format);
VkImageAspectFlags clear_aspects = 0; VkImageAspectFlags clear_aspects = 0;