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

Side by Side Diff: tools/vulkan/VulkanTestContext.cpp

Issue 1865553005: Clean up input handling in VulkanViewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rename resize params 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 unified diff | Download patch
« no previous file with comments | « tools/vulkan/VulkanTestContext.h ('k') | tools/vulkan/Window.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrContext.h" 9 #include "GrContext.h"
10 #include "SkSurface.h" 10 #include "SkSurface.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 VkResult res = GR_VK_CALL(fBackendContext->fInterface, 72 VkResult res = GR_VK_CALL(fBackendContext->fInterface,
73 GetPhysicalDeviceSurfaceSupportKHR(fBackendContext ->fPhysicalDevice, 73 GetPhysicalDeviceSurfaceSupportKHR(fBackendContext ->fPhysicalDevice,
74 fPresentQueueIn dex, 74 fPresentQueueIn dex,
75 fSurface, 75 fSurface,
76 &supported)); 76 &supported));
77 if (VK_SUCCESS != res) { 77 if (VK_SUCCESS != res) {
78 this->destroyContext(); 78 this->destroyContext();
79 return; 79 return;
80 } 80 }
81 81
82 // get this info from somewhere? 82 if (!this->createSwapchain(-1, -1)) {
83 if (!this->createSwapchain(1024, 768)) {
84 this->destroyContext(); 83 this->destroyContext();
85 return; 84 return;
86 } 85 }
87 86
88 // create presentQueue 87 // create presentQueue
89 vkGetDeviceQueue(fBackendContext->fDevice, fPresentQueueIndex, 0, &fPresentQ ueue); 88 vkGetDeviceQueue(fBackendContext->fDevice, fPresentQueueIndex, 0, &fPresentQ ueue);
90 89
91 90
92 } 91 }
93 92
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 return false; 144 return false;
146 } 145 }
147 146
148 VkExtent2D extent = caps.currentExtent; 147 VkExtent2D extent = caps.currentExtent;
149 // use the hints 148 // use the hints
150 if (extent.width == (uint32_t)-1) { 149 if (extent.width == (uint32_t)-1) {
151 extent.width = width; 150 extent.width = width;
152 extent.height = height; 151 extent.height = height;
153 } 152 }
154 153
155 // clamp width; to protect us from broken hints? 154 // clamp width; to protect us from broken hints
156 if (extent.width < caps.minImageExtent.width) { 155 if (extent.width < caps.minImageExtent.width) {
157 extent.width = caps.minImageExtent.width; 156 extent.width = caps.minImageExtent.width;
158 } else if (extent.width > caps.maxImageExtent.width) { 157 } else if (extent.width > caps.maxImageExtent.width) {
159 extent.width = caps.maxImageExtent.width; 158 extent.width = caps.maxImageExtent.width;
160 } 159 }
161 // clamp height 160 // clamp height
162 if (extent.height < caps.minImageExtent.height) { 161 if (extent.height < caps.minImageExtent.height) {
163 extent.height = caps.minImageExtent.height; 162 extent.height = caps.minImageExtent.height;
164 } else if (extent.height > caps.maxImageExtent.height) { 163 } else if (extent.height > caps.maxImageExtent.height) {
165 extent.height = caps.maxImageExtent.height; 164 extent.height = caps.maxImageExtent.height;
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 1, // swapchainCount 595 1, // swapchainCount
597 &fSwapchain, // pSwapchains 596 &fSwapchain, // pSwapchains
598 &backbuffer->fImageIndex, // pImageIndices 597 &backbuffer->fImageIndex, // pImageIndices
599 NULL // pResults 598 NULL // pResults
600 }; 599 };
601 600
602 GR_VK_CALL_ERRCHECK(fBackendContext->fInterface, 601 GR_VK_CALL_ERRCHECK(fBackendContext->fInterface,
603 QueuePresentKHR(fPresentQueue, &presentInfo)); 602 QueuePresentKHR(fPresentQueue, &presentInfo));
604 603
605 } 604 }
OLDNEW
« no previous file with comments | « tools/vulkan/VulkanTestContext.h ('k') | tools/vulkan/Window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698