| 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
|
|
|