diff options
author | Bas Nieuwenhuizen <[email protected]> | 2018-09-16 02:17:32 +0200 |
---|---|---|
committer | Bas Nieuwenhuizen <[email protected]> | 2018-09-16 12:50:19 +0200 |
commit | 02a43edf186cb9998741ba765cb948bb238a122d (patch) | |
tree | f797e773966eda763b2206262caa0f32bd5a69c4 | |
parent | 14976817f4dbd089dc6ea1897d7006b94f30580d (diff) |
radv: Optimize rebinding the same descriptor set.
This makes it cheaper to just change the dynamic offsets with
the same descriptor sets.
Suggested-by: Philip Rebohle <[email protected]>
Reviewed-by: Samuel Pitoiset <[email protected]>
-rw-r--r-- | src/amd/vulkan/radv_cmd_buffer.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index d492456d6b8..2f168321197 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -2464,7 +2464,13 @@ void radv_CmdBindDescriptorSets( for (unsigned i = 0; i < descriptorSetCount; ++i) { unsigned idx = i + firstSet; RADV_FROM_HANDLE(radv_descriptor_set, set, pDescriptorSets[i]); - radv_bind_descriptor_set(cmd_buffer, pipelineBindPoint, set, idx); + + /* If the set is already bound we only need to update the + * (potentially changed) dynamic offsets. */ + if (descriptors_state->sets[idx] != set || + !(descriptors_state->valid & (1u << idx))) { + radv_bind_descriptor_set(cmd_buffer, pipelineBindPoint, set, idx); + } for(unsigned j = 0; j < set->layout->dynamic_offset_count; ++j, ++dyn_idx) { unsigned idx = j + layout->set[i + firstSet].dynamic_offset_start; |