Vulkan CP / Render Cache: Proper synchronization barriers for transfer

Use an event rather than a semaphore for swap
Update some calculations in IssueCopy TextureInfo
This commit is contained in:
Dr. Chat
2017-03-13 18:03:33 -05:00
parent 0c2e0e4119
commit 5f5dc61428
3 changed files with 90 additions and 62 deletions

View File

@@ -243,9 +243,19 @@ void VulkanGraphicsSystem::Swap(xe::ui::UIEvent* e) {
auto& swap_state = command_processor_->swap_state();
{
std::lock_guard<std::mutex> lock(swap_state.mutex);
if (swap_state.pending) {
swap_state.pending = false;
if (!swap_state.pending) {
// return;
}
auto event = reinterpret_cast<VkEvent>(swap_state.backend_data);
VkResult status = vkGetEventStatus(*device_, event);
if (status != VK_EVENT_SET) {
// The device has not finished processing the image.
// return;
}
vkResetEvent(*device_, event);
swap_state.pending = false;
}
if (!swap_state.front_buffer_texture) {
@@ -253,7 +263,6 @@ void VulkanGraphicsSystem::Swap(xe::ui::UIEvent* e) {
return;
}
auto semaphore = reinterpret_cast<VkSemaphore>(swap_state.backend_data);
auto swap_chain = display_context_->swap_chain();
auto copy_cmd_buffer = swap_chain->copy_cmd_buffer();
auto front_buffer =