Fix failing assert in swapchain_base.cpp
authorDennis Tsiang <dennis.tsiang@arm.com>
Tue, 27 Oct 2020 11:12:00 +0000 (11:12 +0000)
committerDennis Tsiang <dennis.tsiang@arm.com>
Tue, 27 Oct 2020 11:12:00 +0000 (11:12 +0000)
Erroneous assert was left in swapchain_base.cpp after some refactoring
was done. This commit removes the assert and updates the CMakeLists.txt
file to turn on compiler warnings so that developers can spot these
leftover code earlier.

Change-Id: I7f4051c89a86f21f66f20b0e92f01bc101436c71
Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
CMakeLists.txt
wsi/swapchain_base.cpp

index 5fcb072633666fea103995ee1f56f083ae44f378..5fd1cd203cafd374e2b729e400dae121c227addc 100644 (file)
@@ -27,7 +27,7 @@ find_package(PkgConfig REQUIRED)
 pkg_check_modules(VULKAN_PKG_CONFIG vulkan)
 
 # Disable C++ exceptions.
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -Wall")
 
 if(NOT DEFINED VULKAN_CXX_INCLUDE)
    set(VULKAN_CXX_INCLUDE ${VULKAN_PKG_CONFIG_INCLUDEDIR})
index 5ef1654e2d48d4342e3a5d7ad9f63347df01e22f..a35efcff9879b3f14e3864222c3aabc44285a76b 100644 (file)
@@ -136,6 +136,7 @@ void swapchain_base::unpresent_image(uint32_t presented_index)
 
 swapchain_base::swapchain_base(layer::device_private_data &dev_data, const VkAllocationCallbacks *allocator)
    : m_device_data(dev_data)
+   , m_page_flip_thread_run(true)
    , m_thread_sem_defined(false)
    , m_first_present(true)
    , m_pending_buffer_pool{ nullptr, 0, 0, 0 }
@@ -148,7 +149,6 @@ swapchain_base::swapchain_base(layer::device_private_data &dev_data, const VkAll
    , m_ancestor(VK_NULL_HANDLE)
    , m_device(VK_NULL_HANDLE)
    , m_queue(VK_NULL_HANDLE)
-   , m_page_flip_thread_run(true)
 {
 }
 
@@ -283,13 +283,6 @@ VkResult swapchain_base::init(VkDevice device, const VkSwapchainCreateInfoKHR *s
       return result;
    }
 
-   /* Only programming error can cause this to fail. */
-   assert(res == 0);
-   if (res != 0)
-   {
-      return VK_ERROR_OUT_OF_HOST_MEMORY;
-   }
-
    res = sem_init(&m_start_present_semaphore, 0, 0);
    /* Only programming error can cause this to fail. */
    assert(res == 0);