Chromium Code Reviews| 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..63ef105e513913d2151ddeeb0dbe891bdafe1224 100644 |
| --- a/cc/output/vulkan_in_process_context_provider.cc |
| +++ b/cc/output/vulkan_in_process_context_provider.cc |
| @@ -7,6 +7,7 @@ |
| #include <vector> |
| #include "gpu/vulkan/vulkan_device_queue.h" |
| +#include "gpu/vulkan/vulkan_surface.h" |
| #if defined(VK_USE_PLATFORM_XLIB_KHR) |
| #include "ui/gfx/x/x11_types.h" |
| @@ -16,6 +17,15 @@ namespace cc { |
| scoped_refptr<VulkanInProcessContextProvider> |
| VulkanInProcessContextProvider::Create() { |
| + 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.
|
| + static bool vulkan_supported = false; |
| + if (!vulkan_initialized) { |
| + vulkan_initialized = true; |
| + vulkan_supported = gpu::VulkanSurface::InitializeOneOff(); |
| + } |
| + if (!vulkan_supported) |
| + return nullptr; |
| + |
| scoped_refptr<VulkanInProcessContextProvider> context_provider( |
| new VulkanInProcessContextProvider); |
| if (!context_provider->Initialize()) |
| @@ -26,14 +36,19 @@ VulkanInProcessContextProvider::Create() { |
| bool VulkanInProcessContextProvider::Initialize() { |
| 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; |
| + return false; |
| } |
| - return false; |
| + device_queue_ = std::move(device_queue); |
| + return true; |
| +} |
| + |
| +void VulkanInProcessContextProvider::SwapBuffers() { |
| + // Has no output surface attached to this. |
| + NOTIMPLEMENTED(); |
| } |
| void VulkanInProcessContextProvider::Destroy() { |