Skip to content

Commit

Permalink
Avoid doing redundant work in descriptor allocators on begin_frame().
Browse files Browse the repository at this point in the history
  • Loading branch information
Themaister committed Jul 18, 2024
1 parent 4afe25d commit 1ad330e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions vulkan/descriptor_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,14 @@ void DescriptorSetAllocator::begin_frame()
{
if (!bindless)
{
for (auto &thr : per_thread_and_frame)
thr.offset = 0;

// This can only be called in a situation where no command buffers are alive,
// so we don't need to consider any locks here.
if (device->per_frame.size() * device->num_thread_indices != per_thread_and_frame.size())
per_thread_and_frame.resize(device->per_frame.size() * device->num_thread_indices);

// It would be safe to set all offsets to 0 here, but that's a little wasteful.
for (uint32_t i = 0; i < device->num_thread_indices; i++)
per_thread_and_frame[i * device->per_frame.size() + device->frame_context_index].offset = 0;
}
}

Expand Down

0 comments on commit 1ad330e

Please sign in to comment.