| Index: cc/output/vulkan_in_process_context_provider.cc
|
| diff --git a/cc/output/vulkan_in_process_context_provider.cc b/cc/output/vulkan_in_process_context_provider.cc
|
| index 0b67eb1a9807bc53f951a6148f5f2b39debaccb4..ad7de837d6c2cb197b6bb7a295712c2066a9fee7 100644
|
| --- a/cc/output/vulkan_in_process_context_provider.cc
|
| +++ b/cc/output/vulkan_in_process_context_provider.cc
|
| @@ -4,47 +4,63 @@
|
|
|
| #include "cc/output/vulkan_in_process_context_provider.h"
|
|
|
| -#include <vector>
|
| -
|
| +#if defined(ENABLE_VULKAN)
|
| #include "gpu/vulkan/vulkan_device_queue.h"
|
| -
|
| -#if defined(VK_USE_PLATFORM_XLIB_KHR)
|
| -#include "ui/gfx/x/x11_types.h"
|
| -#endif // defined(VK_USE_PLATFORM_XLIB_KHR)
|
| +#include "gpu/vulkan/vulkan_implementation.h"
|
| +#endif // defined(ENABLE_VULKAN)
|
|
|
| namespace cc {
|
|
|
| scoped_refptr<VulkanInProcessContextProvider>
|
| VulkanInProcessContextProvider::Create() {
|
| +#if defined(ENABLE_VULKAN)
|
| + if (!gpu::VulkanSupported())
|
| + return nullptr;
|
| +
|
| scoped_refptr<VulkanInProcessContextProvider> context_provider(
|
| new VulkanInProcessContextProvider);
|
| if (!context_provider->Initialize())
|
| return nullptr;
|
| return context_provider;
|
| +#else
|
| + return nullptr;
|
| +#endif
|
| }
|
|
|
| bool VulkanInProcessContextProvider::Initialize() {
|
| +#if defined(ENABLE_VULKAN)
|
| + DCHECK(!device_queue_);
|
| std::unique_ptr<gpu::VulkanDeviceQueue> device_queue(
|
| new gpu::VulkanDeviceQueue);
|
| - if (device_queue->Initialize(
|
| + if (!device_queue->Initialize(
|
| gpu::VulkanDeviceQueue::GRAPHICS_QUEUE_FLAG |
|
| gpu::VulkanDeviceQueue::PRESENTATION_SUPPORT_QUEUE_FLAG)) {
|
| - device_queue_ = std::move(device_queue);
|
| - return true;
|
| + device_queue->Destroy();
|
| + return false;
|
| }
|
|
|
| + device_queue_ = std::move(device_queue);
|
| + return true;
|
| +#else
|
| return false;
|
| +#endif
|
| }
|
|
|
| void VulkanInProcessContextProvider::Destroy() {
|
| +#if defined(ENABLE_VULKAN)
|
| if (device_queue_) {
|
| device_queue_->Destroy();
|
| device_queue_.reset();
|
| }
|
| +#endif
|
| }
|
|
|
| gpu::VulkanDeviceQueue* VulkanInProcessContextProvider::GetDeviceQueue() {
|
| +#if defined(ENABLE_VULKAN)
|
| return device_queue_.get();
|
| +#else
|
| + return nullptr;
|
| +#endif
|
| }
|
|
|
| VulkanInProcessContextProvider::VulkanInProcessContextProvider() {}
|
|
|