tri/cube: Correct WSI swapChainPresentMode fallback is FIFO.
A copy and paste error from the spec made it seem that all ICDs will support
VK_PRESENT_MODE_IMMEDIATE_WSI (a.k.a. "immediate"). That's not true. They all
need to support VK_PRESENT_MODE_FIFO_WSI. Changed the comment and code so that
the preference of these demos is:
1) VK_PRESENT_MODE_MAILBOX_WSI
2) VK_PRESENT_MODE_IMMEDIATE_WSI
3) VK_PRESENT_MODE_FIFO_WSI
diff --git a/demos/cube.c b/demos/cube.c
index d8038cf..0c760c2 100644
--- a/demos/cube.c
+++ b/demos/cube.c
@@ -670,15 +670,20 @@
}
// If mailbox mode is available, use it, as is the lowest-latency non-
- // tearing mode. If not, fall back to IMMEDIATE which should always be
- // available.
- VkPresentModeWSI swapChainPresentMode = VK_PRESENT_MODE_IMMEDIATE_WSI;
+ // tearing mode. If not, try IMMEDIATE which will usually be available,
+ // and is fastest (though it tears). If not, fall back to FIFO which is
+ // always available.
+ VkPresentModeWSI swapChainPresentMode = VK_PRESENT_MODE_FIFO_WSI;
size_t presentModeCount = presentModesSize / sizeof(VkSurfacePresentModePropertiesWSI);
for (size_t i = 0; i < presentModeCount; i++) {
if (presentModes[i].presentMode == VK_PRESENT_MODE_MAILBOX_WSI) {
swapChainPresentMode = VK_PRESENT_MODE_MAILBOX_WSI;
break;
}
+ if ((swapChainPresentMode != VK_PRESENT_MODE_MAILBOX_WSI) &&
+ (presentModes[i].presentMode == VK_PRESENT_MODE_IMMEDIATE_WSI)) {
+ swapChainPresentMode = VK_PRESENT_MODE_IMMEDIATE_WSI;
+ }
}
#define WORK_AROUND_CODE