aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Elliott <ian@LunarG.com>2015-07-27 13:53:11 -0600
committerIan Elliott <ian@LunarG.com>2015-07-27 13:56:40 -0600
commit3ebce34f0b75d0e7e5ead494cfe3b7e8b51a1824 (patch)
tree4785a113ba1e6d0727a09a6a8150fe514f5b57fa
parentb0b768d09c6df78575b60e61fd2eb457243edea0 (diff)
downloadusermoji-3ebce34f0b75d0e7e5ead494cfe3b7e8b51a1824.tar.xz
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
-rw-r--r--demos/cube.c11
-rw-r--r--demos/tri.c11
2 files changed, 16 insertions, 6 deletions
diff --git a/demos/cube.c b/demos/cube.c
index d8038cfb..0c760c2b 100644
--- a/demos/cube.c
+++ b/demos/cube.c
@@ -670,15 +670,20 @@ static void demo_prepare_buffers(struct demo *demo)
}
// 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
diff --git a/demos/tri.c b/demos/tri.c
index 20720b89..7580c997 100644
--- a/demos/tri.c
+++ b/demos/tri.c
@@ -489,15 +489,20 @@ static void demo_prepare_buffers(struct demo *demo)
}
// 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;
+ }
}
// Determine the number of VkImage's to use in the swap chain (we desire to