vk_staging_buffer_pool: Inline tick tests
Load the current tick to a local variable, moving it out of an atomic and allowing us to compare the value without going through a pointer each time. This should make the loop more optimizable.
This commit is contained in:
parent
682d82faf3
commit
6171566296
|
@ -24,6 +24,11 @@ public:
|
|||
return current_tick;
|
||||
}
|
||||
|
||||
/// Returns the last known GPU tick.
|
||||
[[nodiscard]] u64 KnownGpuTick() const noexcept {
|
||||
return gpu_tick;
|
||||
}
|
||||
|
||||
/// Returns the timeline semaphore handle.
|
||||
[[nodiscard]] VkSemaphore Handle() const noexcept {
|
||||
return *semaphore;
|
||||
|
|
|
@ -175,8 +175,9 @@ StagingBufferRef StagingBufferPool::GetStreamBuffer(size_t size) {
|
|||
}
|
||||
|
||||
bool StagingBufferPool::AreRegionsActive(size_t region_begin, size_t region_end) const {
|
||||
const u64 gpu_tick = scheduler.GetMasterSemaphore().KnownGpuTick();
|
||||
return std::any_of(sync_ticks.begin() + region_begin, sync_ticks.begin() + region_end,
|
||||
[this](u64 sync_tick) { return !scheduler.IsFree(sync_tick); });
|
||||
[gpu_tick](u64 sync_tick) { return gpu_tick < sync_tick; });
|
||||
};
|
||||
|
||||
StagingBufferRef StagingBufferPool::GetStagingBuffer(size_t size, MemoryUsage usage) {
|
||||
|
|
Loading…
Reference in a new issue