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

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: 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 #include <vector>
8 8
9 #include "gpu/vulkan/vulkan_device_queue.h" 9 #include "gpu/vulkan/vulkan_device_queue.h"
10 #include "gpu/vulkan/vulkan_surface.h"
10 11
11 #if defined(VK_USE_PLATFORM_XLIB_KHR) 12 #if defined(VK_USE_PLATFORM_XLIB_KHR)
12 #include "ui/gfx/x/x11_types.h" 13 #include "ui/gfx/x/x11_types.h"
13 #endif // defined(VK_USE_PLATFORM_XLIB_KHR) 14 #endif // defined(VK_USE_PLATFORM_XLIB_KHR)
14 15
15 namespace cc { 16 namespace cc {
16 17
17 scoped_refptr<VulkanInProcessContextProvider> 18 scoped_refptr<VulkanInProcessContextProvider>
18 VulkanInProcessContextProvider::Create() { 19 VulkanInProcessContextProvider::Create() {
20 static bool vulkan_initialized = false;
David Yen 2016/04/16 01:32:38 Not sure where the best place to call this is yet,
piman 2016/04/19 01:36:42 BrowserMainLoop::BrowserThreadsStarted is probably
David Yen 2016/04/19 22:20:28 Done. I also just removed the InitializeOneOff() f
piman 2016/04/19 23:42:02 Yeah, it sounds better.
21 static bool vulkan_supported = false;
22 if (!vulkan_initialized) {
23 vulkan_initialized = true;
24 vulkan_supported = gpu::VulkanSurface::InitializeOneOff();
25 }
26 if (!vulkan_supported)
27 return nullptr;
28
19 scoped_refptr<VulkanInProcessContextProvider> context_provider( 29 scoped_refptr<VulkanInProcessContextProvider> context_provider(
20 new VulkanInProcessContextProvider); 30 new VulkanInProcessContextProvider);
21 if (!context_provider->Initialize()) 31 if (!context_provider->Initialize())
22 return nullptr; 32 return nullptr;
23 return context_provider; 33 return context_provider;
24 } 34 }
25 35
26 bool VulkanInProcessContextProvider::Initialize() { 36 bool VulkanInProcessContextProvider::Initialize() {
27 std::unique_ptr<gpu::VulkanDeviceQueue> device_queue( 37 std::unique_ptr<gpu::VulkanDeviceQueue> device_queue(
28 new gpu::VulkanDeviceQueue); 38 new gpu::VulkanDeviceQueue);
29 if (device_queue->Initialize( 39 if (!device_queue->Initialize(
30 gpu::VulkanDeviceQueue::GRAPHICS_QUEUE_FLAG | 40 gpu::VulkanDeviceQueue::GRAPHICS_QUEUE_FLAG |
31 gpu::VulkanDeviceQueue::PRESENTATION_SUPPORT_QUEUE_FLAG)) { 41 gpu::VulkanDeviceQueue::PRESENTATION_SUPPORT_QUEUE_FLAG)) {
32 device_queue_ = std::move(device_queue); 42 return false;
33 return true;
34 } 43 }
35 44
36 return false; 45 device_queue_ = std::move(device_queue);
46 return true;
47 }
48
49 void VulkanInProcessContextProvider::SwapBuffers() {
50 // Has no output surface attached to this.
51 NOTIMPLEMENTED();
37 } 52 }
38 53
39 void VulkanInProcessContextProvider::Destroy() { 54 void VulkanInProcessContextProvider::Destroy() {
40 if (device_queue_) { 55 if (device_queue_) {
41 device_queue_->Destroy(); 56 device_queue_->Destroy();
42 device_queue_.reset(); 57 device_queue_.reset();
43 } 58 }
44 } 59 }
45 60
46 gpu::VulkanDeviceQueue* VulkanInProcessContextProvider::GetDeviceQueue() { 61 gpu::VulkanDeviceQueue* VulkanInProcessContextProvider::GetDeviceQueue() {
47 return device_queue_.get(); 62 return device_queue_.get();
48 } 63 }
49 64
50 VulkanInProcessContextProvider::VulkanInProcessContextProvider() {} 65 VulkanInProcessContextProvider::VulkanInProcessContextProvider() {}
51 66
52 VulkanInProcessContextProvider::~VulkanInProcessContextProvider() {} 67 VulkanInProcessContextProvider::~VulkanInProcessContextProvider() {}
53 68
54 } // namespace cc 69 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698