From 18fc1dfea386b4c2235b477adde801ea2a393176 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 20 Jan 2021 11:35:17 -0600 Subject: [PATCH] anv: Only flush descriptors used by the pipeline Previously, if we had a pipeline transition from something which used, say, tessellation to something which didn't and we ended up with tessellation descriptors dirty, we could end up re-emitting far more than necessary. With this commit, we mask off unused stages so we only update when necessary. Tested-By: Mike Blumenkrantz Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/vulkan/genX_cmd_buffer.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index cb6ca7d3284..d04f47b2f5f 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -3594,9 +3594,12 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer) } #endif + uint32_t descriptors_dirty = cmd_buffer->state.descriptors_dirty & + pipeline->active_stages; + /* Render targets live in the same binding table as fragment descriptors */ if (cmd_buffer->state.gfx.dirty & ANV_CMD_DIRTY_RENDER_TARGETS) - cmd_buffer->state.descriptors_dirty |= VK_SHADER_STAGE_FRAGMENT_BIT; + descriptors_dirty |= VK_SHADER_STAGE_FRAGMENT_BIT; /* We emit the binding tables and sampler tables first, then emit push * constants and then finally emit binding table and sampler table @@ -3606,10 +3609,10 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer) * 3DSTATE_BINDING_TABLE_POINTER_* for the push constants to take effect. */ uint32_t dirty = 0; - if (cmd_buffer->state.descriptors_dirty) { + if (descriptors_dirty) { dirty = flush_descriptor_sets(cmd_buffer, &cmd_buffer->state.gfx.base, - cmd_buffer->state.descriptors_dirty, + descriptors_dirty, pipeline->shaders, ARRAY_SIZE(pipeline->shaders)); cmd_buffer->state.descriptors_dirty &= ~dirty;