From 9c99627ba6bbcef4a9f133f5ae8e73399a975661 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Mon, 18 Sep 2017 23:39:53 -0700 Subject: [PATCH] write present mode fallback messages only once --- src/vulkan_icd/x11_wsi.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/vulkan_icd/x11_wsi.cpp b/src/vulkan_icd/x11_wsi.cpp index 82c76ee..5166f43 100644 --- a/src/vulkan_icd/x11_wsi.cpp +++ b/src/vulkan_icd/x11_wsi.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include "util/optional.h" #include "util/circular_queue.h" @@ -552,14 +553,26 @@ struct Xcb_wsi::Implementation case VK_PRESENT_MODE_IMMEDIATE_KHR: break; case VK_PRESENT_MODE_FIFO_KHR: - warning_message_present_mode_name = "FIFO"; + { + static std::atomic_bool wrote_warning_message(false); + if(!wrote_warning_message.exchange(true, std::memory_order_relaxed)) + warning_message_present_mode_name = "FIFO"; break; + } case VK_PRESENT_MODE_MAILBOX_KHR: - warning_message_present_mode_name = "MAILBOX"; + { + static std::atomic_bool wrote_warning_message(false); + if(!wrote_warning_message.exchange(true, std::memory_order_relaxed)) + warning_message_present_mode_name = "MAILBOX"; break; + } case VK_PRESENT_MODE_FIFO_RELAXED_KHR: - warning_message_present_mode_name = "FIFO_RELAXED"; + { + static std::atomic_bool wrote_warning_message(false); + if(!wrote_warning_message.exchange(true, std::memory_order_relaxed)) + warning_message_present_mode_name = "FIFO_RELAXED"; break; + } case VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR: case VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR: case VK_PRESENT_MODE_RANGE_SIZE_KHR: -- 2.30.2