OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "cc/output/vulkan_in_process_context_provider.h" |
| 6 |
| 7 #include <vector> |
| 8 |
| 9 #include "gpu/vulkan/vulkan_device_queue.h" |
| 10 |
| 11 #if defined(VK_USE_PLATFORM_XLIB_KHR) |
| 12 #include "ui/gfx/x/x11_types.h" |
| 13 #endif // defined(VK_USE_PLATFORM_XLIB_KHR) |
| 14 |
| 15 namespace cc { |
| 16 |
| 17 scoped_refptr<VulkanInProcessContextProvider> |
| 18 VulkanInProcessContextProvider::Create() { |
| 19 scoped_refptr<VulkanInProcessContextProvider> context_provider( |
| 20 new VulkanInProcessContextProvider); |
| 21 if (!context_provider->Initialize()) |
| 22 return nullptr; |
| 23 return context_provider; |
| 24 } |
| 25 |
| 26 bool VulkanInProcessContextProvider::Initialize() { |
| 27 scoped_ptr<gpu::VulkanDeviceQueue> device_queue(new gpu::VulkanDeviceQueue); |
| 28 if (device_queue->Initialize( |
| 29 gpu::VulkanDeviceQueue::GRAPHICS_QUEUE_FLAG | |
| 30 gpu::VulkanDeviceQueue::PRESENTATION_SUPPORT_QUEUE_FLAG)) { |
| 31 device_queue_ = std::move(device_queue); |
| 32 return true; |
| 33 } |
| 34 |
| 35 return false; |
| 36 } |
| 37 |
| 38 void VulkanInProcessContextProvider::Destroy() { |
| 39 if (device_queue_) { |
| 40 device_queue_->Destroy(); |
| 41 device_queue_.reset(); |
| 42 } |
| 43 } |
| 44 |
| 45 gpu::VulkanDeviceQueue* VulkanInProcessContextProvider::GetDeviceQueue() { |
| 46 return device_queue_.get(); |
| 47 } |
| 48 |
| 49 VulkanInProcessContextProvider::VulkanInProcessContextProvider() {} |
| 50 |
| 51 VulkanInProcessContextProvider::~VulkanInProcessContextProvider() {} |
| 52 |
| 53 } // namespace cc |
OLD | NEW |