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

Unified Diff: content/browser/compositor/vulkan_browser_compositor_output_surface.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
Index: content/browser/compositor/vulkan_browser_compositor_output_surface.cc
diff --git a/content/browser/compositor/vulkan_browser_compositor_output_surface.cc b/content/browser/compositor/vulkan_browser_compositor_output_surface.cc
new file mode 100644
index 0000000000000000000000000000000000000000..31155db0bf117ddfb0ba590c6a645daf4a0f651f
--- /dev/null
+++ b/content/browser/compositor/vulkan_browser_compositor_output_surface.cc
@@ -0,0 +1,57 @@
+// Copyright (c) 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 "content/browser/compositor/vulkan_browser_compositor_output_surface.h"
+
+#include "cc/output/output_surface_client.h"
+#include "content/browser/renderer_host/render_widget_host_impl.h"
+#include "gpu/vulkan/vulkan_surface.h"
+
+namespace content {
+
+VulkanBrowserCompositorOutputSurface::VulkanBrowserCompositorOutputSurface(
+ const scoped_refptr<cc::VulkanContextProvider>& context,
+ const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager)
+ : BrowserCompositorOutputSurface(context, vsync_manager) {}
+
+VulkanBrowserCompositorOutputSurface::~VulkanBrowserCompositorOutputSurface() {
+ DCHECK(!surface_);
+}
+
+bool VulkanBrowserCompositorOutputSurface::Initialize(
+ gfx::AcceleratedWidget widget) {
+ DCHECK(!surface_);
+ std::unique_ptr<gpu::VulkanSurface> surface(
+ gpu::VulkanSurface::CreateViewSurface(widget));
+ if (!surface->Initialize(vulkan_context_provider()->GetDeviceQueue(),
+ gpu::VulkanSurface::DEFAULT_SURFACE_FORMAT)) {
+ return false;
+ }
+ surface_ = std::move(surface);
+
+ return true;
+}
+
+void VulkanBrowserCompositorOutputSurface::Destroy() {
+ if (surface_) {
+ surface_->Destroy();
+ surface_.reset();
+ }
+}
+
+void VulkanBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted(
+ const std::vector<ui::LatencyInfo>& latency_info,
+ gfx::SwapResult result) {
+ RenderWidgetHostImpl::CompositorFrameDrawn(latency_info);
+ OnSwapBuffersComplete();
+}
+
+void VulkanBrowserCompositorOutputSurface::SwapBuffers(
+ cc::CompositorFrame* frame) {
+ surface_->SwapBuffers();
+ PostSwapBuffersComplete();
+ client_->DidSwapBuffers();
+}
+
+} // namespace content
« no previous file with comments | « content/browser/compositor/vulkan_browser_compositor_output_surface.h ('k') | content/gpu/gpu_child_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698