mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-29 12:55:30 +03:00
Reorder active descriptor set slots to end of list
Speeds up allocations by significantly reducing the number of needed atomic ops per alloc. Could be optimised further in the future if needed.
This commit is contained in:
parent
128b68d8b2
commit
f3184cdff1
@ -94,9 +94,13 @@ namespace skyline::gpu {
|
|||||||
vk::Result lastResult{};
|
vk::Result lastResult{};
|
||||||
if (it != pool->layoutSlots.end()) {
|
if (it != pool->layoutSlots.end()) {
|
||||||
auto &slots{it->second};
|
auto &slots{it->second};
|
||||||
for (auto &slot : it->second)
|
for (auto slotIt{it->second.begin()} ; slotIt != it->second.end() ; slotIt++) {
|
||||||
if (!slot.active.test_and_set(std::memory_order_acq_rel))
|
if (!slotIt->active.test_and_set(std::memory_order_acq_rel)) {
|
||||||
return ActiveDescriptorSet{pool, &slot};
|
// Move active slots to end of list to reduce search time
|
||||||
|
it->second.splice(it->second.end(), it->second, slotIt);
|
||||||
|
return ActiveDescriptorSet{pool, &*slotIt};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If we couldn't find an available slot, we need to allocate a new one
|
// If we couldn't find an available slot, we need to allocate a new one
|
||||||
auto set{AllocateVkDescriptorSet(layout)};
|
auto set{AllocateVkDescriptorSet(layout)};
|
||||||
|
Loading…
Reference in New Issue
Block a user