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

Unified 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: Export VulkanContextProvider 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/output/vulkan_in_process_context_provider.h ('k') | cc/surfaces/surface_display_output_surface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {}
« no previous file with comments | « cc/output/vulkan_in_process_context_provider.h ('k') | cc/surfaces/surface_display_output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698