lavapipe: unbreak imageless framebuffer

vk cmd queue doesn't copy pNext pointers

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12688>
This commit is contained in:
Mike Blumenkrantz 2021-09-01 21:13:38 -04:00
parent 97aa90dec2
commit c679dbe09c
3 changed files with 49 additions and 2 deletions

View file

@ -257,6 +257,51 @@ VKAPI_ATTR void VKAPI_CALL lvp_TrimCommandPool(
}
}
VKAPI_ATTR void VKAPI_CALL lvp_CmdBeginRenderPass2(
VkCommandBuffer commandBuffer,
const VkRenderPassBeginInfo* pRenderPassBeginInfo,
const VkSubpassBeginInfo* pSubpassBeginInfo)
{
LVP_FROM_HANDLE(lvp_cmd_buffer, cmd_buffer, commandBuffer);
const struct VkRenderPassAttachmentBeginInfo *attachment_info =
vk_find_struct_const(pRenderPassBeginInfo->pNext,
RENDER_PASS_ATTACHMENT_BEGIN_INFO);
struct vk_cmd_queue_entry *cmd = vk_zalloc(cmd_buffer->queue.alloc,
sizeof(*cmd), 8,
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
if (!cmd)
return;
cmd->type = VK_CMD_BEGIN_RENDER_PASS2;
list_addtail(&cmd->cmd_link, &cmd_buffer->queue.cmds);
if (pRenderPassBeginInfo) {
cmd->u.begin_render_pass2.render_pass_begin = vk_zalloc(cmd_buffer->queue.alloc, sizeof(*cmd->u.begin_render_pass2.render_pass_begin), 8, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
memcpy(cmd->u.begin_render_pass2.render_pass_begin, pRenderPassBeginInfo, sizeof(*cmd->u.begin_render_pass2.render_pass_begin));
cmd->u.begin_render_pass2.render_pass_begin->pClearValues = vk_zalloc(cmd_buffer->queue.alloc, sizeof(*cmd->u.begin_render_pass2.render_pass_begin->pClearValues) * cmd->u.begin_render_pass2.render_pass_begin->clearValueCount, 8, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
memcpy(( VkClearValue* )cmd->u.begin_render_pass2.render_pass_begin->pClearValues, pRenderPassBeginInfo->pClearValues, sizeof(*cmd->u.begin_render_pass2.render_pass_begin->pClearValues) * cmd->u.begin_render_pass2.render_pass_begin->clearValueCount);
if (attachment_info) {
VkRenderPassAttachmentBeginInfo *att = malloc(sizeof(VkRenderPassAttachmentBeginInfo) + attachment_info->attachmentCount * sizeof(void*));
att->sType = VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO;
att->attachmentCount = attachment_info->attachmentCount;
/* I hate everything. */
att->pAttachments = (void*)((uint8_t*)att + sizeof(VkRenderPassAttachmentBeginInfo));
memcpy((void*)att->pAttachments, attachment_info->pAttachments, att->attachmentCount * sizeof(void*));
att->pNext = NULL;
cmd->u.begin_render_pass2.render_pass_begin->pNext = att;
}
} else {
cmd->u.begin_render_pass2.render_pass_begin = NULL;
}
if (pSubpassBeginInfo) {
cmd->u.begin_render_pass2.subpass_begin_info = vk_zalloc(cmd_buffer->queue.alloc, sizeof(*cmd->u.begin_render_pass2.subpass_begin_info), 8, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
memcpy(cmd->u.begin_render_pass2.subpass_begin_info, pSubpassBeginInfo, sizeof(*cmd->u.begin_render_pass2.subpass_begin_info));
} else {
cmd->u.begin_render_pass2.subpass_begin_info = NULL;
}
}
VKAPI_ATTR void VKAPI_CALL lvp_CmdDrawMultiEXT(
VkCommandBuffer commandBuffer,
uint32_t drawCount,

View file

@ -1710,7 +1710,7 @@ static void begin_render_pass(const VkRenderPassBeginInfo *render_pass_begin,
{
LVP_FROM_HANDLE(lvp_render_pass, pass, render_pass_begin->renderPass);
LVP_FROM_HANDLE(lvp_framebuffer, framebuffer, render_pass_begin->framebuffer);
const struct VkRenderPassAttachmentBeginInfo *attachment_info =
VkRenderPassAttachmentBeginInfo *attachment_info = (void*)
vk_find_struct_const(render_pass_begin->pNext,
RENDER_PASS_ATTACHMENT_BEGIN_INFO);
@ -1766,9 +1766,9 @@ static void begin_render_pass(const VkRenderPassBeginInfo *render_pass_begin,
state->cleared_views[i] = 0;
}
begin_render_subpass(state, 0);
free(attachment_info);
}
static void handle_begin_render_pass(struct vk_cmd_queue_entry *cmd,
struct rendering_state *state)
{

View file

@ -48,6 +48,8 @@ MANUAL_COMMANDS = ['CmdPushDescriptorSetKHR', # This script doesn't
'CmdCopyImageToBuffer',
'CmdBlitImage',
'CmdResolveImage',
'CmdBeginRenderPass', #pNext copying isn't handled
'CmdBeginRenderPass2', #pNext copying isn't handled
]
TEMPLATE_C = Template(COPYRIGHT + """