blob: 379c1ed39023f8989b5171bbcfb4dc59eb86a6e3 [file] [log] [blame]
Jamie Madill9e54b5a2016-05-25 12:57:39 -04001//
2// Copyright 2016 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6// RendererVk.cpp:
7// Implements the class methods for RendererVk.
8//
9
10#include "libANGLE/renderer/vulkan/RendererVk.h"
11
Jamie Madill4d0bf552016-12-28 15:45:24 -050012// Placing this first seems to solve an intellisense bug.
13#include "libANGLE/renderer/vulkan/renderervk_utils.h"
14
Jamie Madille09bd5d2016-11-29 16:20:35 -050015#include <EGL/eglext.h>
16
Jamie Madill9e54b5a2016-05-25 12:57:39 -040017#include "common/debug.h"
Jamie Madill4d0bf552016-12-28 15:45:24 -050018#include "libANGLE/renderer/driver_utils.h"
Jamie Madille09bd5d2016-11-29 16:20:35 -050019#include "libANGLE/renderer/vulkan/CompilerVk.h"
20#include "libANGLE/renderer/vulkan/FramebufferVk.h"
21#include "libANGLE/renderer/vulkan/TextureVk.h"
22#include "libANGLE/renderer/vulkan/VertexArrayVk.h"
23#include "platform/Platform.h"
Jamie Madill9e54b5a2016-05-25 12:57:39 -040024
25namespace rx
26{
27
Jamie Madille09bd5d2016-11-29 16:20:35 -050028namespace
29{
30
31VkResult VerifyExtensionsPresent(const std::vector<VkExtensionProperties> &extensionProps,
32 const std::vector<const char *> &enabledExtensionNames)
33{
34 // Compile the extensions names into a set.
35 std::set<std::string> extensionNames;
36 for (const auto &extensionProp : extensionProps)
37 {
38 extensionNames.insert(extensionProp.extensionName);
39 }
40
41 for (const auto &extensionName : enabledExtensionNames)
42 {
43 if (extensionNames.count(extensionName) == 0)
44 {
45 return VK_ERROR_EXTENSION_NOT_PRESENT;
46 }
47 }
48
49 return VK_SUCCESS;
50}
51
Jamie Madill0448ec82016-12-23 13:41:47 -050052VkBool32 VKAPI_CALL DebugReportCallback(VkDebugReportFlagsEXT flags,
53 VkDebugReportObjectTypeEXT objectType,
54 uint64_t object,
55 size_t location,
56 int32_t messageCode,
57 const char *layerPrefix,
58 const char *message,
59 void *userData)
60{
61 if ((flags & VK_DEBUG_REPORT_ERROR_BIT_EXT) != 0)
62 {
63 ANGLEPlatformCurrent()->logError(message);
64#if !defined(NDEBUG)
65 // Abort the call in Debug builds.
66 return VK_TRUE;
67#endif
68 }
69 else if ((flags & VK_DEBUG_REPORT_WARNING_BIT_EXT) != 0)
70 {
71 ANGLEPlatformCurrent()->logWarning(message);
72 }
73 else
74 {
75 ANGLEPlatformCurrent()->logInfo(message);
76 }
77
78 return VK_FALSE;
79}
80
Jamie Madille09bd5d2016-11-29 16:20:35 -050081} // anonymous namespace
82
Jamie Madill0448ec82016-12-23 13:41:47 -050083RendererVk::RendererVk()
84 : mCapsInitialized(false),
85 mInstance(VK_NULL_HANDLE),
86 mEnableValidationLayers(false),
Jamie Madill4d0bf552016-12-28 15:45:24 -050087 mDebugReportCallback(VK_NULL_HANDLE),
88 mPhysicalDevice(VK_NULL_HANDLE),
89 mQueue(VK_NULL_HANDLE),
90 mCurrentQueueFamilyIndex(std::numeric_limits<uint32_t>::max()),
91 mDevice(VK_NULL_HANDLE),
92 mCommandPool(VK_NULL_HANDLE)
Jamie Madill9e54b5a2016-05-25 12:57:39 -040093{
94}
95
96RendererVk::~RendererVk()
97{
Jamie Madill4d0bf552016-12-28 15:45:24 -050098 mCommandBuffer.reset(nullptr);
99
100 if (mCommandPool)
101 {
102 vkDestroyCommandPool(mDevice, mCommandPool, nullptr);
103 mCommandPool = VK_NULL_HANDLE;
104 }
105
106 if (mDevice)
107 {
108 vkDestroyDevice(mDevice, nullptr);
109 mDevice = VK_NULL_HANDLE;
110 }
111
Jamie Madill0448ec82016-12-23 13:41:47 -0500112 if (mDebugReportCallback)
113 {
114 ASSERT(mInstance);
115 auto destroyDebugReportCallback = reinterpret_cast<PFN_vkDestroyDebugReportCallbackEXT>(
116 vkGetInstanceProcAddr(mInstance, "vkDestroyDebugReportCallbackEXT"));
117 ASSERT(destroyDebugReportCallback);
118 destroyDebugReportCallback(mInstance, mDebugReportCallback, nullptr);
119 }
120
Jamie Madill4d0bf552016-12-28 15:45:24 -0500121 if (mInstance)
122 {
123 vkDestroyInstance(mInstance, nullptr);
124 mInstance = VK_NULL_HANDLE;
125 }
126
127 mPhysicalDevice = VK_NULL_HANDLE;
Jamie Madill327ba852016-11-30 12:38:28 -0500128}
129
Jamie Madille09bd5d2016-11-29 16:20:35 -0500130vk::Error RendererVk::initialize(const egl::AttributeMap &attribs)
Jamie Madill327ba852016-11-30 12:38:28 -0500131{
Jamie Madill0448ec82016-12-23 13:41:47 -0500132 // Gather global layer properties.
133 uint32_t instanceLayerCount = 0;
134 ANGLE_VK_TRY(vkEnumerateInstanceLayerProperties(&instanceLayerCount, nullptr));
135
136 std::vector<VkLayerProperties> instanceLayerProps(instanceLayerCount);
137 if (instanceLayerCount > 0)
138 {
139 ANGLE_VK_TRY(
140 vkEnumerateInstanceLayerProperties(&instanceLayerCount, instanceLayerProps.data()));
141 }
142
Jamie Madille09bd5d2016-11-29 16:20:35 -0500143 uint32_t instanceExtensionCount = 0;
144 ANGLE_VK_TRY(vkEnumerateInstanceExtensionProperties(nullptr, &instanceExtensionCount, nullptr));
145
146 std::vector<VkExtensionProperties> instanceExtensionProps(instanceExtensionCount);
147 if (instanceExtensionCount > 0)
148 {
149 ANGLE_VK_TRY(vkEnumerateInstanceExtensionProperties(nullptr, &instanceExtensionCount,
150 instanceExtensionProps.data()));
151 }
152
Jamie Madill0448ec82016-12-23 13:41:47 -0500153#if !defined(NDEBUG)
154 // Validation layers enabled by default in Debug.
155 mEnableValidationLayers = true;
156#endif
157
158 // If specified in the attributes, override the default.
159 if (attribs.contains(EGL_PLATFORM_ANGLE_ENABLE_VALIDATION_LAYER_ANGLE))
160 {
161 mEnableValidationLayers =
162 (attribs.get(EGL_PLATFORM_ANGLE_ENABLE_VALIDATION_LAYER_ANGLE, EGL_FALSE) == EGL_TRUE);
163 }
164
165 if (mEnableValidationLayers)
166 {
167 // Verify the standard validation layers are available.
168 if (!HasStandardValidationLayer(instanceLayerProps))
169 {
170 // Generate an error if the attribute was requested, warning otherwise.
171 if (attribs.contains(EGL_PLATFORM_ANGLE_ENABLE_VALIDATION_LAYER_ANGLE))
172 {
173 ANGLEPlatformCurrent()->logError("Vulkan standard validation layers are missing.");
174 }
175 else
176 {
177 ANGLEPlatformCurrent()->logWarning(
178 "Vulkan standard validation layers are missing.");
179 }
180 mEnableValidationLayers = false;
181 }
182 }
183
Jamie Madille09bd5d2016-11-29 16:20:35 -0500184 std::vector<const char *> enabledInstanceExtensions;
185 enabledInstanceExtensions.push_back(VK_KHR_SURFACE_EXTENSION_NAME);
186#if defined(ANGLE_PLATFORM_WINDOWS)
187 enabledInstanceExtensions.push_back(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
188#else
189#error Unsupported Vulkan platform.
190#endif // defined(ANGLE_PLATFORM_WINDOWS)
191
Jamie Madill0448ec82016-12-23 13:41:47 -0500192 // TODO(jmadill): Should be able to continue initialization if debug report ext missing.
193 if (mEnableValidationLayers)
194 {
195 enabledInstanceExtensions.push_back(VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
196 }
197
Jamie Madille09bd5d2016-11-29 16:20:35 -0500198 // Verify the required extensions are in the extension names set. Fail if not.
199 ANGLE_VK_TRY(VerifyExtensionsPresent(instanceExtensionProps, enabledInstanceExtensions));
200
Jamie Madill327ba852016-11-30 12:38:28 -0500201 VkApplicationInfo applicationInfo;
202 applicationInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
203 applicationInfo.pNext = nullptr;
204 applicationInfo.pApplicationName = "ANGLE";
205 applicationInfo.applicationVersion = 1;
206 applicationInfo.pEngineName = "ANGLE";
207 applicationInfo.engineVersion = 1;
208 applicationInfo.apiVersion = VK_API_VERSION_1_0;
209
210 VkInstanceCreateInfo instanceInfo;
211 instanceInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
212 instanceInfo.pNext = nullptr;
213 instanceInfo.flags = 0;
214 instanceInfo.pApplicationInfo = &applicationInfo;
215
Jamie Madille09bd5d2016-11-29 16:20:35 -0500216 // Enable requested layers and extensions.
217 instanceInfo.enabledExtensionCount = static_cast<uint32_t>(enabledInstanceExtensions.size());
218 instanceInfo.ppEnabledExtensionNames =
219 enabledInstanceExtensions.empty() ? nullptr : enabledInstanceExtensions.data();
Jamie Madill0448ec82016-12-23 13:41:47 -0500220 instanceInfo.enabledLayerCount = mEnableValidationLayers ? 1u : 0u;
221 instanceInfo.ppEnabledLayerNames =
222 mEnableValidationLayers ? &g_VkStdValidationLayerName : nullptr;
Jamie Madill327ba852016-11-30 12:38:28 -0500223
224 ANGLE_VK_TRY(vkCreateInstance(&instanceInfo, nullptr, &mInstance));
225
Jamie Madill0448ec82016-12-23 13:41:47 -0500226 if (mEnableValidationLayers)
227 {
228 VkDebugReportCallbackCreateInfoEXT debugReportInfo;
229
230 debugReportInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT;
231 debugReportInfo.pNext = nullptr;
232 debugReportInfo.flags = VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT |
233 VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT |
234 VK_DEBUG_REPORT_INFORMATION_BIT_EXT | VK_DEBUG_REPORT_DEBUG_BIT_EXT;
235 debugReportInfo.pfnCallback = &DebugReportCallback;
236 debugReportInfo.pUserData = this;
237
238 auto createDebugReportCallback = reinterpret_cast<PFN_vkCreateDebugReportCallbackEXT>(
239 vkGetInstanceProcAddr(mInstance, "vkCreateDebugReportCallbackEXT"));
240 ASSERT(createDebugReportCallback);
241 ANGLE_VK_TRY(
242 createDebugReportCallback(mInstance, &debugReportInfo, nullptr, &mDebugReportCallback));
243 }
244
Jamie Madill4d0bf552016-12-28 15:45:24 -0500245 uint32_t physicalDeviceCount = 0;
246 ANGLE_VK_TRY(vkEnumeratePhysicalDevices(mInstance, &physicalDeviceCount, nullptr));
247 ANGLE_VK_CHECK(physicalDeviceCount > 0, VK_ERROR_INITIALIZATION_FAILED);
248
249 // TODO(jmadill): Handle multiple physical devices. For now, use the first device.
250 physicalDeviceCount = 1;
251 ANGLE_VK_TRY(vkEnumeratePhysicalDevices(mInstance, &physicalDeviceCount, &mPhysicalDevice));
252
253 vkGetPhysicalDeviceProperties(mPhysicalDevice, &mPhysicalDeviceProperties);
254
255 // Ensure we can find a graphics queue family.
256 uint32_t queueCount = 0;
257 vkGetPhysicalDeviceQueueFamilyProperties(mPhysicalDevice, &queueCount, nullptr);
258
259 ANGLE_VK_CHECK(queueCount > 0, VK_ERROR_INITIALIZATION_FAILED);
260
261 mQueueFamilyProperties.resize(queueCount);
262 vkGetPhysicalDeviceQueueFamilyProperties(mPhysicalDevice, &queueCount,
263 mQueueFamilyProperties.data());
264
265 size_t graphicsQueueFamilyCount = false;
266 uint32_t firstGraphicsQueueFamily = 0;
267 for (uint32_t familyIndex = 0; familyIndex < queueCount; ++familyIndex)
268 {
269 const auto &queueInfo = mQueueFamilyProperties[familyIndex];
270 if ((queueInfo.queueFlags & VK_QUEUE_GRAPHICS_BIT) != 0)
271 {
272 ASSERT(queueInfo.queueCount > 0);
273 graphicsQueueFamilyCount++;
274 if (firstGraphicsQueueFamily == 0)
275 {
276 firstGraphicsQueueFamily = familyIndex;
277 }
278 break;
279 }
280 }
281
282 ANGLE_VK_CHECK(graphicsQueueFamilyCount > 0, VK_ERROR_INITIALIZATION_FAILED);
283
284 // If only one queue family, go ahead and initialize the device. If there is more than one
285 // queue, we'll have to wait until we see a WindowSurface to know which supports present.
286 if (graphicsQueueFamilyCount == 1)
287 {
288 ANGLE_TRY(initializeDevice(firstGraphicsQueueFamily));
289 }
290
Jamie Madill327ba852016-11-30 12:38:28 -0500291 return vk::NoError();
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400292}
293
Jamie Madill4d0bf552016-12-28 15:45:24 -0500294vk::Error RendererVk::initializeDevice(uint32_t queueFamilyIndex)
295{
296 uint32_t deviceLayerCount = 0;
297 ANGLE_VK_TRY(vkEnumerateDeviceLayerProperties(mPhysicalDevice, &deviceLayerCount, nullptr));
298
299 std::vector<VkLayerProperties> deviceLayerProps(deviceLayerCount);
300 if (deviceLayerCount > 0)
301 {
302 ANGLE_VK_TRY(vkEnumerateDeviceLayerProperties(mPhysicalDevice, &deviceLayerCount,
303 deviceLayerProps.data()));
304 }
305
306 uint32_t deviceExtensionCount = 0;
307 ANGLE_VK_TRY(vkEnumerateDeviceExtensionProperties(mPhysicalDevice, nullptr,
308 &deviceExtensionCount, nullptr));
309
310 std::vector<VkExtensionProperties> deviceExtensionProps(deviceExtensionCount);
311 if (deviceExtensionCount > 0)
312 {
313 ANGLE_VK_TRY(vkEnumerateDeviceExtensionProperties(
314 mPhysicalDevice, nullptr, &deviceExtensionCount, deviceExtensionProps.data()));
315 }
316
317 if (mEnableValidationLayers)
318 {
319 if (!HasStandardValidationLayer(deviceLayerProps))
320 {
321 ANGLEPlatformCurrent()->logWarning("Vulkan standard validation layer is missing.");
322 mEnableValidationLayers = false;
323 }
324 }
325
326 std::vector<const char *> enabledDeviceExtensions;
327 enabledDeviceExtensions.push_back(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
328
329 ANGLE_VK_TRY(VerifyExtensionsPresent(deviceExtensionProps, enabledDeviceExtensions));
330
331 VkDeviceQueueCreateInfo queueCreateInfo;
332
333 float zeroPriority = 0.0f;
334
335 queueCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
336 queueCreateInfo.pNext = nullptr;
337 queueCreateInfo.flags = 0;
338 queueCreateInfo.queueFamilyIndex = queueFamilyIndex;
339 queueCreateInfo.queueCount = 1;
340 queueCreateInfo.pQueuePriorities = &zeroPriority;
341
342 // Initialize the device
343 VkDeviceCreateInfo createInfo;
344
345 createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
346 createInfo.pNext = nullptr;
347 createInfo.flags = 0;
348 createInfo.queueCreateInfoCount = 1;
349 createInfo.pQueueCreateInfos = &queueCreateInfo;
350 createInfo.enabledLayerCount = mEnableValidationLayers ? 1u : 0u;
351 createInfo.ppEnabledLayerNames =
352 mEnableValidationLayers ? &g_VkStdValidationLayerName : nullptr;
353 createInfo.enabledExtensionCount = static_cast<uint32_t>(enabledDeviceExtensions.size());
354 createInfo.ppEnabledExtensionNames =
355 enabledDeviceExtensions.empty() ? nullptr : enabledDeviceExtensions.data();
356 createInfo.pEnabledFeatures = nullptr; // TODO(jmadill): features
357
358 ANGLE_VK_TRY(vkCreateDevice(mPhysicalDevice, &createInfo, nullptr, &mDevice));
359
360 mCurrentQueueFamilyIndex = queueFamilyIndex;
361
362 vkGetDeviceQueue(mDevice, mCurrentQueueFamilyIndex, 0, &mQueue);
363
364 // Initialize the command pool now that we know the queue family index.
365 VkCommandPoolCreateInfo commandPoolInfo;
366 commandPoolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
367 commandPoolInfo.pNext = nullptr;
368 // TODO(jmadill): Investigate transient command buffers.
369 commandPoolInfo.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
370 commandPoolInfo.queueFamilyIndex = mCurrentQueueFamilyIndex;
371
372 ANGLE_VK_TRY(vkCreateCommandPool(mDevice, &commandPoolInfo, nullptr, &mCommandPool));
373
374 mCommandBuffer.reset(new vk::CommandBuffer(mDevice, mCommandPool));
375
376 return vk::NoError();
377}
378
379vk::ErrorOrResult<uint32_t> RendererVk::selectPresentQueueForSurface(VkSurfaceKHR surface)
380{
381 // We've already initialized a device, and can't re-create it unless it's never been used.
382 // TODO(jmadill): Handle the re-creation case if necessary.
383 if (mDevice != VK_NULL_HANDLE)
384 {
385 ASSERT(mCurrentQueueFamilyIndex != std::numeric_limits<uint32_t>::max());
386
387 // Check if the current device supports present on this surface.
388 VkBool32 supportsPresent = VK_FALSE;
389 ANGLE_VK_TRY(vkGetPhysicalDeviceSurfaceSupportKHR(mPhysicalDevice, mCurrentQueueFamilyIndex,
390 surface, &supportsPresent));
391
392 return (supportsPresent == VK_TRUE);
393 }
394
395 // Find a graphics and present queue.
396 Optional<uint32_t> newPresentQueue;
397 uint32_t queueCount = static_cast<uint32_t>(mQueueFamilyProperties.size());
398 for (uint32_t queueIndex = 0; queueIndex < queueCount; ++queueIndex)
399 {
400 const auto &queueInfo = mQueueFamilyProperties[queueIndex];
401 if ((queueInfo.queueFlags & VK_QUEUE_GRAPHICS_BIT) != 0)
402 {
403 VkBool32 supportsPresent = VK_FALSE;
404 ANGLE_VK_TRY(vkGetPhysicalDeviceSurfaceSupportKHR(mPhysicalDevice, queueIndex, surface,
405 &supportsPresent));
406
407 if (supportsPresent == VK_TRUE)
408 {
409 newPresentQueue = queueIndex;
410 break;
411 }
412 }
413 }
414
415 ANGLE_VK_CHECK(newPresentQueue.valid(), VK_ERROR_INITIALIZATION_FAILED);
416 ANGLE_TRY(initializeDevice(newPresentQueue.value()));
417
418 return newPresentQueue.value();
419}
420
421std::string RendererVk::getVendorString() const
422{
423 switch (mPhysicalDeviceProperties.vendorID)
424 {
425 case VENDOR_ID_AMD:
426 return "Advanced Micro Devices";
427 case VENDOR_ID_NVIDIA:
428 return "NVIDIA";
429 case VENDOR_ID_INTEL:
430 return "Intel";
431 default:
432 {
433 // TODO(jmadill): More vendor IDs.
434 std::stringstream strstr;
435 strstr << "Vendor ID: " << mPhysicalDeviceProperties.vendorID;
436 return strstr.str();
437 }
438 }
439}
440
Jamie Madille09bd5d2016-11-29 16:20:35 -0500441std::string RendererVk::getRendererDescription() const
442{
Jamie Madill4d0bf552016-12-28 15:45:24 -0500443 std::stringstream strstr;
444
445 uint32_t apiVersion = mPhysicalDeviceProperties.apiVersion;
446
447 strstr << "Vulkan ";
448 strstr << VK_VERSION_MAJOR(apiVersion) << ".";
449 strstr << VK_VERSION_MINOR(apiVersion) << ".";
450 strstr << VK_VERSION_PATCH(apiVersion);
451
452 strstr << "(" << mPhysicalDeviceProperties.deviceName << ")";
453
454 return strstr.str();
Jamie Madille09bd5d2016-11-29 16:20:35 -0500455}
456
Jamie Madillacccc6c2016-05-03 17:22:10 -0400457void RendererVk::ensureCapsInitialized() const
458{
459 if (!mCapsInitialized)
460 {
461 generateCaps(&mNativeCaps, &mNativeTextureCaps, &mNativeExtensions, &mNativeLimitations);
462 mCapsInitialized = true;
463 }
464}
465
466void RendererVk::generateCaps(gl::Caps * /*outCaps*/,
467 gl::TextureCapsMap * /*outTextureCaps*/,
468 gl::Extensions * /*outExtensions*/,
469 gl::Limitations * /* outLimitations */) const
470{
Jamie Madill327ba852016-11-30 12:38:28 -0500471 // TODO(jmadill): Caps.
Jamie Madillacccc6c2016-05-03 17:22:10 -0400472}
473
474const gl::Caps &RendererVk::getNativeCaps() const
475{
476 ensureCapsInitialized();
477 return mNativeCaps;
478}
479
480const gl::TextureCapsMap &RendererVk::getNativeTextureCaps() const
481{
482 ensureCapsInitialized();
483 return mNativeTextureCaps;
484}
485
486const gl::Extensions &RendererVk::getNativeExtensions() const
487{
488 ensureCapsInitialized();
489 return mNativeExtensions;
490}
491
492const gl::Limitations &RendererVk::getNativeLimitations() const
493{
494 ensureCapsInitialized();
495 return mNativeLimitations;
496}
497
Jamie Madill4d0bf552016-12-28 15:45:24 -0500498vk::CommandBuffer *RendererVk::getCommandBuffer()
499{
500 return mCommandBuffer.get();
501}
502
503vk::Error RendererVk::submitAndFinishCommandBuffer(const vk::CommandBuffer &commandBuffer)
504{
505 VkFenceCreateInfo fenceInfo;
506 fenceInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
507 fenceInfo.pNext = nullptr;
508 fenceInfo.flags = 0;
509
510 VkCommandBuffer commandBufferHandle = commandBuffer.getHandle();
511
512 VkSubmitInfo submitInfo;
513 submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
514 submitInfo.pNext = nullptr;
515 submitInfo.waitSemaphoreCount = 0;
516 submitInfo.pWaitSemaphores = nullptr;
517 submitInfo.pWaitDstStageMask = nullptr;
518 submitInfo.commandBufferCount = 1;
519 submitInfo.pCommandBuffers = &commandBufferHandle;
520 submitInfo.signalSemaphoreCount = 0;
521 submitInfo.pSignalSemaphores = nullptr;
522
523 // TODO(jmadill): Investigate how to properly submit command buffers.
524 ANGLE_VK_TRY(vkQueueSubmit(mQueue, 1, &submitInfo, VK_NULL_HANDLE));
525
526 // Wait indefinitely for the queue to finish.
527 ANGLE_VK_TRY(vkQueueWaitIdle(mQueue));
528
529 return vk::NoError();
530}
531
Jamie Madill9e54b5a2016-05-25 12:57:39 -0400532} // namespace rx