Refactor GPU tick waiting and barrier handling
This commit is contained in:
parent
9c685c1449
commit
50b35fbeed
|
|
@ -347,7 +347,7 @@ void Scheduler::EndRenderPass()
|
|||
Record([num_images = num_renderpass_images,
|
||||
images = renderpass_images,
|
||||
ranges = renderpass_image_ranges](vk::CommandBuffer cmdbuf) {
|
||||
std::array<VkImageMemoryBarrier, 9> barriers;
|
||||
std::vector<VkImageMemoryBarrier> barriers(num_images);
|
||||
VkPipelineStageFlags src_stages = 0;
|
||||
for (size_t i = 0; i < num_images; ++i) {
|
||||
const VkImageSubresourceRange& range = ranges[i];
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ public:
|
|||
|
||||
/// Waits for the given tick to trigger on the GPU.
|
||||
void Wait(u64 tick) {
|
||||
if (tick >= master_semaphore->CurrentTick()) {
|
||||
if (tick > master_semaphore->CurrentTick() && !chunk->Empty()) {
|
||||
// Make sure we are not waiting for the current tick without signalling
|
||||
Flush();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,7 +194,10 @@ bool Swapchain::AcquireNextImage() {
|
|||
break;
|
||||
}
|
||||
|
||||
scheduler.Wait(resource_ticks[image_index]);
|
||||
if (resource_ticks[image_index] != 0 && !scheduler.IsFree(resource_ticks[image_index])) {
|
||||
scheduler.Wait(resource_ticks[image_index]);
|
||||
}
|
||||
|
||||
resource_ticks[image_index] = scheduler.CurrentTick();
|
||||
|
||||
return is_suboptimal || is_outdated;
|
||||
|
|
|
|||
Loading…
Reference in New Issue