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

Side by Side Diff: cc/output/vulkan_in_process_context_provider.cc

Issue 1892303003: Added the Vulkan Context Provider implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Export VulkanContextProvider 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
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/output/vulkan_in_process_context_provider.h" 5 #include "cc/output/vulkan_in_process_context_provider.h"
6 6
7 #include <vector> 7 #if defined(ENABLE_VULKAN)
8
9 #include "gpu/vulkan/vulkan_device_queue.h" 8 #include "gpu/vulkan/vulkan_device_queue.h"
10 9 #include "gpu/vulkan/vulkan_implementation.h"
11 #if defined(VK_USE_PLATFORM_XLIB_KHR) 10 #endif // defined(ENABLE_VULKAN)
12 #include "ui/gfx/x/x11_types.h"
13 #endif // defined(VK_USE_PLATFORM_XLIB_KHR)
14 11
15 namespace cc { 12 namespace cc {
16 13
17 scoped_refptr<VulkanInProcessContextProvider> 14 scoped_refptr<VulkanInProcessContextProvider>
18 VulkanInProcessContextProvider::Create() { 15 VulkanInProcessContextProvider::Create() {
16 #if defined(ENABLE_VULKAN)
17 if (!gpu::VulkanSupported())
18 return nullptr;
19
19 scoped_refptr<VulkanInProcessContextProvider> context_provider( 20 scoped_refptr<VulkanInProcessContextProvider> context_provider(
20 new VulkanInProcessContextProvider); 21 new VulkanInProcessContextProvider);
21 if (!context_provider->Initialize()) 22 if (!context_provider->Initialize())
22 return nullptr; 23 return nullptr;
23 return context_provider; 24 return context_provider;
25 #else
26 return nullptr;
27 #endif
24 } 28 }
25 29
26 bool VulkanInProcessContextProvider::Initialize() { 30 bool VulkanInProcessContextProvider::Initialize() {
31 #if defined(ENABLE_VULKAN)
32 DCHECK(!device_queue_);
27 std::unique_ptr<gpu::VulkanDeviceQueue> device_queue( 33 std::unique_ptr<gpu::VulkanDeviceQueue> device_queue(
28 new gpu::VulkanDeviceQueue); 34 new gpu::VulkanDeviceQueue);
29 if (device_queue->Initialize( 35 if (!device_queue->Initialize(
30 gpu::VulkanDeviceQueue::GRAPHICS_QUEUE_FLAG | 36 gpu::VulkanDeviceQueue::GRAPHICS_QUEUE_FLAG |
31 gpu::VulkanDeviceQueue::PRESENTATION_SUPPORT_QUEUE_FLAG)) { 37 gpu::VulkanDeviceQueue::PRESENTATION_SUPPORT_QUEUE_FLAG)) {
32 device_queue_ = std::move(device_queue); 38 device_queue->Destroy();
33 return true; 39 return false;
34 } 40 }
35 41
42 device_queue_ = std::move(device_queue);
43 return true;
44 #else
36 return false; 45 return false;
46 #endif
37 } 47 }
38 48
39 void VulkanInProcessContextProvider::Destroy() { 49 void VulkanInProcessContextProvider::Destroy() {
50 #if defined(ENABLE_VULKAN)
40 if (device_queue_) { 51 if (device_queue_) {
41 device_queue_->Destroy(); 52 device_queue_->Destroy();
42 device_queue_.reset(); 53 device_queue_.reset();
43 } 54 }
55 #endif
44 } 56 }
45 57
46 gpu::VulkanDeviceQueue* VulkanInProcessContextProvider::GetDeviceQueue() { 58 gpu::VulkanDeviceQueue* VulkanInProcessContextProvider::GetDeviceQueue() {
59 #if defined(ENABLE_VULKAN)
47 return device_queue_.get(); 60 return device_queue_.get();
61 #else
62 return nullptr;
63 #endif
48 } 64 }
49 65
50 VulkanInProcessContextProvider::VulkanInProcessContextProvider() {} 66 VulkanInProcessContextProvider::VulkanInProcessContextProvider() {}
51 67
52 VulkanInProcessContextProvider::~VulkanInProcessContextProvider() {} 68 VulkanInProcessContextProvider::~VulkanInProcessContextProvider() {}
53 69
54 } // namespace cc 70 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/vulkan_in_process_context_provider.h ('k') | cc/surfaces/surface_display_output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698