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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/compositor/vulkan_browser_compositor_output_surface.h"
6
7 #include "cc/output/output_surface_client.h"
8 #include "content/browser/renderer_host/render_widget_host_impl.h"
9 #include "gpu/vulkan/vulkan_surface.h"
10
11 namespace content {
12
13 VulkanBrowserCompositorOutputSurface::VulkanBrowserCompositorOutputSurface(
14 const scoped_refptr<cc::VulkanContextProvider>& context,
15 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager)
16 : BrowserCompositorOutputSurface(context, vsync_manager) {}
17
18 VulkanBrowserCompositorOutputSurface::~VulkanBrowserCompositorOutputSurface() {
19 DCHECK(!surface_);
20 }
21
22 bool VulkanBrowserCompositorOutputSurface::Initialize(
23 gfx::AcceleratedWidget widget) {
24 DCHECK(!surface_);
25 std::unique_ptr<gpu::VulkanSurface> surface(
26 gpu::VulkanSurface::CreateViewSurface(widget));
27 if (!surface->Initialize(vulkan_context_provider()->GetDeviceQueue(),
28 gpu::VulkanSurface::DEFAULT_SURFACE_FORMAT)) {
29 return false;
30 }
31 surface_ = std::move(surface);
32
33 return true;
34 }
35
36 void VulkanBrowserCompositorOutputSurface::Destroy() {
37 if (surface_) {
38 surface_->Destroy();
39 surface_.reset();
40 }
41 }
42
43 void VulkanBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted(
44 const std::vector<ui::LatencyInfo>& latency_info,
45 gfx::SwapResult result) {
46 RenderWidgetHostImpl::CompositorFrameDrawn(latency_info);
47 OnSwapBuffersComplete();
48 }
49
50 void VulkanBrowserCompositorOutputSurface::SwapBuffers(
51 cc::CompositorFrame* frame) {
52 surface_->SwapBuffers();
53 PostSwapBuffersComplete();
54 client_->DidSwapBuffers();
55 }
56
57 } // namespace content
OLDNEW
« 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