anv: More carefully dirty state in BindDescriptorSets

Instead of dirtying all graphics or all compute based on binding point,
we're now much more careful.  We first check to see if the actual
descriptor set changed and then only dirty the stages used by that
descriptor set.  For dynamic offsets, we keep a bitfield per-stage of
which offsets are actually used in that stage and we only dirty push
constants and descriptors if that stage has dynamic offsets AND those
offsets actually change.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
This commit is contained in:
Jason Ekstrand
2019-11-07 11:44:08 -06:00
parent ca8117b5d5
commit 22f16ff54a
4 changed files with 51 additions and 22 deletions

View File

@@ -469,7 +469,15 @@ VkResult anv_CreateDescriptorSetLayout(
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
set_layout->binding[b].dynamic_offset_index = dynamic_offset_count;
anv_foreach_stage(s, binding->stageFlags) {
STATIC_ASSERT(MAX_DYNAMIC_BUFFERS <=
sizeof(set_layout->stage_dynamic_offsets[s]) * 8);
set_layout->stage_dynamic_offsets[s] |=
BITFIELD_RANGE(set_layout->binding[b].dynamic_offset_index,
binding->descriptorCount);
}
dynamic_offset_count += binding->descriptorCount;
assert(dynamic_offset_count < MAX_DYNAMIC_BUFFERS);
break;
default:
@@ -603,6 +611,7 @@ VkResult anv_CreatePipelineLayout(
dynamic_offset_count += set_layout->binding[b].array_size;
}
}
assert(dynamic_offset_count < MAX_DYNAMIC_BUFFERS);
struct mesa_sha1 ctx;
_mesa_sha1_init(&ctx);