diff options
author | Greg Daniel <egdaniel@google.com> | 2018-06-28 23:31:00 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-28 23:34:52 +0000 |
commit | 007267bdb54d56ec978c97c6a6944afc2b6ff40b (patch) | |
tree | bf32945463a4c9345e0236b188e2f62ec902bd78 /src/gpu/GrDirectContext.cpp | |
parent | 3148f802af419297c466e6bf5efc003b6c498f0a (diff) |
Revert "Reland "Make GrVkBackendContext no longer derive from SkRefCnt.""
This reverts commit 0db3a8846a4d05d55c36b7fa95fa6fbc1a6639cd.
Reason for revert: fuchsia change reverted
Original change's description:
> Reland "Make GrVkBackendContext no longer derive from SkRefCnt."
>
> This reverts commit 059a9ab4bcd07a4bfdbfef333c27ef3d277e0e46.
>
> Reason for revert: Fix landed in Fuchsia
>
> Original change's description:
> > Revert "Make GrVkBackendContext no longer derive from SkRefCnt."
> >
> > This reverts commit 93ae2337732bf206e6ef4faecc6b30c3881e8359.
> >
> > Reason for revert: <INSERT REASONING HERE>
> >
> > Original change's description:
> > > Make GrVkBackendContext no longer derive from SkRefCnt.
> > >
> > > Also moves the helper Create functions to VkTestUtils since no clients
> > > are using them anymore.
> > >
> > > Bug: skia:
> > > Change-Id: I7e8e4912e7ef6fb00a7e2a00407aed5e83211799
> > > Reviewed-on: https://skia-review.googlesource.com/135323
> > > Reviewed-by: Jim Van Verth <jvanverth@google.com>
> > > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > > Commit-Queue: Greg Daniel <egdaniel@google.com>
> >
> > TBR=egdaniel@google.com,jvanverth@google.com,bsalomon@google.com
> >
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> >
> > Bug: skia:
> > Change-Id: If7201917631dc22753ea3fa6e9d2984463e38e4c
> > Reviewed-on: https://skia-review.googlesource.com/137903
> > Reviewed-by: Greg Daniel <egdaniel@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
>
> TBR=egdaniel@google.com,jvanverth@google.com,bsalomon@google.com
>
> # Not skipping CQ checks because original CL landed > 1 day ago.
>
> Bug: skia:
> Change-Id: Ia4b7c0bb2c7b5dba809d85c69f0b41b473140526
> Reviewed-on: https://skia-review.googlesource.com/138181
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,jvanverth@google.com,bsalomon@google.com
Change-Id: I3f7bc4a5e4e09512fe165303685c123ec3527e58
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/138422
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/GrDirectContext.cpp')
-rw-r--r-- | src/gpu/GrDirectContext.cpp | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/gpu/GrDirectContext.cpp b/src/gpu/GrDirectContext.cpp index 7a054e72a4..d0406dd6f6 100644 --- a/src/gpu/GrDirectContext.cpp +++ b/src/gpu/GrDirectContext.cpp @@ -156,7 +156,43 @@ sk_sp<GrContext> GrContext::MakeVulkan(const GrVkBackendContext& backendContext, const GrContextOptions& options) { sk_sp<GrContext> context(new GrDirectContext(kVulkan_GrBackend)); - context->fGpu = GrVkGpu::Make(backendContext, options, context.get()); + sk_sp<GrVkBackendContext> backendContextRef(new GrVkBackendContext()); + backendContextRef->fInstance = backendContext.fInstance; + backendContextRef->fPhysicalDevice = backendContext.fPhysicalDevice; + backendContextRef->fDevice = backendContext.fDevice; + backendContextRef->fQueue = backendContext.fQueue; + backendContextRef->fGraphicsQueueIndex = backendContext.fGraphicsQueueIndex; + backendContextRef->fMinAPIVersion = backendContext.fMinAPIVersion; + backendContextRef->fExtensions = backendContext.fExtensions; + backendContextRef->fFeatures = backendContext.fFeatures; + backendContextRef->fInterface = backendContext.fInterface; + backendContextRef->fMemoryAllocator = backendContext.fMemoryAllocator; + + SkASSERT(!backendContext.fOwnsInstanceAndDevice); + backendContextRef->fOwnsInstanceAndDevice = false; + + context->fGpu = GrVkGpu::Make(std::move(backendContextRef), options, context.get()); + if (!context->fGpu) { + return nullptr; + } + + context->fCaps = context->fGpu->refCaps(); + if (!context->init(options)) { + return nullptr; + } + return context; +} + +sk_sp<GrContext> GrContext::MakeVulkan(sk_sp<const GrVkBackendContext> backendContext) { + GrContextOptions defaultOptions; + return MakeVulkan(std::move(backendContext), defaultOptions); +} + +sk_sp<GrContext> GrContext::MakeVulkan(sk_sp<const GrVkBackendContext> backendContext, + const GrContextOptions& options) { + sk_sp<GrContext> context(new GrDirectContext(kVulkan_GrBackend)); + + context->fGpu = GrVkGpu::Make(std::move(backendContext), options, context.get()); if (!context->fGpu) { return nullptr; } |