Skip to content
Snippets Groups Projects
Verified Commit d2cb0e20 authored by Tobias Frisch's avatar Tobias Frisch
Browse files

[#82] Fixed crash because of suboptimal images

parent a3ccbd6d
No related branches found
No related tags found
1 merge request!70Resolve "Voxel cone tracing"
Pipeline #26106 passed
...@@ -123,7 +123,6 @@ namespace vkcv ...@@ -123,7 +123,6 @@ namespace vkcv
Result Core::acquireSwapchainImage() { Result Core::acquireSwapchainImage() {
uint32_t imageIndex; uint32_t imageIndex;
vk::Result result; vk::Result result;
try { try {
...@@ -140,9 +139,14 @@ namespace vkcv ...@@ -140,9 +139,14 @@ namespace vkcv
result = vk::Result::eErrorDeviceLost; result = vk::Result::eErrorDeviceLost;
} }
if (result != vk::Result::eSuccess) { if ((result != vk::Result::eSuccess) &&
(result != vk::Result::eSuboptimalKHR)) {
vkcv_log(LogLevel::ERROR, "%s", vk::to_string(result).c_str()); vkcv_log(LogLevel::ERROR, "%s", vk::to_string(result).c_str());
return Result::ERROR; return Result::ERROR;
} else
if (result == vk::Result::eSuboptimalKHR) {
vkcv_log(LogLevel::WARNING, "Acquired image is suboptimal");
m_swapchain.signalSwapchainRecreation();
} }
m_currentSwapchainImageIndex = imageIndex; m_currentSwapchainImageIndex = imageIndex;
...@@ -373,8 +377,13 @@ namespace vkcv ...@@ -373,8 +377,13 @@ namespace vkcv
result = vk::Result::eErrorDeviceLost; result = vk::Result::eErrorDeviceLost;
} }
if (result != vk::Result::eSuccess) { if ((result != vk::Result::eSuccess) &&
vkcv_log(LogLevel::ERROR, "Swapchain present failed (%s)", vk::to_string(result).c_str()); (result != vk::Result::eSuboptimalKHR)) {
vkcv_log(LogLevel::ERROR, "Swapchain presentation failed (%s)", vk::to_string(result).c_str());
} else
if (result == vk::Result::eSuboptimalKHR) {
vkcv_log(LogLevel::WARNING, "Swapchain presentation is suboptimal");
m_swapchain.signalSwapchainRecreation();
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment