|
|
|
@ -96,6 +96,7 @@ VkDescriptorSet DescriptorAllocator::Commit() { |
|
|
|
const size_t index = CommitResource(); |
|
|
|
return sets[index / SETS_GROW_RATE][index % SETS_GROW_RATE]; |
|
|
|
} |
|
|
|
|
|
|
|
VkDescriptorSet DescriptorAllocator::CommitWithTracking(u64 current_frame, const void* descriptor_data) { |
|
|
|
const size_t index = CommitResource(); |
|
|
|
const size_t group = index / SETS_GROW_RATE; |
|
|
|
@ -105,17 +106,15 @@ VkDescriptorSet DescriptorAllocator::CommitWithTracking(u64 current_frame, const |
|
|
|
set_states[group][slot].last_data_ptr = descriptor_data; |
|
|
|
return set_states[group][slot].set; |
|
|
|
} |
|
|
|
|
|
|
|
bool DescriptorAllocator::NeedsUpdate(VkDescriptorSet set, u64 current_frame, const void* descriptor_data) const { |
|
|
|
for (const auto& group : set_states) { |
|
|
|
for (const auto& st : group) { |
|
|
|
if (st.set == set) { |
|
|
|
// Update if pointer changed or the set hasn't been updated this frame
|
|
|
|
for (const auto& group : set_states) |
|
|
|
for (const auto& st : group) |
|
|
|
if (st.set == set) // Update if pointer changed or the set hasn't been updated this frame
|
|
|
|
return st.last_data_ptr != descriptor_data || st.last_update_frame != current_frame; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
void DescriptorAllocator::Allocate(size_t begin, size_t end) { |
|
|
|
const size_t count = end - begin; |
|
|
|
sets.push_back(AllocateDescriptors(count)); |
|
|
|
|