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

Unified Diff: cc/output/vulkan_derived_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 side-by-side diff with in-line comments
Download patch
Index: cc/output/vulkan_derived_context_provider.cc
diff --git a/cc/output/vulkan_derived_context_provider.cc b/cc/output/vulkan_derived_context_provider.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4de20eef8c0b6763374611afc5d050b5423b15d2
--- /dev/null
+++ b/cc/output/vulkan_derived_context_provider.cc
@@ -0,0 +1,54 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/output/vulkan_derived_context_provider.h"
+
+#include "gpu/vulkan/vulkan_device_queue.h"
+#include "gpu/vulkan/vulkan_surface.h"
+
+namespace cc {
+
+scoped_refptr<VulkanDerivedContextProvider>
+VulkanDerivedContextProvider::Create(
+ scoped_refptr<VulkanContextProvider> parent_context_provider,
+ gfx::AcceleratedWidget widget) {
+ scoped_refptr<VulkanDerivedContextProvider> context_provider(
+ new VulkanDerivedContextProvider(parent_context_provider, widget));
+ if (!context_provider->Initialize())
+ return nullptr;
+ return context_provider;
+}
+
+bool VulkanDerivedContextProvider::Initialize() {
+ if (!surface_->Initialize(GetDeviceQueue(),
+ gpu::VulkanSurface::DEFAULT_SURFACE_FORMAT)) {
+ return false;
+ }
+
+ return true;
+}
+
+void VulkanDerivedContextProvider::Destroy() {
+ surface_->Destroy();
+}
+
+gpu::VulkanDeviceQueue* VulkanDerivedContextProvider::GetDeviceQueue() {
+ return parent_context_provider_->GetDeviceQueue();
+}
+
+void VulkanDerivedContextProvider::SwapBuffers() {
+ surface_->SwapBuffers();
+}
+
+VulkanDerivedContextProvider::VulkanDerivedContextProvider(
+ scoped_refptr<VulkanContextProvider> parent_context_provider,
+ gfx::AcceleratedWidget widget)
+ : parent_context_provider_(parent_context_provider),
+ surface_(gpu::VulkanSurface::CreateViewSurface(widget)) {
+ DCHECK(parent_context_provider_);
+}
+
+VulkanDerivedContextProvider::~VulkanDerivedContextProvider() {}
+
+} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698