From fc978fde4868079d22c2e708b7e4378cbfb22767 Mon Sep 17 00:00:00 2001 From: Greg Daniel Date: Thu, 13 Apr 2017 09:54:12 -0400 Subject: [PATCH] Store the GrBackend we are using on GrContext As we start adding more functionality to external clients and passing data around, we will need to know what backend we are working with at a layer higher that GrGpu. TBR=bsalomon@google.com Bug: skia: Change-Id: Ifee527ea0c1046469401a39e0500f84a46bb3081 Reviewed-on: https://skia-review.googlesource.com/13275 Commit-Queue: Greg Daniel Reviewed-by: Robert Phillips --- include/gpu/GrContext.h | 2 ++ src/gpu/GrContext.cpp | 2 ++ src/gpu/GrContextPriv.h | 2 ++ 3 files changed, 6 insertions(+) diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index d820202ca8..f2ba24d4db 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -334,6 +334,8 @@ private: GrAuditTrail fAuditTrail; + GrBackend fBackend; + // TODO: have the GrClipStackClip use renderTargetContexts and rm this friending friend class GrContextPriv; diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 7ea4abd0c0..c511310590 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -83,6 +83,8 @@ bool GrContext::init(GrBackend backend, GrBackendContext backendContext, ASSERT_SINGLE_OWNER SkASSERT(!fGpu); + fBackend = backend; + fGpu = GrGpu::Create(backend, backendContext, options, this); if (!fGpu) { return false; diff --git a/src/gpu/GrContextPriv.h b/src/gpu/GrContextPriv.h index 95df8eacc9..0f4f7da4d8 100644 --- a/src/gpu/GrContextPriv.h +++ b/src/gpu/GrContextPriv.h @@ -157,6 +157,8 @@ public: size_t rowBytes, uint32_t pixelOpsFlags = 0); + GrBackend getBackend() const { return fContext->fBackend; } + private: explicit GrContextPriv(GrContext* context) : fContext(context) {} GrContextPriv(const GrContextPriv&); // unimpl