Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(665)

Unified Diff: tools/vulkan/VulkanTestContext.cpp

Issue 1873453002: Some more improvements/fixes to the VulkanViewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/vulkan/Application.h ('k') | tools/vulkan/Window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/vulkan/VulkanTestContext.cpp
diff --git a/tools/vulkan/VulkanTestContext.cpp b/tools/vulkan/VulkanTestContext.cpp
index f9f037daecccde1f9c215f44ad1ffcaac19c07f8..05ebfe770d9198a02603c3a3ac89341a29121250 100644
--- a/tools/vulkan/VulkanTestContext.cpp
+++ b/tools/vulkan/VulkanTestContext.cpp
@@ -66,7 +66,7 @@ void VulkanTestContext::initializeContext(void* platformData) {
break;
}
}
- SkASSERT(0 <= fPresentQueueIndex && fPresentQueueIndex < queueCount);
+ SkASSERT(fPresentQueueIndex < queueCount);
VkBool32 supported;
VkResult res = GR_VK_CALL(fBackendContext->fInterface,
@@ -184,13 +184,14 @@ bool VulkanTestContext::createSwapchain(uint32_t width, uint32_t height)
VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR :
VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
- // FIFO is the only mode universally supported
+ // If mailbox mode is available, use it, as it is the lowest-latency non-
+ // tearing mode. If not, fall back to FIFO which is always available.
VkPresentModeKHR mode = VK_PRESENT_MODE_FIFO_KHR;
- bool vsync = false;
for (uint32_t i = 0; i < presentModeCount; ++i) {
- if ((vsync && VK_PRESENT_MODE_MAILBOX_KHR == presentModes[i]) ||
- (!vsync && VK_PRESENT_MODE_IMMEDIATE_KHR == presentModes[i])) {
+ // use mailbox
+ if (VK_PRESENT_MODE_MAILBOX_KHR == presentModes[i]) {
mode = presentModes[i];
+ break;
}
}
@@ -447,9 +448,10 @@ SkSurface* VulkanTestContext::getBackbufferSurface() {
&backbuffer->fImageIndex));
if (VK_ERROR_SURFACE_LOST_KHR == res) {
// need to figure out how to create a new vkSurface without the platformData*
+ // maybe use attach somehow? but need a Window
return nullptr;
}
- if (VK_ERROR_OUT_OF_DATE_KHR == res || VK_ERROR_SURFACE_LOST_KHR == res) {
+ if (VK_ERROR_OUT_OF_DATE_KHR == res) {
// tear swapchain down and try again
if (!this->createSwapchain(0, 0)) {
return nullptr;
« no previous file with comments | « tools/vulkan/Application.h ('k') | tools/vulkan/Window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698