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.
Add and plumb empty DawnContextProvider
Prepare for Dawn as an option for compositing and raster by creating an empty implementation of the DawnContextProvider, which will use the Skia Dawn backend to create a GrContext. Compilation of DawnContextProvider and the Skia Dawn backend are enabled with the gn arg use_skia_dawn=true. The command line flag --gr-context-type=dawn will select SkiaRenderer Dawn at runtime. For now it doesn't connect with Dawn, and DawnContextProvider::Create() always returns nullptr. See crrev.com/c/1873874 for context. Bug: 1021566 Change-Id: Ifa8e17e5e8b8b3461f4177956a8e28f5bd8d27c0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1896120 Commit-Queue: Sean Gilhuly <sgilhuly@chromium.org> Reviewed-by: Ken Buchanan <kenrb@chromium.org> Reviewed-by: Jonathan Backer <backer@chromium.org> Reviewed-by: Stephen White <senorblanco@chromium.org> Cr-Commit-Position: refs/heads/master@{#713020}
- Loading branch information
Sean Gilhuly
authored and
Commit Bot
committed
Nov 6, 2019
1 parent
082df1f
commit 8602615
Showing
18 changed files
with
188 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) 2019 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 "components/viz/common/gpu/dawn_context_provider.h" | ||
|
||
#include "base/memory/ptr_util.h" | ||
|
||
namespace viz { | ||
|
||
std::unique_ptr<DawnContextProvider> DawnContextProvider::Create() { | ||
auto context_provider = base::WrapUnique(new DawnContextProvider()); | ||
if (!context_provider->IsValid()) | ||
return nullptr; | ||
return context_provider; | ||
} | ||
|
||
DawnContextProvider::DawnContextProvider() = default; | ||
|
||
DawnContextProvider::~DawnContextProvider() = default; | ||
|
||
} // namespace viz |
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,34 @@ | ||
// Copyright (c) 2019 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 COMPONENTS_VIZ_COMMON_GPU_DAWN_CONTEXT_PROVIDER_H_ | ||
#define COMPONENTS_VIZ_COMMON_GPU_DAWN_CONTEXT_PROVIDER_H_ | ||
|
||
#include "base/macros.h" | ||
#include "components/viz/common/viz_dawn_context_provider_export.h" | ||
#include "third_party/skia/include/gpu/GrContext.h" | ||
|
||
class GrContext; | ||
|
||
namespace viz { | ||
|
||
class VIZ_DAWN_CONTEXT_PROVIDER_EXPORT DawnContextProvider { | ||
public: | ||
static std::unique_ptr<DawnContextProvider> Create(); | ||
~DawnContextProvider(); | ||
|
||
GrContext* GetGrContext() { return gr_context_.get(); } | ||
bool IsValid() { return !!gr_context_; } | ||
|
||
private: | ||
DawnContextProvider(); | ||
|
||
sk_sp<GrContext> gr_context_; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(DawnContextProvider); | ||
}; | ||
|
||
} // namespace viz | ||
|
||
#endif // COMPONENTS_VIZ_COMMON_GPU_DAWN_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,29 @@ | ||
// Copyright 2018 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 COMPONENTS_VIZ_COMMON_VIZ_DAWN_CONTEXT_PROVIDER_EXPORT_H_ | ||
#define COMPONENTS_VIZ_COMMON_VIZ_DAWN_CONTEXT_PROVIDER_EXPORT_H_ | ||
|
||
#if defined(COMPONENT_BUILD) | ||
#if defined(WIN32) | ||
|
||
#if defined(VIZ_DAWN_CONTEXT_PROVIDER_IMPLEMENTATION) | ||
#define VIZ_DAWN_CONTEXT_PROVIDER_EXPORT __declspec(dllexport) | ||
#else | ||
#define VIZ_DAWN_CONTEXT_PROVIDER_EXPORT __declspec(dllimport) | ||
#endif // defined(VIZ_DAWN_CONTEXT_PROVIDER_IMPLEMENTATION) | ||
|
||
#else // defined(WIN32) | ||
#if defined(VIZ_DAWN_CONTEXT_PROVIDER_IMPLEMENTATION) | ||
#define VIZ_DAWN_CONTEXT_PROVIDER_EXPORT __attribute__((visibility("default"))) | ||
#else | ||
#define VIZ_DAWN_CONTEXT_PROVIDER_EXPORT | ||
#endif | ||
#endif | ||
|
||
#else // defined(COMPONENT_BUILD) | ||
#define VIZ_DAWN_CONTEXT_PROVIDER_EXPORT | ||
#endif | ||
|
||
#endif // COMPONENTS_VIZ_COMMON_VIZ_DAWN_CONTEXT_PROVIDER_EXPORT_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
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
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.