v3dv: add a dirty state for pending push constants UBO updates

If we have 2 pipelines that consume the same push constant data
but where one of them only uses direct access and the other has
indirect access, a draw with the first pipeline would clear the
dirty flag without updating the UBO and by the time we bind and
draw with the second pipeline we won't upload the constants either
because the first draw cleared the dirty flag.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17536>
This commit is contained in:
Iago Toral Quiroga 2022-07-15 05:01:22 +02:00 committed by Marge Bot
parent 3898bf6971
commit 702b685b07
3 changed files with 11 additions and 9 deletions

View file

@ -3102,7 +3102,8 @@ v3dv_CmdPushConstants(VkCommandBuffer commandBuffer,
cmd_buffer->state.push_constants_size =
MAX2(offset + size, cmd_buffer->state.push_constants_size);
cmd_buffer->state.dirty |= V3DV_CMD_DIRTY_PUSH_CONSTANTS;
cmd_buffer->state.dirty |= V3DV_CMD_DIRTY_PUSH_CONSTANTS |
V3DV_CMD_DIRTY_PUSH_CONSTANTS_UBO;
cmd_buffer->state.dirty_push_constants_stages |= stageFlags;
}

View file

@ -885,12 +885,13 @@ enum v3dv_cmd_dirty_bits {
V3DV_CMD_DIRTY_DESCRIPTOR_SETS = 1 << 9,
V3DV_CMD_DIRTY_COMPUTE_DESCRIPTOR_SETS = 1 << 10,
V3DV_CMD_DIRTY_PUSH_CONSTANTS = 1 << 11,
V3DV_CMD_DIRTY_BLEND_CONSTANTS = 1 << 12,
V3DV_CMD_DIRTY_OCCLUSION_QUERY = 1 << 13,
V3DV_CMD_DIRTY_DEPTH_BIAS = 1 << 14,
V3DV_CMD_DIRTY_LINE_WIDTH = 1 << 15,
V3DV_CMD_DIRTY_VIEW_INDEX = 1 << 16,
V3DV_CMD_DIRTY_COLOR_WRITE_ENABLE = 1 << 17,
V3DV_CMD_DIRTY_PUSH_CONSTANTS_UBO = 1 << 12,
V3DV_CMD_DIRTY_BLEND_CONSTANTS = 1 << 13,
V3DV_CMD_DIRTY_OCCLUSION_QUERY = 1 << 14,
V3DV_CMD_DIRTY_DEPTH_BIAS = 1 << 15,
V3DV_CMD_DIRTY_LINE_WIDTH = 1 << 16,
V3DV_CMD_DIRTY_VIEW_INDEX = 1 << 17,
V3DV_CMD_DIRTY_COLOR_WRITE_ENABLE = 1 << 18,
};
struct v3dv_dynamic_state {

View file

@ -94,7 +94,7 @@ static void
check_push_constants_ubo(struct v3dv_cmd_buffer *cmd_buffer,
struct v3dv_pipeline *pipeline)
{
if (!(cmd_buffer->state.dirty & V3DV_CMD_DIRTY_PUSH_CONSTANTS) ||
if (!(cmd_buffer->state.dirty & V3DV_CMD_DIRTY_PUSH_CONSTANTS_UBO) ||
pipeline->layout->push_constant_size == 0)
return;
@ -146,7 +146,7 @@ check_push_constants_ubo(struct v3dv_cmd_buffer *cmd_buffer,
cmd_buffer->state.push_constants_data,
cmd_buffer->state.push_constants_size);
cmd_buffer->state.dirty &= ~V3DV_CMD_DIRTY_PUSH_CONSTANTS;
cmd_buffer->state.dirty &= ~V3DV_CMD_DIRTY_PUSH_CONSTANTS_UBO;
}
/** V3D 4.x TMU configuration parameter 0 (texture) */