forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added initial implementation of the Vulkan Context Provider.
The Vulkan Device/Queue has been included into a custom class which will be provided by the vulkan context provider. The context provider will be how we manage sharing of vulkan objects. R=piman@chromium.org BUG=582558 582564 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1829163003 Cr-Commit-Position: refs/heads/master@{#384161}
- Loading branch information
dyen
authored and
Commit bot
committed
Mar 31, 2016
1 parent
11cb963
commit 8a145fb
Showing
23 changed files
with
484 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// 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. | ||
|
||
#ifndef CC_OUTPUT_VULKAN_CONTEXT_PROVIDER_H_ | ||
#define CC_OUTPUT_VULKAN_CONTEXT_PROVIDER_H_ | ||
|
||
#include "base/memory/ref_counted.h" | ||
|
||
namespace gpu { | ||
class VulkanDeviceQueue; | ||
} | ||
|
||
namespace cc { | ||
|
||
// The VulkanContextProvider groups sharing of vulkan objects synchronously. | ||
class VulkanContextProvider | ||
: public base::RefCountedThreadSafe<VulkanContextProvider> { | ||
public: | ||
virtual gpu::VulkanDeviceQueue* GetDeviceQueue() = 0; | ||
|
||
protected: | ||
friend class base::RefCountedThreadSafe<VulkanContextProvider>; | ||
virtual ~VulkanContextProvider() {} | ||
}; | ||
|
||
} // namespace cc | ||
|
||
#endif // CC_OUTPUT_VULKAN_CONTEXT_PROVIDER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// 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 "cc/output/vulkan_in_process_context_provider.h" | ||
|
||
#include <vector> | ||
|
||
#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) | ||
|
||
namespace cc { | ||
|
||
scoped_refptr<VulkanInProcessContextProvider> | ||
VulkanInProcessContextProvider::Create() { | ||
scoped_refptr<VulkanInProcessContextProvider> context_provider( | ||
new VulkanInProcessContextProvider); | ||
if (!context_provider->Initialize()) | ||
return nullptr; | ||
return context_provider; | ||
} | ||
|
||
bool VulkanInProcessContextProvider::Initialize() { | ||
scoped_ptr<gpu::VulkanDeviceQueue> device_queue(new gpu::VulkanDeviceQueue); | ||
if (device_queue->Initialize( | ||
gpu::VulkanDeviceQueue::GRAPHICS_QUEUE_FLAG | | ||
gpu::VulkanDeviceQueue::PRESENTATION_SUPPORT_QUEUE_FLAG)) { | ||
device_queue_ = std::move(device_queue); | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
void VulkanInProcessContextProvider::Destroy() { | ||
if (device_queue_) { | ||
device_queue_->Destroy(); | ||
device_queue_.reset(); | ||
} | ||
} | ||
|
||
gpu::VulkanDeviceQueue* VulkanInProcessContextProvider::GetDeviceQueue() { | ||
return device_queue_.get(); | ||
} | ||
|
||
VulkanInProcessContextProvider::VulkanInProcessContextProvider() {} | ||
|
||
VulkanInProcessContextProvider::~VulkanInProcessContextProvider() {} | ||
|
||
} // namespace cc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// 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. | ||
|
||
#ifndef CC_OUTPUT_VULKAN_IN_PROCESS_CONTEXT_PROVIDER_H_ | ||
#define CC_OUTPUT_VULKAN_IN_PROCESS_CONTEXT_PROVIDER_H_ | ||
|
||
#include "base/memory/scoped_ptr.h" | ||
#include "cc/base/cc_export.h" | ||
#include "cc/output/vulkan_context_provider.h" | ||
|
||
namespace gpu { | ||
class VulkanDeviceQueue; | ||
} | ||
|
||
namespace cc { | ||
|
||
class CC_EXPORT VulkanInProcessContextProvider : public VulkanContextProvider { | ||
public: | ||
static scoped_refptr<VulkanInProcessContextProvider> Create(); | ||
|
||
bool Initialize(); | ||
void Destroy(); | ||
|
||
gpu::VulkanDeviceQueue* GetDeviceQueue() override; | ||
|
||
protected: | ||
VulkanInProcessContextProvider(); | ||
~VulkanInProcessContextProvider() override; | ||
|
||
private: | ||
scoped_ptr<gpu::VulkanDeviceQueue> device_queue_; | ||
}; | ||
|
||
} // namespace cc | ||
|
||
#endif // CC_OUTPUT_VULKAN_IN_PROCESS_CONTEXT_PROVIDER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.