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

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

Issue 2742263004: Revert of Remove enable_vulkan from build/config, and move it to the buildflag_header system. (Closed)
Patch Set: Created 3 years, 9 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 | « cc/output/vulkan_in_process_context_provider.h ('k') | cc/surfaces/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "gpu/vulkan/features.h"
7 6
8 #if BUILDFLAG(ENABLE_VULKAN) 7 #if defined(ENABLE_VULKAN)
9 #include "gpu/vulkan/vulkan_device_queue.h" 8 #include "gpu/vulkan/vulkan_device_queue.h"
10 #include "gpu/vulkan/vulkan_implementation.h" 9 #include "gpu/vulkan/vulkan_implementation.h"
11 #endif // BUILDFLAG(ENABLE_VULKAN) 10 #endif // defined(ENABLE_VULKAN)
12 11
13 namespace cc { 12 namespace cc {
14 13
15 scoped_refptr<VulkanInProcessContextProvider> 14 scoped_refptr<VulkanInProcessContextProvider>
16 VulkanInProcessContextProvider::Create() { 15 VulkanInProcessContextProvider::Create() {
17 #if BUILDFLAG(ENABLE_VULKAN) 16 #if defined(ENABLE_VULKAN)
18 if (!gpu::VulkanSupported()) 17 if (!gpu::VulkanSupported())
19 return nullptr; 18 return nullptr;
20 19
21 scoped_refptr<VulkanInProcessContextProvider> context_provider( 20 scoped_refptr<VulkanInProcessContextProvider> context_provider(
22 new VulkanInProcessContextProvider); 21 new VulkanInProcessContextProvider);
23 if (!context_provider->Initialize()) 22 if (!context_provider->Initialize())
24 return nullptr; 23 return nullptr;
25 return context_provider; 24 return context_provider;
26 #else 25 #else
27 return nullptr; 26 return nullptr;
28 #endif 27 #endif
29 } 28 }
30 29
31 bool VulkanInProcessContextProvider::Initialize() { 30 bool VulkanInProcessContextProvider::Initialize() {
32 #if BUILDFLAG(ENABLE_VULKAN) 31 #if defined(ENABLE_VULKAN)
33 DCHECK(!device_queue_); 32 DCHECK(!device_queue_);
34 std::unique_ptr<gpu::VulkanDeviceQueue> device_queue( 33 std::unique_ptr<gpu::VulkanDeviceQueue> device_queue(
35 new gpu::VulkanDeviceQueue); 34 new gpu::VulkanDeviceQueue);
36 if (!device_queue->Initialize( 35 if (!device_queue->Initialize(
37 gpu::VulkanDeviceQueue::GRAPHICS_QUEUE_FLAG | 36 gpu::VulkanDeviceQueue::GRAPHICS_QUEUE_FLAG |
38 gpu::VulkanDeviceQueue::PRESENTATION_SUPPORT_QUEUE_FLAG)) { 37 gpu::VulkanDeviceQueue::PRESENTATION_SUPPORT_QUEUE_FLAG)) {
39 device_queue->Destroy(); 38 device_queue->Destroy();
40 return false; 39 return false;
41 } 40 }
42 41
43 device_queue_ = std::move(device_queue); 42 device_queue_ = std::move(device_queue);
44 return true; 43 return true;
45 #else 44 #else
46 return false; 45 return false;
47 #endif 46 #endif
48 } 47 }
49 48
50 void VulkanInProcessContextProvider::Destroy() { 49 void VulkanInProcessContextProvider::Destroy() {
51 #if BUILDFLAG(ENABLE_VULKAN) 50 #if defined(ENABLE_VULKAN)
52 if (device_queue_) { 51 if (device_queue_) {
53 device_queue_->Destroy(); 52 device_queue_->Destroy();
54 device_queue_.reset(); 53 device_queue_.reset();
55 } 54 }
56 #endif 55 #endif
57 } 56 }
58 57
59 gpu::VulkanDeviceQueue* VulkanInProcessContextProvider::GetDeviceQueue() { 58 gpu::VulkanDeviceQueue* VulkanInProcessContextProvider::GetDeviceQueue() {
60 #if BUILDFLAG(ENABLE_VULKAN) 59 #if defined(ENABLE_VULKAN)
61 return device_queue_.get(); 60 return device_queue_.get();
62 #else 61 #else
63 return nullptr; 62 return nullptr;
64 #endif 63 #endif
65 } 64 }
66 65
67 VulkanInProcessContextProvider::VulkanInProcessContextProvider() {} 66 VulkanInProcessContextProvider::VulkanInProcessContextProvider() {}
68 67
69 VulkanInProcessContextProvider::~VulkanInProcessContextProvider() { 68 VulkanInProcessContextProvider::~VulkanInProcessContextProvider() {
70 Destroy(); 69 Destroy();
71 } 70 }
72 71
73 } // namespace cc 72 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/vulkan_in_process_context_provider.h ('k') | cc/surfaces/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698