v3dv: ignore barriers for image layout transitions from undefined layouts

Layout transitions are not relevant to us, we only care about barriers
that involve a sync point between read/write actions on the image across
GPU jobs.

Image transitions from undefined layout can only happen before the image
is ever used by the GPU, which means they are never relevant to our
implementation.

This improves performance in vkQuake.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16235>
This commit is contained in:
Iago Toral Quiroga 2022-04-26 09:28:59 +02:00
parent a44d498287
commit c9f68361a8
1 changed files with 13 additions and 0 deletions

View File

@ -2650,6 +2650,19 @@ v3dv_CmdPipelineBarrier(VkCommandBuffer commandBuffer,
{
V3DV_FROM_HANDLE(v3dv_cmd_buffer, cmd_buffer, commandBuffer);
/* We can safely skip barriers for image layout transitions from UNDEFINED
* layout.
*/
if (imageBarrierCount > 0) {
bool all_undefined = true;
for (int i = 0; all_undefined && i < imageBarrierCount; i++) {
if (pImageBarriers[i].oldLayout != VK_IMAGE_LAYOUT_UNDEFINED)
all_undefined = false;
}
if (all_undefined)
imageBarrierCount = 0;
}
if (memoryBarrierCount + bufferBarrierCount + imageBarrierCount == 0)
return;