Changes to move the functional code outside of assert() call

This commit is contained in:
Ginu Jacob 2024-10-29 08:49:31 +00:00 committed by Dennis Tsiang
parent 0f5f241337
commit bbac6f52cf
2 changed files with 14 additions and 5 deletions

View file

@ -55,7 +55,7 @@ external_memory::~external_memory()
else if (m_buffer_fds[plane] >= 0)
{
auto it = std::find(std::begin(m_buffer_fds), std::end(m_buffer_fds), m_buffer_fds[plane]);
if (std::distance(std::begin(m_buffer_fds), it) == plane)
if (std::distance(std::begin(m_buffer_fds), it) == static_cast<int>(plane))
{
close(m_buffer_fds[plane]);
}
@ -108,7 +108,7 @@ VkResult external_memory::import_plane_memories()
for (uint32_t plane = 0; plane < get_num_planes(); plane++)
{
auto it = std::find(std::begin(m_buffer_fds), std::end(m_buffer_fds), m_buffer_fds[plane]);
if (std::distance(std::begin(m_buffer_fds), it) == plane)
if (std::distance(std::begin(m_buffer_fds), it) == static_cast<int>(plane))
{
TRY_LOG_CALL(import_plane_memory(m_buffer_fds[plane], &m_memories[memory_plane]));
memory_plane++;

View file

@ -276,8 +276,13 @@ VkResult swapchain_base::handle_swapchain_present_modes_create_info(
assert(props != nullptr);
for (uint32_t i = 0; i < swapchain_present_modes_create_info->presentModeCount; i++)
{
assert(
props->is_compatible_present_modes(m_present_mode, swapchain_present_modes_create_info->pPresentModes[i]));
auto res =
props->is_compatible_present_modes(m_present_mode, swapchain_present_modes_create_info->pPresentModes[i]);
if (!res)
{
WSI_LOG_ERROR("present modes incompatible");
return VK_ERROR_INITIALIZATION_FAILED;
}
m_present_modes[i] = swapchain_present_modes_create_info->pPresentModes[i];
}
}
@ -851,7 +856,11 @@ VkResult swapchain_base::handle_switching_presentation_mode(VkPresentModeKHR swa
assert(m_present_modes.size() > 0);
auto it = std::find_if(m_present_modes.begin(), m_present_modes.end(),
[swapchain_present_mode](VkPresentModeKHR p) { return p == swapchain_present_mode; });
assert(it != m_present_modes.end());
if (it == m_present_modes.end())
{
WSI_LOG_ERROR("unable to switch presentation mode");
return VK_ERROR_SURFACE_LOST_KHR;
}
m_present_mode = swapchain_present_mode;
return VK_SUCCESS;
}