Move a bunch of gpu files out of include/private and into src/gpu.
In GrRecordingContext I moved the auditTrail onto the heap and only there
when compiling for tests. This allowed us to move a lot of files out of
include private.
Change-Id: Ib76ac211c0c6fd10bacaccf0c5f93f21a59f35d5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221344
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
diff --git a/src/c/sk_surface.cpp b/src/c/sk_surface.cpp
index 9ffe9fb..b3f203f 100644
--- a/src/c/sk_surface.cpp
+++ b/src/c/sk_surface.cpp
@@ -20,8 +20,8 @@
#include "include/c/sk_image.h"
#include "include/c/sk_paint.h"
#include "include/c/sk_path.h"
-#include "include/c/sk_surface.h"
#include "include/c/sk_picture.h"
+#include "include/c/sk_surface.h"
#include "src/c/sk_types_priv.h"
const struct {
diff --git a/src/core/SkBlurMF.cpp b/src/core/SkBlurMF.cpp
index 8e89d7e..850d785 100644
--- a/src/core/SkBlurMF.cpp
+++ b/src/core/SkBlurMF.cpp
@@ -20,7 +20,6 @@
#if SK_SUPPORT_GPU
#include "include/private/GrRecordingContext.h"
-#include "include/private/GrTextureProxy.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrFragmentProcessor.h"
#include "src/gpu/GrRecordingContextPriv.h"
@@ -28,6 +27,7 @@
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/GrShaderCaps.h"
#include "src/gpu/GrStyle.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/effects/GrTextureDomain.h"
#include "src/gpu/effects/generated/GrCircleBlurFragmentProcessor.h"
#include "src/gpu/effects/generated/GrRRectBlurEffect.h"
diff --git a/src/core/SkDeferredDisplayList.cpp b/src/core/SkDeferredDisplayList.cpp
index 639b1fa..9536210 100644
--- a/src/core/SkDeferredDisplayList.cpp
+++ b/src/core/SkDeferredDisplayList.cpp
@@ -12,7 +12,7 @@
class SkSurfaceCharacterization;
#if SK_SUPPORT_GPU
-#include "include/private/GrOpList.h"
+#include "src/gpu/GrOpList.h"
#include "src/gpu/ccpr/GrCCPerOpListPaths.h"
#endif
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 6afce5a..5371f17 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -23,12 +23,12 @@
#if SK_SUPPORT_GPU
#include "include/gpu/GrContext.h"
#include "include/private/GrRecordingContext.h"
-#include "include/private/GrTextureProxy.h"
#include "src/gpu/GrColorSpaceXform.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrFixedClip.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/SkGr.h"
#endif
#include <atomic>
diff --git a/src/core/SkImageGenerator.cpp b/src/core/SkImageGenerator.cpp
index dade54d..c51c1b0 100644
--- a/src/core/SkImageGenerator.cpp
+++ b/src/core/SkImageGenerator.cpp
@@ -59,7 +59,7 @@
}
#if SK_SUPPORT_GPU
-#include "include/private/GrTextureProxy.h"
+#include "src/gpu/GrTextureProxy.h"
sk_sp<GrTextureProxy> SkImageGenerator::generateTexture(GrRecordingContext* ctx,
const SkImageInfo& info,
diff --git a/src/core/SkMaskFilter.cpp b/src/core/SkMaskFilter.cpp
index 505019b..70d5600 100644
--- a/src/core/SkMaskFilter.cpp
+++ b/src/core/SkMaskFilter.cpp
@@ -20,8 +20,8 @@
#include "src/core/SkWriteBuffer.h"
#if SK_SUPPORT_GPU
-#include "include/private/GrTextureProxy.h"
#include "src/gpu/GrFragmentProcessor.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/effects/GrXfermodeFragmentProcessor.h"
#include "src/gpu/text/GrSDFMaskFilter.h"
#endif
diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp
index 0104366..7a39314 100644
--- a/src/core/SkSpecialImage.cpp
+++ b/src/core/SkSpecialImage.cpp
@@ -18,11 +18,11 @@
#if SK_SUPPORT_GPU
#include "include/gpu/GrContext.h"
#include "include/private/GrRecordingContext.h"
-#include "include/private/GrTextureProxy.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrSurfaceContext.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/image/SkImage_Gpu.h"
#endif
diff --git a/src/effects/imagefilters/SkAlphaThresholdFilter.cpp b/src/effects/imagefilters/SkAlphaThresholdFilter.cpp
index a66a09c..0c90091 100644
--- a/src/effects/imagefilters/SkAlphaThresholdFilter.cpp
+++ b/src/effects/imagefilters/SkAlphaThresholdFilter.cpp
@@ -17,12 +17,12 @@
#if SK_SUPPORT_GPU
#include "include/gpu/GrContext.h"
#include "include/private/GrRecordingContext.h"
-#include "include/private/GrTextureProxy.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrColorSpaceXform.h"
#include "src/gpu/GrFixedClip.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/effects/generated/GrAlphaThresholdFragmentProcessor.h"
#include "src/gpu/effects/generated/GrSimpleTextureEffect.h"
#endif
diff --git a/src/effects/imagefilters/SkArithmeticImageFilter.cpp b/src/effects/imagefilters/SkArithmeticImageFilter.cpp
index 9ca4192..c5ff816 100644
--- a/src/effects/imagefilters/SkArithmeticImageFilter.cpp
+++ b/src/effects/imagefilters/SkArithmeticImageFilter.cpp
@@ -16,11 +16,11 @@
#include "src/core/SkWriteBuffer.h"
#if SK_SUPPORT_GPU
#include "include/private/GrRecordingContext.h"
-#include "include/private/GrTextureProxy.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrColorSpaceXform.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/effects/GrSkSLFP.h"
#include "src/gpu/effects/GrTextureDomain.h"
diff --git a/src/effects/imagefilters/SkBlurImageFilter.cpp b/src/effects/imagefilters/SkBlurImageFilter.cpp
index 6148b2b..2170c0c 100644
--- a/src/effects/imagefilters/SkBlurImageFilter.cpp
+++ b/src/effects/imagefilters/SkBlurImageFilter.cpp
@@ -24,7 +24,7 @@
#if SK_SUPPORT_GPU
#include "include/gpu/GrContext.h"
-#include "include/private/GrTextureProxy.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/SkGr.h"
#endif
diff --git a/src/effects/imagefilters/SkDisplacementMapEffect.cpp b/src/effects/imagefilters/SkDisplacementMapEffect.cpp
index 7d969ee..c176f45 100644
--- a/src/effects/imagefilters/SkDisplacementMapEffect.cpp
+++ b/src/effects/imagefilters/SkDisplacementMapEffect.cpp
@@ -17,13 +17,13 @@
#if SK_SUPPORT_GPU
#include "include/gpu/GrTexture.h"
#include "include/private/GrRecordingContext.h"
-#include "include/private/GrTextureProxy.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrColorSpaceXform.h"
#include "src/gpu/GrCoordTransform.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/effects/GrTextureDomain.h"
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
diff --git a/src/effects/imagefilters/SkLightingImageFilter.cpp b/src/effects/imagefilters/SkLightingImageFilter.cpp
index e89542d..c1a8a7b 100644
--- a/src/effects/imagefilters/SkLightingImageFilter.cpp
+++ b/src/effects/imagefilters/SkLightingImageFilter.cpp
@@ -18,13 +18,13 @@
#if SK_SUPPORT_GPU
#include "include/gpu/GrTexture.h"
#include "include/private/GrRecordingContext.h"
-#include "include/private/GrTextureProxy.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrFixedClip.h"
#include "src/gpu/GrFragmentProcessor.h"
#include "src/gpu/GrPaint.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/effects/GrTextureDomain.h"
diff --git a/src/effects/imagefilters/SkMatrixConvolutionImageFilter.cpp b/src/effects/imagefilters/SkMatrixConvolutionImageFilter.cpp
index d4632a8..52db6c5 100644
--- a/src/effects/imagefilters/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/imagefilters/SkMatrixConvolutionImageFilter.cpp
@@ -17,7 +17,7 @@
#if SK_SUPPORT_GPU
#include "include/gpu/GrContext.h"
-#include "include/private/GrTextureProxy.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/effects/GrMatrixConvolutionEffect.h"
#endif
diff --git a/src/effects/imagefilters/SkMorphologyImageFilter.cpp b/src/effects/imagefilters/SkMorphologyImageFilter.cpp
index ae3328c..86cd55e 100644
--- a/src/effects/imagefilters/SkMorphologyImageFilter.cpp
+++ b/src/effects/imagefilters/SkMorphologyImageFilter.cpp
@@ -19,12 +19,12 @@
#include "include/gpu/GrContext.h"
#include "include/gpu/GrTexture.h"
#include "include/private/GrRecordingContext.h"
-#include "include/private/GrTextureProxy.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrCoordTransform.h"
#include "src/gpu/GrFixedClip.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
diff --git a/src/effects/imagefilters/SkXfermodeImageFilter.cpp b/src/effects/imagefilters/SkXfermodeImageFilter.cpp
index 53fbdcb..ff66985 100644
--- a/src/effects/imagefilters/SkXfermodeImageFilter.cpp
+++ b/src/effects/imagefilters/SkXfermodeImageFilter.cpp
@@ -16,12 +16,12 @@
#include "src/core/SkWriteBuffer.h"
#if SK_SUPPORT_GPU
#include "include/private/GrRecordingContext.h"
-#include "include/private/GrTextureProxy.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrColorSpaceXform.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/effects/GrTextureDomain.h"
diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp
index 8bb6be5..6bf0b2c 100644
--- a/src/gpu/GrAHardwareBufferImageGenerator.cpp
+++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp
@@ -21,7 +21,6 @@
#include "include/gpu/GrTexture.h"
#include "include/gpu/gl/GrGLTypes.h"
#include "include/private/GrRecordingContext.h"
-#include "include/private/GrTextureProxy.h"
#include "src/core/SkExchange.h"
#include "src/core/SkMessageBus.h"
#include "src/gpu/GrAHardwareBufferUtils.h"
@@ -31,6 +30,7 @@
#include "src/gpu/GrResourceCache.h"
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/GrResourceProviderPriv.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/gl/GrGLDefines.h"
#include <EGL/egl.h>
diff --git a/src/gpu/GrAuditTrail.cpp b/src/gpu/GrAuditTrail.cpp
index 92b9066..609fe84 100644
--- a/src/gpu/GrAuditTrail.cpp
+++ b/src/gpu/GrAuditTrail.cpp
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
-#include "include/private/GrAuditTrail.h"
+#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/ops/GrOp.h"
#include "src/utils/SkJSONWriter.h"
diff --git a/src/gpu/GrAuditTrail.h b/src/gpu/GrAuditTrail.h
new file mode 100644
index 0000000..74f47d3
--- /dev/null
+++ b/src/gpu/GrAuditTrail.h
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrAuditTrail_DEFINED
+#define GrAuditTrail_DEFINED
+
+#include "include/core/SkRect.h"
+#include "include/core/SkString.h"
+#include "include/gpu/GrConfig.h"
+#include "include/gpu/GrGpuResource.h"
+#include "include/private/SkTArray.h"
+#include "include/private/SkTHash.h"
+#include "src/gpu/GrRenderTargetProxy.h"
+
+class GrOp;
+class SkJSONWriter;
+
+/*
+ * GrAuditTrail collects a list of draw ops, detailed information about those ops, and can dump them
+ * to json.
+ *
+ * Capturing this information is expensive and consumes a lot of memory, therefore it is important
+ * to enable auditing only when required and disable it promptly. The AutoEnable class helps to
+ * ensure that the audit trail is disabled in a timely fashion. Once the information has been dealt
+ * with, be sure to call reset(), or the log will simply keep growing.
+ */
+class GrAuditTrail {
+public:
+ GrAuditTrail()
+ : fClientID(kGrAuditTrailInvalidID)
+ , fEnabled(false) {}
+
+ class AutoEnable {
+ public:
+ AutoEnable(GrAuditTrail* auditTrail)
+ : fAuditTrail(auditTrail) {
+ SkASSERT(!fAuditTrail->isEnabled());
+ fAuditTrail->setEnabled(true);
+ }
+
+ ~AutoEnable() {
+ SkASSERT(fAuditTrail->isEnabled());
+ fAuditTrail->setEnabled(false);
+ }
+
+ private:
+ GrAuditTrail* fAuditTrail;
+ };
+
+ class AutoManageOpList {
+ public:
+ AutoManageOpList(GrAuditTrail* auditTrail)
+ : fAutoEnable(auditTrail), fAuditTrail(auditTrail) {}
+
+ ~AutoManageOpList() { fAuditTrail->fullReset(); }
+
+ private:
+ AutoEnable fAutoEnable;
+ GrAuditTrail* fAuditTrail;
+ };
+
+ class AutoCollectOps {
+ public:
+ AutoCollectOps(GrAuditTrail* auditTrail, int clientID)
+ : fAutoEnable(auditTrail), fAuditTrail(auditTrail) {
+ fAuditTrail->setClientID(clientID);
+ }
+
+ ~AutoCollectOps() { fAuditTrail->setClientID(kGrAuditTrailInvalidID); }
+
+ private:
+ AutoEnable fAutoEnable;
+ GrAuditTrail* fAuditTrail;
+ };
+
+ void pushFrame(const char* framename) {
+ SkASSERT(fEnabled);
+ fCurrentStackTrace.push_back(SkString(framename));
+ }
+
+ void addOp(const GrOp*, GrRenderTargetProxy::UniqueID proxyID);
+
+ void opsCombined(const GrOp* consumer, const GrOp* consumed);
+
+ // Because op combining is heavily dependent on sequence of draw calls, these calls will only
+ // produce valid information for the given draw sequence which preceeded them. Specifically, ops
+ // of future draw calls may combine with previous ops and thus would invalidate the json. What
+ // this means is that for some sequence of draw calls N, the below toJson calls will only
+ // produce JSON which reflects N draw calls. This JSON may or may not be accurate for N + 1 or
+ // N - 1 draws depending on the actual combining algorithm used.
+ void toJson(SkJSONWriter& writer) const;
+
+ // returns a json string of all of the ops associated with a given client id
+ void toJson(SkJSONWriter& writer, int clientID) const;
+
+ bool isEnabled() { return fEnabled; }
+ void setEnabled(bool enabled) { fEnabled = enabled; }
+
+ void setClientID(int clientID) { fClientID = clientID; }
+
+ // We could just return our internal bookkeeping struct if copying the data out becomes
+ // a performance issue, but until then its nice to decouple
+ struct OpInfo {
+ struct Op {
+ int fClientID;
+ SkRect fBounds;
+ };
+
+ SkRect fBounds;
+ GrSurfaceProxy::UniqueID fProxyUniqueID;
+ SkTArray<Op> fOps;
+ };
+
+ void getBoundsByClientID(SkTArray<OpInfo>* outInfo, int clientID);
+ void getBoundsByOpListID(OpInfo* outInfo, int opListID);
+
+ void fullReset();
+
+ static const int kGrAuditTrailInvalidID;
+
+private:
+ // TODO if performance becomes an issue, we can move to using SkVarAlloc
+ struct Op {
+ void toJson(SkJSONWriter& writer) const;
+ SkString fName;
+ SkTArray<SkString> fStackTrace;
+ SkRect fBounds;
+ int fClientID;
+ int fOpListID;
+ int fChildID;
+ };
+ typedef SkTArray<std::unique_ptr<Op>, true> OpPool;
+
+ typedef SkTArray<Op*> Ops;
+
+ struct OpNode {
+ OpNode(const GrSurfaceProxy::UniqueID& proxyID) : fProxyUniqueID(proxyID) { }
+ void toJson(SkJSONWriter& writer) const;
+
+ SkRect fBounds;
+ Ops fChildren;
+ const GrSurfaceProxy::UniqueID fProxyUniqueID;
+ };
+ typedef SkTArray<std::unique_ptr<OpNode>, true> OpList;
+
+ void copyOutFromOpList(OpInfo* outOpInfo, int opListID);
+
+ template <typename T>
+ static void JsonifyTArray(SkJSONWriter& writer, const char* name, const T& array);
+
+ OpPool fOpPool;
+ SkTHashMap<uint32_t, int> fIDLookup;
+ SkTHashMap<int, Ops*> fClientIDLookup;
+ OpList fOpList;
+ SkTArray<SkString> fCurrentStackTrace;
+
+ // The client can pass in an optional client ID which we will use to mark the ops
+ int fClientID;
+ bool fEnabled;
+};
+
+#define GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, invoke, ...) \
+ if (audit_trail->isEnabled()) audit_trail->invoke(__VA_ARGS__)
+
+#define GR_AUDIT_TRAIL_AUTO_FRAME(audit_trail, framename) \
+ GR_AUDIT_TRAIL_INVOKE_GUARD((audit_trail), pushFrame, framename)
+
+#define GR_AUDIT_TRAIL_RESET(audit_trail) \
+ //GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, fullReset);
+
+#define GR_AUDIT_TRAIL_ADD_OP(audit_trail, op, proxy_id) \
+ GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, addOp, op, proxy_id)
+
+#define GR_AUDIT_TRAIL_OPS_RESULT_COMBINED(audit_trail, combineWith, op) \
+ GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, opsCombined, combineWith, op)
+
+#endif
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index f35507b..577641a 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -8,7 +8,6 @@
#include "src/gpu/GrBlurUtils.h"
#include "include/private/GrRecordingContext.h"
-#include "include/private/GrTextureProxy.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrFixedClip.h"
#include "src/gpu/GrProxyProvider.h"
@@ -17,6 +16,7 @@
#include "src/gpu/GrRenderTargetContextPriv.h"
#include "src/gpu/GrSoftwarePathRenderer.h"
#include "src/gpu/GrStyle.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/effects/generated/GrSimpleTextureEffect.h"
#include "src/gpu/geometry/GrShape.h"
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index 74e3b70..8932a48 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -8,9 +8,9 @@
#include "include/gpu/GrBackendSurface.h"
#include "include/gpu/GrContextOptions.h"
#include "include/gpu/GrSurface.h"
-#include "include/private/GrSurfaceProxy.h"
#include "include/private/GrTypesPriv.h"
#include "src/gpu/GrCaps.h"
+#include "src/gpu/GrSurfaceProxy.h"
#include "src/gpu/GrWindowRectangles.h"
#include "src/utils/SkJSONWriter.h"
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 43342ed..48d4cb4 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -5,7 +5,6 @@
* found in the LICENSE file.
*/
-#include "include/private/GrTextureProxy.h"
#include "include/private/SkTo.h"
#include "src/core/SkClipOpPriv.h"
#include "src/core/SkMakeUnique.h"
@@ -24,6 +23,7 @@
#include "src/gpu/GrSWMaskHelper.h"
#include "src/gpu/GrStencilAttachment.h"
#include "src/gpu/GrStyle.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/effects/GrConvexPolyEffect.h"
#include "src/gpu/effects/GrRRectEffect.h"
#include "src/gpu/effects/GrTextureDomain.h"
diff --git a/src/gpu/GrColor.h b/src/gpu/GrColor.h
new file mode 100644
index 0000000..39e7bfa
--- /dev/null
+++ b/src/gpu/GrColor.h
@@ -0,0 +1,113 @@
+
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+
+
+#ifndef GrColor_DEFINED
+#define GrColor_DEFINED
+
+#include "include/core/SkColor.h"
+#include "include/core/SkColorPriv.h"
+#include "include/gpu/GrTypes.h"
+#include "include/private/SkColorData.h"
+#include "include/private/SkHalf.h"
+
+/**
+ * GrColor is 4 bytes for R, G, B, A, in a specific order defined below. Whether the color is
+ * premultiplied or not depends on the context in which it is being used.
+ */
+typedef uint32_t GrColor;
+
+// shift amount to assign a component to a GrColor int
+// These shift values are chosen for compatibility with GL attrib arrays
+// ES doesn't allow BGRA vertex attrib order so if they were not in this order
+// we'd have to swizzle in shaders.
+#ifdef SK_CPU_BENDIAN
+ #define GrColor_SHIFT_R 24
+ #define GrColor_SHIFT_G 16
+ #define GrColor_SHIFT_B 8
+ #define GrColor_SHIFT_A 0
+#else
+ #define GrColor_SHIFT_R 0
+ #define GrColor_SHIFT_G 8
+ #define GrColor_SHIFT_B 16
+ #define GrColor_SHIFT_A 24
+#endif
+
+/**
+ * Pack 4 components (RGBA) into a GrColor int
+ */
+static inline GrColor GrColorPackRGBA(unsigned r, unsigned g, unsigned b, unsigned a) {
+ SkASSERT((uint8_t)r == r);
+ SkASSERT((uint8_t)g == g);
+ SkASSERT((uint8_t)b == b);
+ SkASSERT((uint8_t)a == a);
+ return (r << GrColor_SHIFT_R) |
+ (g << GrColor_SHIFT_G) |
+ (b << GrColor_SHIFT_B) |
+ (a << GrColor_SHIFT_A);
+}
+
+// extract a component (byte) from a GrColor int
+
+#define GrColorUnpackR(color) (((color) >> GrColor_SHIFT_R) & 0xFF)
+#define GrColorUnpackG(color) (((color) >> GrColor_SHIFT_G) & 0xFF)
+#define GrColorUnpackB(color) (((color) >> GrColor_SHIFT_B) & 0xFF)
+#define GrColorUnpackA(color) (((color) >> GrColor_SHIFT_A) & 0xFF)
+
+/**
+ * Since premultiplied means that alpha >= color, we construct a color with
+ * each component==255 and alpha == 0 to be "illegal"
+ */
+#define GrColor_ILLEGAL (~(0xFF << GrColor_SHIFT_A))
+
+/** Normalizes and coverts an uint8_t to a float. [0, 255] -> [0.0, 1.0] */
+static inline float GrNormalizeByteToFloat(uint8_t value) {
+ static const float ONE_OVER_255 = 1.f / 255.f;
+ return value * ONE_OVER_255;
+}
+
+/** Used to pick vertex attribute types. */
+static inline bool SkPMColor4fFitsInBytes(const SkPMColor4f& color) {
+ // Might want to instead check that the components are [0...a] instead of [0...1]?
+ return color.fitsInBytes();
+}
+
+static inline uint64_t SkPMColor4f_toFP16(const SkPMColor4f& color) {
+ uint64_t halfColor;
+ SkFloatToHalf_finite_ftz(Sk4f::Load(color.vec())).store(&halfColor);
+ return halfColor;
+}
+
+/**
+ * GrVertexColor is a helper for writing colors to a vertex attribute. It stores either GrColor
+ * or four half-float channels, depending on the wideColor parameter. GrVertexWriter will write
+ * the correct amount of data. Note that the GP needs to have been constructed with the correct
+ * attribute type for colors, to match the usage here.
+ */
+class GrVertexColor {
+public:
+ explicit GrVertexColor(const SkPMColor4f& color, bool wideColor)
+ : fWideColor(wideColor) {
+ if (wideColor) {
+ SkFloatToHalf_finite_ftz(Sk4f::Load(color.vec())).store(&fColor);
+ } else {
+ fColor[0] = color.toBytes_RGBA();
+ }
+ }
+
+ size_t size() const { return fWideColor ? 8 : 4; }
+
+private:
+ friend struct GrVertexWriter;
+
+ uint32_t fColor[2];
+ bool fWideColor;
+};
+
+#endif
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index f5cbb53..2226247 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -8,7 +8,6 @@
#include "include/core/SkTraceMemoryDump.h"
#include "include/gpu/GrBackendSemaphore.h"
#include "include/gpu/GrContext.h"
-#include "include/private/GrRenderTargetProxy.h"
#include "include/private/SkDeferredDisplayList.h"
#include "include/private/SkImageInfoPriv.h"
#include "src/core/SkMakeUnique.h"
@@ -18,6 +17,7 @@
#include "src/gpu/GrMemoryPool.h"
#include "src/gpu/GrPathRendererChain.h"
#include "src/gpu/GrProxyProvider.h"
+#include "src/gpu/GrRenderTargetProxy.h"
#include "src/gpu/GrResourceCache.h"
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/GrSemaphore.h"
@@ -318,7 +318,7 @@
//////////////////////////////////////////////////////////////////////////////
GrBackendTexture GrContext::createBackendTexture(int width, int height,
- GrBackendFormat backendFormat,
+ const GrBackendFormat& backendFormat,
GrMipMapped mipMapped,
GrRenderable renderable) {
if (!this->asDirectContext()) {
@@ -359,7 +359,7 @@
}
GrBackendTexture GrContext::createBackendTexture(int width, int height,
- GrBackendFormat backendFormat,
+ const GrBackendFormat& backendFormat,
const SkColor4f& color,
GrMipMapped mipMapped,
GrRenderable renderable) {
diff --git a/src/gpu/GrContextPriv.cpp b/src/gpu/GrContextPriv.cpp
index 174de02..562ba85 100644
--- a/src/gpu/GrContextPriv.cpp
+++ b/src/gpu/GrContextPriv.cpp
@@ -9,12 +9,13 @@
#include "include/gpu/GrContextThreadSafeProxy.h"
#include "include/gpu/GrTexture.h"
-#include "include/private/GrSkSLFPFactoryCache.h"
+#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrContextThreadSafeProxyPriv.h"
#include "src/gpu/GrDrawingManager.h"
#include "src/gpu/GrGpu.h"
#include "src/gpu/GrMemoryPool.h"
#include "src/gpu/GrRenderTargetContext.h"
+#include "src/gpu/GrSkSLFPFactoryCache.h"
#include "src/gpu/GrSurfaceContextPriv.h"
#include "src/gpu/GrSurfacePriv.h"
#include "src/gpu/GrTextureContext.h"
diff --git a/src/gpu/GrContextThreadSafeProxy.cpp b/src/gpu/GrContextThreadSafeProxy.cpp
index 77fb801..428fcde 100644
--- a/src/gpu/GrContextThreadSafeProxy.cpp
+++ b/src/gpu/GrContextThreadSafeProxy.cpp
@@ -10,9 +10,9 @@
#include "include/core/SkSurfaceCharacterization.h"
#include "include/gpu/GrContext.h"
-#include "include/private/GrSkSLFPFactoryCache.h"
#include "src/gpu/GrBaseContextPriv.h"
#include "src/gpu/GrCaps.h"
+#include "src/gpu/GrSkSLFPFactoryCache.h"
#include "src/image/SkSurface_Gpu.h"
GrContextThreadSafeProxy::GrContextThreadSafeProxy(GrBackendApi backend,
diff --git a/src/gpu/GrContext_Base.cpp b/src/gpu/GrContext_Base.cpp
index d462c9c..31e7ff1 100644
--- a/src/gpu/GrContext_Base.cpp
+++ b/src/gpu/GrContext_Base.cpp
@@ -7,9 +7,9 @@
#include "include/private/GrContext_Base.h"
-#include "include/private/GrSkSLFPFactoryCache.h"
#include "src/gpu/GrBaseContextPriv.h"
#include "src/gpu/GrCaps.h"
+#include "src/gpu/GrSkSLFPFactoryCache.h"
static int32_t next_id() {
static std::atomic<int32_t> nextID{1};
diff --git a/src/gpu/GrCoordTransform.h b/src/gpu/GrCoordTransform.h
index ff6ed92..fac7844 100644
--- a/src/gpu/GrCoordTransform.h
+++ b/src/gpu/GrCoordTransform.h
@@ -9,8 +9,8 @@
#define GrCoordTransform_DEFINED
#include "include/core/SkMatrix.h"
-#include "include/private/GrTextureProxy.h"
#include "src/gpu/GrSurfaceProxyPriv.h"
+#include "src/gpu/GrTextureProxy.h"
class GrTexture;
diff --git a/src/gpu/GrDDLContext.cpp b/src/gpu/GrDDLContext.cpp
index 1939348..27a8667 100644
--- a/src/gpu/GrDDLContext.cpp
+++ b/src/gpu/GrDDLContext.cpp
@@ -6,10 +6,10 @@
*/
#include "include/gpu/GrContext.h"
-#include "include/private/GrSkSLFPFactoryCache.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrContextThreadSafeProxyPriv.h"
+#include "src/gpu/GrSkSLFPFactoryCache.h"
/**
* The DDL Context is the one in effect during DDL Recording. It isn't backed by a GrGPU and
diff --git a/src/gpu/GrDataUtils.cpp b/src/gpu/GrDataUtils.cpp
index 965251e..9537e73 100644
--- a/src/gpu/GrDataUtils.cpp
+++ b/src/gpu/GrDataUtils.cpp
@@ -7,8 +7,8 @@
#include "src/gpu/GrDataUtils.h"
-#include "include/private/GrColor.h"
#include "src/core/SkUtils.h"
+#include "src/gpu/GrColor.h"
struct ETC1Block {
uint32_t fHigh;
diff --git a/src/gpu/GrDeinstantiateProxyTracker.cpp b/src/gpu/GrDeinstantiateProxyTracker.cpp
index 0aa4b75..25c1d15 100644
--- a/src/gpu/GrDeinstantiateProxyTracker.cpp
+++ b/src/gpu/GrDeinstantiateProxyTracker.cpp
@@ -7,7 +7,7 @@
#include "src/gpu/GrDeinstantiateProxyTracker.h"
-#include "include/private/GrSurfaceProxy.h"
+#include "src/gpu/GrSurfaceProxy.h"
#include "src/gpu/GrSurfaceProxyPriv.h"
void GrDeinstantiateProxyTracker::addProxy(GrSurfaceProxy* proxy) {
diff --git a/src/gpu/GrDeinstantiateProxyTracker.h b/src/gpu/GrDeinstantiateProxyTracker.h
index 32a8771..06f0b1d 100644
--- a/src/gpu/GrDeinstantiateProxyTracker.h
+++ b/src/gpu/GrDeinstantiateProxyTracker.h
@@ -8,8 +8,8 @@
#ifndef GrDeinstantiateProxyTracker_DEFINED
#define GrDeinstantiateProxyTracker_DEFINED
-#include "include/private/GrSurfaceProxy.h"
#include "include/private/SkTArray.h"
+#include "src/gpu/GrSurfaceProxy.h"
class GrResourceCache;
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 217d56e..5cedb39 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -9,18 +9,18 @@
#include "include/gpu/GrBackendSemaphore.h"
#include "include/gpu/GrTexture.h"
-#include "include/private/GrOpList.h"
#include "include/private/GrRecordingContext.h"
-#include "include/private/GrRenderTargetProxy.h"
-#include "include/private/GrTextureProxy.h"
#include "include/private/SkDeferredDisplayList.h"
#include "src/core/SkTTopoSort.h"
+#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGpu.h"
#include "src/gpu/GrMemoryPool.h"
#include "src/gpu/GrOnFlushResourceProvider.h"
+#include "src/gpu/GrOpList.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
+#include "src/gpu/GrRenderTargetProxy.h"
#include "src/gpu/GrResourceAllocator.h"
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/GrSoftwarePathRenderer.h"
@@ -28,6 +28,7 @@
#include "src/gpu/GrTextureContext.h"
#include "src/gpu/GrTextureOpList.h"
#include "src/gpu/GrTexturePriv.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/GrTextureProxyPriv.h"
#include "src/gpu/GrTracing.h"
#include "src/gpu/ccpr/GrCoverageCountingPathRenderer.h"
diff --git a/src/gpu/GrFragmentProcessor.h b/src/gpu/GrFragmentProcessor.h
index 46333d4..92ab9c0 100644
--- a/src/gpu/GrFragmentProcessor.h
+++ b/src/gpu/GrFragmentProcessor.h
@@ -8,8 +8,8 @@
#ifndef GrFragmentProcessor_DEFINED
#define GrFragmentProcessor_DEFINED
-#include "include/private/GrProxyRef.h"
#include "src/gpu/GrProcessor.h"
+#include "src/gpu/GrProxyRef.h"
#include "src/gpu/ops/GrOp.h"
class GrCoordTransform;
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index caa17d3..1b737d4 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -12,6 +12,7 @@
#include "include/gpu/GrBackendSurface.h"
#include "include/gpu/GrContext.h"
#include "src/core/SkMathPriv.h"
+#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGpuResourcePriv.h"
diff --git a/src/gpu/GrImageContext.cpp b/src/gpu/GrImageContext.cpp
index 8a66eab..db4c9cb 100644
--- a/src/gpu/GrImageContext.cpp
+++ b/src/gpu/GrImageContext.cpp
@@ -7,10 +7,10 @@
#include "include/private/GrImageContext.h"
-#include "include/private/GrSkSLFPFactoryCache.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrImageContextPriv.h"
#include "src/gpu/GrProxyProvider.h"
+#include "src/gpu/GrSkSLFPFactoryCache.h"
#define ASSERT_SINGLE_OWNER \
SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(this->singleOwner());)
diff --git a/src/gpu/GrOnFlushResourceProvider.cpp b/src/gpu/GrOnFlushResourceProvider.cpp
index f84f2fe..0b607aa 100644
--- a/src/gpu/GrOnFlushResourceProvider.cpp
+++ b/src/gpu/GrOnFlushResourceProvider.cpp
@@ -8,12 +8,12 @@
#include "src/gpu/GrOnFlushResourceProvider.h"
#include "include/private/GrRecordingContext.h"
-#include "include/private/GrSurfaceProxy.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrDrawingManager.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
+#include "src/gpu/GrSurfaceProxy.h"
sk_sp<GrRenderTargetContext> GrOnFlushResourceProvider::makeRenderTargetContext(
sk_sp<GrSurfaceProxy> proxy,
diff --git a/src/gpu/GrOpFlushState.h b/src/gpu/GrOpFlushState.h
index ad0260f..3eeb5fc 100644
--- a/src/gpu/GrOpFlushState.h
+++ b/src/gpu/GrOpFlushState.h
@@ -9,13 +9,13 @@
#define GrOpFlushState_DEFINED
#include <utility>
-#include "include/private/GrRenderTargetProxy.h"
#include "src/core/SkArenaAlloc.h"
#include "src/core/SkArenaAllocList.h"
#include "src/gpu/GrAppliedClip.h"
#include "src/gpu/GrBufferAllocPool.h"
#include "src/gpu/GrDeferredUpload.h"
#include "src/gpu/GrDeinstantiateProxyTracker.h"
+#include "src/gpu/GrRenderTargetProxy.h"
#include "src/gpu/ops/GrMeshDrawOp.h"
class GrGpu;
diff --git a/src/gpu/GrOpList.cpp b/src/gpu/GrOpList.cpp
index 6704a43..9d85aa8 100644
--- a/src/gpu/GrOpList.cpp
+++ b/src/gpu/GrOpList.cpp
@@ -5,13 +5,13 @@
* found in the LICENSE file.
*/
-#include "include/private/GrOpList.h"
+#include "src/gpu/GrOpList.h"
#include "include/gpu/GrContext.h"
-#include "include/private/GrSurfaceProxy.h"
#include "src/gpu/GrDeferredProxyUploader.h"
#include "src/gpu/GrMemoryPool.h"
#include "src/gpu/GrRenderTargetPriv.h"
+#include "src/gpu/GrSurfaceProxy.h"
#include "src/gpu/GrTextureProxyPriv.h"
#include <atomic>
diff --git a/src/gpu/GrOpList.h b/src/gpu/GrOpList.h
new file mode 100644
index 0000000..066582b
--- /dev/null
+++ b/src/gpu/GrOpList.h
@@ -0,0 +1,196 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrOpList_DEFINED
+#define GrOpList_DEFINED
+
+#include "include/core/SkRefCnt.h"
+#include "include/private/SkColorData.h"
+#include "include/private/SkTDArray.h"
+#include "src/gpu/GrProxyRef.h"
+#include "src/gpu/GrTextureProxy.h"
+
+class GrAuditTrail;
+class GrCaps;
+class GrOpFlushState;
+class GrOpMemoryPool;
+class GrRecordingContext;
+class GrRenderTargetOpList;
+class GrResourceAllocator;
+class GrResourceProvider;
+class GrSurfaceProxy;
+class GrTextureOpList;
+
+struct SkIPoint;
+struct SkIRect;
+
+class GrOpList : public SkRefCnt {
+public:
+ GrOpList(sk_sp<GrOpMemoryPool>, sk_sp<GrSurfaceProxy>, GrAuditTrail*);
+ ~GrOpList() override;
+
+ // These four methods are invoked at flush time
+ bool instantiate(GrResourceProvider* resourceProvider);
+ // Instantiates any "threaded" texture proxies that are being prepared elsewhere
+ void instantiateDeferredProxies(GrResourceProvider* resourceProvider);
+ void prepare(GrOpFlushState* flushState);
+ bool execute(GrOpFlushState* flushState) { return this->onExecute(flushState); }
+
+ virtual bool copySurface(GrRecordingContext*,
+ GrSurfaceProxy* dst,
+ GrSurfaceProxy* src,
+ const SkIRect& srcRect,
+ const SkIPoint& dstPoint) = 0;
+
+ virtual void makeClosed(const GrCaps&) {
+ if (!this->isClosed()) {
+ this->setFlag(kClosed_Flag);
+ }
+ }
+
+ // Called when this class will survive a flush and needs to truncate its ops and start over.
+ // TODO: ultimately it should be invalid for an op list to survive a flush.
+ // https://bugs.chromium.org/p/skia/issues/detail?id=7111
+ virtual void endFlush();
+
+ bool isClosed() const { return this->isSetFlag(kClosed_Flag); }
+
+ /*
+ * Notify this GrOpList that it relies on the contents of 'dependedOn'
+ */
+ void addDependency(GrSurfaceProxy* dependedOn, const GrCaps& caps);
+
+ /*
+ * Does this opList depend on 'dependedOn'?
+ */
+ bool dependsOn(const GrOpList* dependedOn) const;
+
+ /*
+ * Safely cast this GrOpList to a GrTextureOpList (if possible).
+ */
+ virtual GrTextureOpList* asTextureOpList() { return nullptr; }
+
+ /*
+ * Safely case this GrOpList to a GrRenderTargetOpList (if possible).
+ */
+ virtual GrRenderTargetOpList* asRenderTargetOpList() { return nullptr; }
+
+ uint32_t uniqueID() const { return fUniqueID; }
+
+ /*
+ * Dump out the GrOpList dependency DAG
+ */
+ SkDEBUGCODE(virtual void dump(bool printDependencies) const;)
+
+ SkDEBUGCODE(virtual int numClips() const { return 0; })
+
+protected:
+ bool isInstantiated() const;
+
+ // In addition to just the GrSurface being allocated, has the stencil buffer been allocated (if
+ // it is required)?
+ bool isFullyInstantiated() const;
+
+ // This is a backpointer to the GrOpMemoryPool that holds the memory for this opLists' ops.
+ // In the DDL case, these back pointers keep the DDL's GrOpMemoryPool alive as long as its
+ // constituent opLists survive.
+ sk_sp<GrOpMemoryPool> fOpMemoryPool;
+ GrSurfaceProxyRef fTarget;
+ GrAuditTrail* fAuditTrail;
+
+ GrLoadOp fColorLoadOp = GrLoadOp::kLoad;
+ SkPMColor4f fLoadClearColor = SK_PMColor4fTRANSPARENT;
+ GrLoadOp fStencilLoadOp = GrLoadOp::kLoad;
+
+ // List of texture proxies whose contents are being prepared on a worker thread
+ SkTArray<GrTextureProxy*, true> fDeferredProxies;
+
+private:
+ friend class GrDrawingManager; // for resetFlag, TopoSortTraits & gatherProxyIntervals
+
+ virtual bool onIsUsed(GrSurfaceProxy*) const = 0;
+
+ bool isUsed(GrSurfaceProxy* proxy) const {
+ if (proxy == fTarget.get()) {
+ return true;
+ }
+
+ return this->onIsUsed(proxy);
+ }
+
+ void addDependency(GrOpList* dependedOn);
+ void addDependent(GrOpList* dependent);
+ SkDEBUGCODE(bool isDependedent(const GrOpList* dependent) const;)
+ SkDEBUGCODE(void validate() const;)
+ void closeThoseWhoDependOnMe(const GrCaps&);
+
+ // Remove all Ops which reference proxies that are not instantiated.
+ virtual void purgeOpsWithUninstantiatedProxies() = 0;
+
+ // Feed proxy usage intervals to the GrResourceAllocator class
+ virtual void gatherProxyIntervals(GrResourceAllocator*) const = 0;
+
+ static uint32_t CreateUniqueID();
+
+ enum Flags {
+ kClosed_Flag = 0x01, //!< This GrOpList can't accept any more ops
+
+ kWasOutput_Flag = 0x02, //!< Flag for topological sorting
+ kTempMark_Flag = 0x04, //!< Flag for topological sorting
+ };
+
+ void setFlag(uint32_t flag) {
+ fFlags |= flag;
+ }
+
+ void resetFlag(uint32_t flag) {
+ fFlags &= ~flag;
+ }
+
+ bool isSetFlag(uint32_t flag) const {
+ return SkToBool(fFlags & flag);
+ }
+
+ struct TopoSortTraits {
+ static void Output(GrOpList* opList, int /* index */) {
+ opList->setFlag(GrOpList::kWasOutput_Flag);
+ }
+ static bool WasOutput(const GrOpList* opList) {
+ return opList->isSetFlag(GrOpList::kWasOutput_Flag);
+ }
+ static void SetTempMark(GrOpList* opList) {
+ opList->setFlag(GrOpList::kTempMark_Flag);
+ }
+ static void ResetTempMark(GrOpList* opList) {
+ opList->resetFlag(GrOpList::kTempMark_Flag);
+ }
+ static bool IsTempMarked(const GrOpList* opList) {
+ return opList->isSetFlag(GrOpList::kTempMark_Flag);
+ }
+ static int NumDependencies(const GrOpList* opList) {
+ return opList->fDependencies.count();
+ }
+ static GrOpList* Dependency(GrOpList* opList, int index) {
+ return opList->fDependencies[index];
+ }
+ };
+
+ virtual void onPrepare(GrOpFlushState* flushState) = 0;
+ virtual bool onExecute(GrOpFlushState* flushState) = 0;
+
+ uint32_t fUniqueID;
+ uint32_t fFlags;
+
+ // 'this' GrOpList relies on the output of the GrOpLists in 'fDependencies'
+ SkSTArray<1, GrOpList*, true> fDependencies;
+ // 'this' GrOpList's output is relied on by the GrOpLists in 'fDependents'
+ SkSTArray<1, GrOpList*, true> fDependents;
+
+ typedef SkRefCnt INHERITED;
+};
+
+#endif
diff --git a/src/gpu/GrPaint.h b/src/gpu/GrPaint.h
index 9f92dac..7aafcb6 100644
--- a/src/gpu/GrPaint.h
+++ b/src/gpu/GrPaint.h
@@ -13,8 +13,8 @@
#include "include/core/SkBlendMode.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkRegion.h"
-#include "include/private/GrColor.h"
#include "src/core/SkTLazy.h"
+#include "src/gpu/GrColor.h"
#include "src/gpu/GrFragmentProcessor.h"
class GrTextureProxy;
diff --git a/src/gpu/GrPendingIOResource.h b/src/gpu/GrPendingIOResource.h
index 229277b..09340fe 100644
--- a/src/gpu/GrPendingIOResource.h
+++ b/src/gpu/GrPendingIOResource.h
@@ -10,8 +10,8 @@
#include "include/core/SkRefCnt.h"
#include "include/gpu/GrGpuResource.h"
-#include "include/private/GrSurfaceProxy.h"
#include "include/private/SkNoncopyable.h"
+#include "src/gpu/GrSurfaceProxy.h"
class GrProxyPendingIO : SkNoncopyable {
public:
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h
index 819ef9b..a582e3b 100644
--- a/src/gpu/GrPipeline.h
+++ b/src/gpu/GrPipeline.h
@@ -10,7 +10,7 @@
#include "include/core/SkMatrix.h"
#include "include/core/SkRefCnt.h"
-#include "include/private/GrColor.h"
+#include "src/gpu/GrColor.h"
#include "src/gpu/GrFragmentProcessor.h"
#include "src/gpu/GrNonAtomicRef.h"
#include "src/gpu/GrPendingIOResource.h"
diff --git a/src/gpu/GrPrimitiveProcessor.h b/src/gpu/GrPrimitiveProcessor.h
index a5fc8be..e47f60a 100644
--- a/src/gpu/GrPrimitiveProcessor.h
+++ b/src/gpu/GrPrimitiveProcessor.h
@@ -8,10 +8,10 @@
#ifndef GrPrimitiveProcessor_DEFINED
#define GrPrimitiveProcessor_DEFINED
-#include "include/private/GrColor.h"
-#include "include/private/GrProxyRef.h"
+#include "src/gpu/GrColor.h"
#include "src/gpu/GrNonAtomicRef.h"
#include "src/gpu/GrProcessor.h"
+#include "src/gpu/GrProxyRef.h"
#include "src/gpu/GrShaderVar.h"
class GrCoordTransform;
diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp
index 2a58b54..e545933 100644
--- a/src/gpu/GrProcessor.cpp
+++ b/src/gpu/GrProcessor.cpp
@@ -7,12 +7,12 @@
#include "include/gpu/GrContext.h"
#include "include/gpu/GrSamplerState.h"
-#include "include/private/GrTextureProxy.h"
#include "include/private/SkSpinlock.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGeometryProcessor.h"
#include "src/gpu/GrMemoryPool.h"
#include "src/gpu/GrProcessor.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/GrXferProcessor.h"
#if GR_TEST_UTILS
diff --git a/src/gpu/GrProcessor.h b/src/gpu/GrProcessor.h
index 656f418..b6c88ef 100644
--- a/src/gpu/GrProcessor.h
+++ b/src/gpu/GrProcessor.h
@@ -11,12 +11,12 @@
#include "include/core/SkMath.h"
#include "include/core/SkString.h"
#include "include/gpu/GrSamplerState.h"
-#include "include/private/GrColor.h"
-#include "include/private/GrTextureProxy.h"
+#include "src/gpu/GrColor.h"
#include "src/gpu/GrGpuBuffer.h"
#include "src/gpu/GrProcessorUnitTest.h"
#include "src/gpu/GrShaderVar.h"
#include "src/gpu/GrSurfaceProxyPriv.h"
+#include "src/gpu/GrTextureProxy.h"
class GrContext;
class GrResourceProvider;
diff --git a/src/gpu/GrProcessorUnitTest.h b/src/gpu/GrProcessorUnitTest.h
index 8ed5297..0e9392a 100644
--- a/src/gpu/GrProcessorUnitTest.h
+++ b/src/gpu/GrProcessorUnitTest.h
@@ -12,9 +12,9 @@
#if GR_TEST_UTILS
-#include "include/private/GrTextureProxy.h"
#include "include/private/SkTArray.h"
#include "src/gpu/GrTestUtils.h"
+#include "src/gpu/GrTextureProxy.h"
class SkMatrix;
class GrCaps;
diff --git a/src/gpu/GrProgramDesc.h b/src/gpu/GrProgramDesc.h
index b320ebb..ed919ac 100644
--- a/src/gpu/GrProgramDesc.h
+++ b/src/gpu/GrProgramDesc.h
@@ -8,11 +8,11 @@
#ifndef GrProgramDesc_DEFINED
#define GrProgramDesc_DEFINED
-#include "include/private/GrColor.h"
#include "include/private/GrTypesPriv.h"
#include "include/private/SkTArray.h"
#include "include/private/SkTo.h"
#include "src/core/SkOpts.h"
+#include "src/gpu/GrColor.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
class GrShaderCaps;
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index bb9ca00..1331fe4 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -15,7 +15,6 @@
#include "include/private/GrImageContext.h"
#include "include/private/GrResourceKey.h"
#include "include/private/GrSingleOwner.h"
-#include "include/private/GrSurfaceProxy.h"
#include "include/private/SkImageInfoPriv.h"
#include "src/core/SkAutoPixmapStorage.h"
#include "src/core/SkImagePriv.h"
@@ -25,6 +24,7 @@
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrImageContextPriv.h"
#include "src/gpu/GrResourceProvider.h"
+#include "src/gpu/GrSurfaceProxy.h"
#include "src/gpu/GrSurfaceProxyPriv.h"
#include "src/gpu/GrTextureProxyCacheAccess.h"
#include "src/gpu/GrTextureRenderTargetProxy.h"
diff --git a/src/gpu/GrProxyProvider.h b/src/gpu/GrProxyProvider.h
index cc42269..bfa2243 100644
--- a/src/gpu/GrProxyProvider.h
+++ b/src/gpu/GrProxyProvider.h
@@ -10,8 +10,8 @@
#include "include/gpu/GrTypes.h"
#include "include/private/GrResourceKey.h"
-#include "include/private/GrTextureProxy.h"
#include "src/core/SkTDynamicHash.h"
+#include "src/gpu/GrTextureProxy.h"
class GrImageContext;
class GrBackendRenderTarget;
diff --git a/src/gpu/GrProxyRef.h b/src/gpu/GrProxyRef.h
new file mode 100644
index 0000000..5ea5c33
--- /dev/null
+++ b/src/gpu/GrProxyRef.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrProxyRef_DEFINED
+#define GrProxyRef_DEFINED
+
+#include "include/private/GrTypesPriv.h"
+#include "src/gpu/GrSurfaceProxy.h"
+#include "src/gpu/GrTextureProxy.h"
+
+/**
+ * Helper for owning a ref on a GrSurfaceProxy.
+ */
+template <typename T> class GrProxyRef {
+public:
+ GrProxyRef() = default;
+ GrProxyRef(const GrProxyRef&) = delete;
+ GrProxyRef& operator=(const GrProxyRef&) = delete;
+
+ GrProxyRef(sk_sp<T> proxy) { this->setProxy(std::move(proxy)); }
+
+ ~GrProxyRef() { this->reset(); }
+
+ void setProxy(sk_sp<T> proxy) {
+ SkASSERT(SkToBool(fProxy) == fOwnRef);
+ SkSafeUnref(fProxy);
+ if (!proxy) {
+ fProxy = nullptr;
+ fOwnRef = false;
+ } else {
+ fProxy = proxy.release(); // due to the semantics of this class we unpack from sk_sp
+ fOwnRef = true;
+ }
+ }
+
+ T* get() const { return fProxy; }
+
+ // Shortcut for calling setProxy() with NULL.
+ void reset() {
+ if (fOwnRef) {
+ SkASSERT(fProxy);
+ fProxy->unref();
+ fOwnRef = false;
+ }
+ fProxy = nullptr;
+ }
+
+private:
+ T* fProxy = nullptr;
+ mutable bool fOwnRef = false;
+};
+
+using GrSurfaceProxyRef = GrProxyRef<GrSurfaceProxy>;
+using GrTextureProxyRef = GrProxyRef<GrTextureProxy>;
+
+#endif
diff --git a/src/gpu/GrRecordingContext.cpp b/src/gpu/GrRecordingContext.cpp
index 1117ff1..bdf5edf 100644
--- a/src/gpu/GrRecordingContext.cpp
+++ b/src/gpu/GrRecordingContext.cpp
@@ -8,13 +8,14 @@
#include "include/private/GrRecordingContext.h"
#include "include/gpu/GrContext.h"
-#include "include/private/GrSkSLFPFactoryCache.h"
+#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrDrawingManager.h"
#include "src/gpu/GrMemoryPool.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
+#include "src/gpu/GrSkSLFPFactoryCache.h"
#include "src/gpu/GrTextureContext.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/text/GrTextBlobCache.h"
@@ -25,7 +26,8 @@
GrRecordingContext::GrRecordingContext(GrBackendApi backend,
const GrContextOptions& options,
uint32_t contextID)
- : INHERITED(backend, options, contextID) {
+ : INHERITED(backend, options, contextID)
+ , fAuditTrail(new GrAuditTrail()) {
}
GrRecordingContext::~GrRecordingContext() { }
diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp
index 08a11b9..c22eeaa 100644
--- a/src/gpu/GrReducedClip.cpp
+++ b/src/gpu/GrReducedClip.cpp
@@ -5,10 +5,10 @@
* found in the LICENSE file.
*/
-#include "include/private/GrColor.h"
#include "src/core/SkClipOpPriv.h"
#include "src/gpu/GrAppliedClip.h"
#include "src/gpu/GrClip.h"
+#include "src/gpu/GrColor.h"
#include "src/gpu/GrDrawingManager.h"
#include "src/gpu/GrFixedClip.h"
#include "src/gpu/GrPathRenderer.h"
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 597631c..f10bda9 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -8,9 +8,6 @@
#include "include/core/SkDrawable.h"
#include "include/gpu/GrBackendSemaphore.h"
#include "include/gpu/GrRenderTarget.h"
-#include "include/private/GrAuditTrail.h"
-#include "include/private/GrColor.h"
-#include "include/private/GrOpList.h"
#include "include/private/GrRecordingContext.h"
#include "include/private/SkShadowFlags.h"
#include "include/utils/SkShadowUtils.h"
@@ -23,13 +20,16 @@
#include "src/core/SkRRectPriv.h"
#include "src/core/SkSurfacePriv.h"
#include "src/gpu/GrAppliedClip.h"
+#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrBlurUtils.h"
#include "src/gpu/GrCaps.h"
+#include "src/gpu/GrColor.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrDrawingManager.h"
#include "src/gpu/GrFixedClip.h"
#include "src/gpu/GrGpuResourcePriv.h"
#include "src/gpu/GrMemoryPool.h"
+#include "src/gpu/GrOpList.h"
#include "src/gpu/GrPathRenderer.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
diff --git a/src/gpu/GrRenderTargetContext.h b/src/gpu/GrRenderTargetContext.h
index 63fc044..fd72e52 100644
--- a/src/gpu/GrRenderTargetContext.h
+++ b/src/gpu/GrRenderTargetContext.h
@@ -13,9 +13,9 @@
#include "include/core/SkRefCnt.h"
#include "include/core/SkSurface.h"
#include "include/core/SkSurfaceProps.h"
-#include "include/private/GrRenderTargetProxy.h"
#include "include/private/GrTypesPriv.h"
#include "src/gpu/GrPaint.h"
+#include "src/gpu/GrRenderTargetProxy.h"
#include "src/gpu/GrSurfaceContext.h"
#include "src/gpu/GrXferProcessor.h"
#include "src/gpu/text/GrTextTarget.h"
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp
index adc98d2..3fd6d85 100644
--- a/src/gpu/GrRenderTargetOpList.cpp
+++ b/src/gpu/GrRenderTargetOpList.cpp
@@ -5,11 +5,11 @@
* found in the LICENSE file.
*/
-#include "include/private/GrAuditTrail.h"
#include "include/private/GrRecordingContext.h"
#include "src/core/SkExchange.h"
#include "src/core/SkRectPriv.h"
#include "src/core/SkTraceEvent.h"
+#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrGpu.h"
#include "src/gpu/GrGpuCommandBuffer.h"
diff --git a/src/gpu/GrRenderTargetOpList.h b/src/gpu/GrRenderTargetOpList.h
index 8d266b3..3269113 100644
--- a/src/gpu/GrRenderTargetOpList.h
+++ b/src/gpu/GrRenderTargetOpList.h
@@ -11,13 +11,13 @@
#include "include/core/SkMatrix.h"
#include "include/core/SkStrokeRec.h"
#include "include/core/SkTypes.h"
-#include "include/private/GrOpList.h"
#include "include/private/SkTArray.h"
#include "src/core/SkArenaAlloc.h"
#include "src/core/SkClipStack.h"
#include "src/core/SkStringUtils.h"
#include "src/core/SkTLazy.h"
#include "src/gpu/GrAppliedClip.h"
+#include "src/gpu/GrOpList.h"
#include "src/gpu/GrPathRendering.h"
#include "src/gpu/GrPrimitiveProcessor.h"
#include "src/gpu/ops/GrDrawOp.h"
diff --git a/src/gpu/GrRenderTargetProxy.cpp b/src/gpu/GrRenderTargetProxy.cpp
index bd453c8..6dad311 100644
--- a/src/gpu/GrRenderTargetProxy.cpp
+++ b/src/gpu/GrRenderTargetProxy.cpp
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
-#include "include/private/GrRenderTargetProxy.h"
+#include "src/gpu/GrRenderTargetProxy.h"
#include "src/core/SkMathPriv.h"
#include "src/gpu/GrCaps.h"
diff --git a/src/gpu/GrRenderTargetProxy.h b/src/gpu/GrRenderTargetProxy.h
new file mode 100644
index 0000000..1a2b2fc
--- /dev/null
+++ b/src/gpu/GrRenderTargetProxy.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrRenderTargetProxy_DEFINED
+#define GrRenderTargetProxy_DEFINED
+
+#include "include/private/GrTypesPriv.h"
+#include "src/gpu/GrSurfaceProxy.h"
+
+class GrResourceProvider;
+class GrRenderTargetProxyPriv;
+
+// This class delays the acquisition of RenderTargets until they are actually
+// required
+// Beware: the uniqueID of the RenderTargetProxy will usually be different than
+// the uniqueID of the RenderTarget it represents!
+class GrRenderTargetProxy : virtual public GrSurfaceProxy {
+public:
+ GrRenderTargetProxy* asRenderTargetProxy() override { return this; }
+ const GrRenderTargetProxy* asRenderTargetProxy() const override { return this; }
+
+ // Actually instantiate the backing rendertarget, if necessary.
+ bool instantiate(GrResourceProvider*) override;
+
+ GrFSAAType fsaaType() const {
+ if (fSampleCnt <= 1) {
+ SkASSERT(!this->hasMixedSamples());
+ return GrFSAAType::kNone;
+ }
+ return this->hasMixedSamples() ? GrFSAAType::kMixedSamples : GrFSAAType::kUnifiedMSAA;
+ }
+
+ /*
+ * When instantiated does this proxy require a stencil buffer?
+ */
+ void setNeedsStencil() { fNeedsStencil = true; }
+ bool needsStencil() const { return fNeedsStencil; }
+
+ /**
+ * Returns the number of samples/pixel in the stencil buffer (One if non-MSAA).
+ */
+ int numStencilSamples() const { return fSampleCnt; }
+
+ /**
+ * Returns the number of samples/pixel in the color buffer (One if non-MSAA or mixed sampled).
+ */
+ int numColorSamples() const {
+ return GrFSAAType::kMixedSamples == this->fsaaType() ? 1 : fSampleCnt;
+ }
+
+ int maxWindowRectangles(const GrCaps& caps) const;
+
+ bool wrapsVkSecondaryCB() const { return fWrapsVkSecondaryCB == WrapsVkSecondaryCB::kYes; }
+
+ // TODO: move this to a priv class!
+ bool refsWrappedObjects() const;
+
+ // Provides access to special purpose functions.
+ GrRenderTargetProxyPriv rtPriv();
+ const GrRenderTargetProxyPriv rtPriv() const;
+
+protected:
+ friend class GrProxyProvider; // for ctors
+ friend class GrRenderTargetProxyPriv;
+
+ // Deferred version
+ GrRenderTargetProxy(const GrCaps&, const GrBackendFormat&, const GrSurfaceDesc&,
+ GrSurfaceOrigin, SkBackingFit, SkBudgeted, GrInternalSurfaceFlags);
+
+ enum class WrapsVkSecondaryCB : bool { kNo = false, kYes = true };
+
+ // Lazy-callback version
+ // There are two main use cases for lazily-instantiated proxies:
+ // basic knowledge - width, height, config, samples, origin are known
+ // minimal knowledge - only config is known.
+ //
+ // The basic knowledge version is used for DDL where we know the type of proxy we are going to
+ // use, but we don't have access to the GPU yet to instantiate it.
+ //
+ // The minimal knowledge version is used for CCPR where we are generating an atlas but we do not
+ // know the final size until flush time.
+ GrRenderTargetProxy(LazyInstantiateCallback&&, LazyInstantiationType lazyType,
+ const GrBackendFormat&, const GrSurfaceDesc&, GrSurfaceOrigin,
+ SkBackingFit, SkBudgeted, GrInternalSurfaceFlags,
+ WrapsVkSecondaryCB wrapsVkSecondaryCB);
+
+ // Wrapped version
+ GrRenderTargetProxy(sk_sp<GrSurface>, GrSurfaceOrigin,
+ WrapsVkSecondaryCB wrapsVkSecondaryCB = WrapsVkSecondaryCB::kNo);
+
+ sk_sp<GrSurface> createSurface(GrResourceProvider*) const override;
+
+private:
+ void setHasMixedSamples() {
+ fSurfaceFlags |= GrInternalSurfaceFlags::kMixedSampled;
+ }
+ bool hasMixedSamples() const { return fSurfaceFlags & GrInternalSurfaceFlags::kMixedSampled; }
+
+ void setGLRTFBOIDIs0() {
+ fSurfaceFlags |= GrInternalSurfaceFlags::kGLRTFBOIDIs0;
+ }
+ bool glRTFBOIDIs0() const {
+ return fSurfaceFlags & GrInternalSurfaceFlags::kGLRTFBOIDIs0;
+ }
+
+
+ size_t onUninstantiatedGpuMemorySize() const override;
+ SkDEBUGCODE(void onValidateSurface(const GrSurface*) override;)
+
+ // WARNING: Be careful when adding or removing fields here. ASAN is likely to trigger warnings
+ // when instantiating GrTextureRenderTargetProxy. The std::function in GrSurfaceProxy makes
+ // each class in the diamond require 16 byte alignment. Clang appears to layout the fields for
+ // each class to achieve the necessary alignment. However, ASAN checks the alignment of 'this'
+ // in the constructors, and always looks for the full 16 byte alignment, even if the fields in
+ // that particular class don't require it. Changing the size of this object can move the start
+ // address of other types, leading to this problem.
+
+ int fSampleCnt;
+ bool fNeedsStencil;
+ WrapsVkSecondaryCB fWrapsVkSecondaryCB;
+
+ // For wrapped render targets the actual GrRenderTarget is stored in the GrIORefProxy class.
+ // For deferred proxies that pointer is filled in when we need to instantiate the
+ // deferred resource.
+
+ typedef GrSurfaceProxy INHERITED;
+};
+
+#endif
diff --git a/src/gpu/GrRenderTargetProxyPriv.h b/src/gpu/GrRenderTargetProxyPriv.h
index 9bbef3d..bf2e770 100644
--- a/src/gpu/GrRenderTargetProxyPriv.h
+++ b/src/gpu/GrRenderTargetProxyPriv.h
@@ -8,7 +8,7 @@
#ifndef GrRenderTargetProxyPriv_DEFINED
#define GrRenderTargetProxyPriv_DEFINED
-#include "include/private/GrRenderTargetProxy.h"
+#include "src/gpu/GrRenderTargetProxy.h"
/**
* This class hides the more specialized capabilities of GrRenderTargetProxy.
diff --git a/src/gpu/GrResourceAllocator.cpp b/src/gpu/GrResourceAllocator.cpp
index bffbc54..d37d81c 100644
--- a/src/gpu/GrResourceAllocator.cpp
+++ b/src/gpu/GrResourceAllocator.cpp
@@ -7,16 +7,16 @@
#include "src/gpu/GrResourceAllocator.h"
-#include "include/private/GrOpList.h"
-#include "include/private/GrRenderTargetProxy.h"
-#include "include/private/GrSurfaceProxy.h"
-#include "include/private/GrTextureProxy.h"
#include "src/gpu/GrDeinstantiateProxyTracker.h"
#include "src/gpu/GrGpuResourcePriv.h"
+#include "src/gpu/GrOpList.h"
+#include "src/gpu/GrRenderTargetProxy.h"
#include "src/gpu/GrResourceCache.h"
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/GrSurfacePriv.h"
+#include "src/gpu/GrSurfaceProxy.h"
#include "src/gpu/GrSurfaceProxyPriv.h"
+#include "src/gpu/GrTextureProxy.h"
#if GR_TRACK_INTERVAL_CREATION
#include <atomic>
diff --git a/src/gpu/GrResourceAllocator.h b/src/gpu/GrResourceAllocator.h
index 668c996..a8c4f58 100644
--- a/src/gpu/GrResourceAllocator.h
+++ b/src/gpu/GrResourceAllocator.h
@@ -9,8 +9,8 @@
#define GrResourceAllocator_DEFINED
#include "include/gpu/GrSurface.h"
-#include "include/private/GrSurfaceProxy.h"
#include "src/gpu/GrGpuResourcePriv.h"
+#include "src/gpu/GrSurfaceProxy.h"
#include "src/core/SkArenaAlloc.h"
#include "src/core/SkTDynamicHash.h"
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index 1051047..8f3b39e 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -8,11 +8,11 @@
#include "src/gpu/GrSWMaskHelper.h"
#include "include/private/GrRecordingContext.h"
-#include "include/private/GrTextureProxy.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrSurfaceContext.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/geometry/GrShape.h"
/*
diff --git a/src/gpu/GrSkSLFPFactoryCache.h b/src/gpu/GrSkSLFPFactoryCache.h
new file mode 100644
index 0000000..48869f8
--- /dev/null
+++ b/src/gpu/GrSkSLFPFactoryCache.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2018 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrSkSLFPFactoryCache_DEFINED
+#define GrSkSLFPFactoryCache_DEFINED
+
+#include "include/core/SkRefCnt.h"
+
+#include <vector>
+
+class GrSkSLFPFactory;
+
+// This is a cache used by GrSkSLFP to retain GrSkSLFPFactory instances, so we don't have to
+// re-process the SkSL source code every time we create a GrSkSLFP instance.
+// For thread safety, it is important that GrSkSLFP only interact with the cache from methods that
+// are only called from within the rendering thread, like onCreateGLSLInstance and
+// onGetGLSLProcessorKey.
+class GrSkSLFPFactoryCache : public SkNVRefCnt<GrSkSLFPFactoryCache> {
+public:
+ // Returns a factory by its numeric index, or null if no such factory exists. Indices are
+ // allocated by GrSkSLFP::NewIndex().
+ sk_sp<GrSkSLFPFactory> get(int index);
+
+ // Stores a new factory with the given index.
+ void set(int index, sk_sp<GrSkSLFPFactory> factory);
+
+ ~GrSkSLFPFactoryCache();
+
+private:
+ std::vector<GrSkSLFPFactory*> fFactories;
+};
+
+#endif
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index 4a6680b..6ab0dbe 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -5,18 +5,18 @@
* found in the LICENSE file.
*/
-#include "include/private/GrAuditTrail.h"
-#include "include/private/GrOpList.h"
#include "include/private/SkSemaphore.h"
#include "src/core/SkMakeUnique.h"
#include "src/core/SkTaskGroup.h"
#include "src/core/SkTraceEvent.h"
+#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrDeferredProxyUploader.h"
#include "src/gpu/GrGpuResourcePriv.h"
#include "src/gpu/GrOpFlushState.h"
+#include "src/gpu/GrOpList.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContextPriv.h"
diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp
index 2a20456..52ba3eb 100644
--- a/src/gpu/GrSurface.cpp
+++ b/src/gpu/GrSurface.cpp
@@ -9,7 +9,7 @@
#include "include/gpu/GrRenderTarget.h"
#include "include/gpu/GrSurface.h"
#include "include/gpu/GrTexture.h"
-#include "include/private/GrOpList.h"
+#include "src/gpu/GrOpList.h"
#include "src/gpu/GrResourceProvider.h"
#include "src/gpu/GrSurfacePriv.h"
diff --git a/src/gpu/GrSurfaceContext.cpp b/src/gpu/GrSurfaceContext.cpp
index 71113b4..b1f8903 100644
--- a/src/gpu/GrSurfaceContext.cpp
+++ b/src/gpu/GrSurfaceContext.cpp
@@ -7,14 +7,14 @@
#include "src/gpu/GrSurfaceContext.h"
-#include "include/private/GrAuditTrail.h"
-#include "include/private/GrOpList.h"
#include "include/private/GrRecordingContext.h"
#include "src/core/SkAutoPixmapStorage.h"
+#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrDrawingManager.h"
#include "src/gpu/GrGpu.h"
+#include "src/gpu/GrOpList.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrSurfaceContextPriv.h"
diff --git a/src/gpu/GrSurfaceContext.h b/src/gpu/GrSurfaceContext.h
index e72364c..319caec 100644
--- a/src/gpu/GrSurfaceContext.h
+++ b/src/gpu/GrSurfaceContext.h
@@ -9,8 +9,8 @@
#define GrSurfaceContext_DEFINED
#include "include/core/SkRefCnt.h"
-#include "include/private/GrSurfaceProxy.h"
#include "src/gpu/GrColorSpaceInfo.h"
+#include "src/gpu/GrSurfaceProxy.h"
class GrAuditTrail;
class GrDrawingManager;
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index ccf2e55..d3cf8ff 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -5,16 +5,16 @@
* found in the LICENSE file.
*/
-#include "include/private/GrSurfaceProxy.h"
+#include "src/gpu/GrSurfaceProxy.h"
#include "src/gpu/GrSurfaceProxyPriv.h"
#include "include/gpu/GrContext.h"
-#include "include/private/GrOpList.h"
#include "include/private/GrRecordingContext.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGpuResourcePriv.h"
+#include "src/gpu/GrOpList.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrSurfaceContext.h"
diff --git a/src/gpu/GrSurfaceProxy.h b/src/gpu/GrSurfaceProxy.h
new file mode 100644
index 0000000..7b938b1
--- /dev/null
+++ b/src/gpu/GrSurfaceProxy.h
@@ -0,0 +1,547 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrSurfaceProxy_DEFINED
+#define GrSurfaceProxy_DEFINED
+
+#include "include/core/SkRect.h"
+#include "include/gpu/GrBackendSurface.h"
+#include "include/gpu/GrGpuResource.h"
+#include "include/gpu/GrSurface.h"
+#include "include/gpu/GrTexture.h"
+#include "include/private/SkNoncopyable.h"
+
+class GrCaps;
+class GrContext_Base;
+class GrOpList;
+class GrRecordingContext;
+class GrRenderTargetOpList;
+class GrRenderTargetProxy;
+class GrResourceProvider;
+class GrSurfaceContext;
+class GrSurfaceProxyPriv;
+class GrTextureOpList;
+class GrTextureProxy;
+
+// This class replicates the functionality GrIORef<GrSurface> but tracks the
+// utilitization for later resource allocation (for the deferred case) and
+// forwards on the utilization in the wrapped case
+class GrIORefProxy : public SkNoncopyable {
+public:
+ void ref() const {
+ this->validate();
+
+ ++fRefCnt;
+ if (fTarget) {
+ fTarget->ref();
+ }
+ }
+
+ void unref() const {
+ this->validate();
+
+ if (fTarget) {
+ fTarget->unref();
+ }
+
+ --fRefCnt;
+ this->didRemoveRef();
+ }
+
+#ifdef SK_DEBUG
+ bool isUnique_debugOnly() const { // For asserts.
+ SkASSERT(fRefCnt >= 0);
+ return 1 == fRefCnt;
+ }
+#endif
+
+ void release() {
+ // In the current hybrid world, the proxy and backing surface are ref/unreffed in
+ // synchrony. Each ref we've added or removed to the proxy was mirrored to the backing
+ // surface. Though, that backing surface could be owned by other proxies as well. Remove
+ // a ref from the backing surface for each ref the proxy has since we are about to remove
+ // our pointer to the surface. If this proxy is reinstantiated then all the proxy's refs
+ // get transferred to the (possibly new) backing surface.
+ for (int refs = fRefCnt; refs; --refs) {
+ fTarget->unref();
+ }
+ fTarget = nullptr;
+ }
+
+ void validate() const {
+#ifdef SK_DEBUG
+ SkASSERT(fRefCnt >= 1);
+
+ if (fTarget) {
+ // The backing GrSurface can have more refs than the proxy if the proxy
+ // started off wrapping an external resource (that came in with refs).
+ // The GrSurface should never have fewer refs than the proxy however.
+ SkASSERT(fTarget->fRefCnt >= fRefCnt);
+ }
+#endif
+ }
+
+ int32_t getBackingRefCnt_TestOnly() const;
+
+protected:
+ GrIORefProxy() : fTarget(nullptr), fRefCnt(1) {}
+ GrIORefProxy(sk_sp<GrSurface> surface) : fRefCnt(1) {
+ // Since we're manually forwarding on refs & unrefs we don't want sk_sp doing
+ // anything extra.
+ fTarget = surface.release();
+ }
+ virtual ~GrIORefProxy() {
+ // We don't unref 'fTarget' here since the 'unref' method will already
+ // have forwarded on the unref call that got us here.
+ }
+
+ // Privileged method that allows going from ref count = 0 to ref count = 1.
+ void addInitialRef(GrResourceCache* cache) const {
+ this->validate();
+ ++fRefCnt;
+ if (fTarget) {
+ fTarget->proxyAccess().ref(cache);
+ }
+ }
+
+ // This GrIORefProxy was deferred before but has just been instantiated. To
+ // make all the reffing & unreffing work out we now need to transfer any deferred
+ // refs & unrefs to the new GrSurface
+ void transferRefs() {
+ SkASSERT(fTarget);
+ // Make sure we're going to take some ownership of our target.
+ SkASSERT(fRefCnt > 0);
+
+ SkASSERT(fTarget->fRefCnt > 0);
+ SkASSERT(fRefCnt >= 0);
+ // Don't xfer the proxy's creation ref. If we're going to subtract a ref do it via unref()
+ // so that proper cache notifications occur.
+ if (!fRefCnt) {
+ fTarget->unref();
+ } else {
+ fTarget->fRefCnt += (fRefCnt - 1);
+ }
+ }
+
+ int32_t internalGetProxyRefCnt() const { return fRefCnt; }
+ int32_t internalGetTotalRefs() const { return fRefCnt; }
+
+ // For deferred proxies this will be null. For wrapped proxies it will point to the
+ // wrapped resource.
+ GrSurface* fTarget;
+
+private:
+ // This class is used to manage conversion of refs to pending reads/writes.
+ template <typename> friend class GrProxyRef;
+
+ void didRemoveRef() const {
+ if (0 == fRefCnt) {
+ delete this;
+ }
+ }
+
+ mutable int32_t fRefCnt;
+};
+
+class GrSurfaceProxy : public GrIORefProxy {
+public:
+ /**
+ * Some lazy proxy callbacks want to set their own (or no key) on the GrSurfaces they return.
+ * Others want the GrSurface's key to be kept in sync with the proxy's key. This enum controls
+ * the key relationship between proxies and their targets.
+ */
+ enum class LazyInstantiationKeyMode {
+ /**
+ * Don't key the GrSurface with the proxy's key. The lazy instantiation callback is free to
+ * return a GrSurface that already has a unique key unrelated to the proxy's key.
+ */
+ kUnsynced,
+ /**
+ * Keep the GrSurface's unique key in sync with the proxy's unique key. The GrSurface
+ * returned from the lazy instantiation callback must not have a unique key or have the same
+ * same unique key as the proxy. If the proxy is later assigned a key it is in turn assigned
+ * to the GrSurface.
+ */
+ kSynced
+ };
+
+ struct LazyInstantiationResult {
+ LazyInstantiationResult() = default;
+ LazyInstantiationResult(const LazyInstantiationResult&) = default;
+ LazyInstantiationResult(LazyInstantiationResult&& that) = default;
+ LazyInstantiationResult(sk_sp<GrSurface> surf,
+ LazyInstantiationKeyMode mode = LazyInstantiationKeyMode::kSynced)
+ : fSurface(std::move(surf)), fKeyMode(mode) {}
+ LazyInstantiationResult(sk_sp<GrTexture> tex)
+ : LazyInstantiationResult(sk_sp<GrSurface>(std::move(tex))) {}
+
+ LazyInstantiationResult& operator=(const LazyInstantiationResult&) = default;
+ LazyInstantiationResult& operator=(LazyInstantiationResult&&) = default;
+
+ sk_sp<GrSurface> fSurface;
+ LazyInstantiationKeyMode fKeyMode = LazyInstantiationKeyMode::kSynced;
+ };
+
+ using LazyInstantiateCallback = std::function<LazyInstantiationResult(GrResourceProvider*)>;
+
+ enum class LazyInstantiationType {
+ kSingleUse, // Instantiation callback is allowed to be called only once.
+ kMultipleUse, // Instantiation callback can be called multiple times.
+ kDeinstantiate, // Instantiation callback can be called multiple times,
+ // but we will deinstantiate the proxy after every flush.
+ };
+
+ enum class LazyState {
+ kNot, // The proxy is instantiated or does not have a lazy callback
+ kPartially, // The proxy has a lazy callback but knows basic information about itself.
+ kFully, // The proxy has a lazy callback and also doesn't know its width, height, etc.
+ };
+
+ LazyState lazyInstantiationState() const {
+ if (fTarget || !SkToBool(fLazyInstantiateCallback)) {
+ return LazyState::kNot;
+ } else {
+ if (fWidth <= 0) {
+ SkASSERT(fHeight <= 0);
+ return LazyState::kFully;
+ } else {
+ SkASSERT(fHeight > 0);
+ return LazyState::kPartially;
+ }
+ }
+ }
+
+ GrPixelConfig config() const { return fConfig; }
+ int width() const {
+ SkASSERT(LazyState::kFully != this->lazyInstantiationState());
+ return fWidth;
+ }
+ int height() const {
+ SkASSERT(LazyState::kFully != this->lazyInstantiationState());
+ return fHeight;
+ }
+
+ SkISize isize() const { return {fWidth, fHeight}; }
+
+ int worstCaseWidth() const;
+ int worstCaseHeight() const;
+ /**
+ * Helper that gets the width and height of the surface as a bounding rectangle.
+ */
+ SkRect getBoundsRect() const {
+ SkASSERT(LazyState::kFully != this->lazyInstantiationState());
+ return SkRect::MakeIWH(this->width(), this->height());
+ }
+ /**
+ * Helper that gets the worst case width and height of the surface as a bounding rectangle.
+ */
+ SkRect getWorstCaseBoundsRect() const {
+ SkASSERT(LazyState::kFully != this->lazyInstantiationState());
+ return SkRect::MakeIWH(this->worstCaseWidth(), this->worstCaseHeight());
+ }
+
+ GrSurfaceOrigin origin() const {
+ SkASSERT(kTopLeft_GrSurfaceOrigin == fOrigin || kBottomLeft_GrSurfaceOrigin == fOrigin);
+ return fOrigin;
+ }
+
+ const GrBackendFormat& backendFormat() const { return fFormat; }
+
+ class UniqueID {
+ public:
+ static UniqueID InvalidID() {
+ return UniqueID(uint32_t(SK_InvalidUniqueID));
+ }
+
+ // wrapped
+ explicit UniqueID(const GrGpuResource::UniqueID& id) : fID(id.asUInt()) { }
+ // deferred and lazy-callback
+ UniqueID() : fID(GrGpuResource::CreateUniqueID()) { }
+
+ uint32_t asUInt() const { return fID; }
+
+ bool operator==(const UniqueID& other) const {
+ return fID == other.fID;
+ }
+ bool operator!=(const UniqueID& other) const {
+ return !(*this == other);
+ }
+
+ void makeInvalid() { fID = SK_InvalidUniqueID; }
+ bool isInvalid() const { return SK_InvalidUniqueID == fID; }
+
+ private:
+ explicit UniqueID(uint32_t id) : fID(id) {}
+
+ uint32_t fID;
+ };
+
+ /*
+ * The contract for the uniqueID is:
+ * for wrapped resources:
+ * the uniqueID will match that of the wrapped resource
+ *
+ * for deferred resources:
+ * the uniqueID will be different from the real resource, when it is allocated
+ * the proxy's uniqueID will not change across the instantiate call
+ *
+ * the uniqueIDs of the proxies and the resources draw from the same pool
+ *
+ * What this boils down to is that the uniqueID of a proxy can be used to consistently
+ * track/identify a proxy but should never be used to distinguish between
+ * resources and proxies - beware!
+ */
+ UniqueID uniqueID() const { return fUniqueID; }
+
+ UniqueID underlyingUniqueID() const {
+ if (fTarget) {
+ return UniqueID(fTarget->uniqueID());
+ }
+
+ return fUniqueID;
+ }
+
+ virtual bool instantiate(GrResourceProvider*) = 0;
+
+ void deinstantiate();
+
+ /**
+ * Proxies that are already instantiated and whose backing surface cannot be recycled to
+ * instantiate other proxies do not need to be considered by GrResourceAllocator.
+ */
+ bool canSkipResourceAllocator() const;
+
+ /**
+ * @return the texture proxy associated with the surface proxy, may be NULL.
+ */
+ virtual GrTextureProxy* asTextureProxy() { return nullptr; }
+ virtual const GrTextureProxy* asTextureProxy() const { return nullptr; }
+
+ /**
+ * @return the render target proxy associated with the surface proxy, may be NULL.
+ */
+ virtual GrRenderTargetProxy* asRenderTargetProxy() { return nullptr; }
+ virtual const GrRenderTargetProxy* asRenderTargetProxy() const { return nullptr; }
+
+ bool isInstantiated() const { return SkToBool(fTarget); }
+
+ // If the proxy is already instantiated, return its backing GrTexture; if not, return null.
+ GrSurface* peekSurface() const { return fTarget; }
+
+ // If this is a texture proxy and the proxy is already instantiated, return its backing
+ // GrTexture; if not, return null.
+ GrTexture* peekTexture() const { return fTarget ? fTarget->asTexture() : nullptr; }
+
+ // If this is a render target proxy and the proxy is already instantiated, return its backing
+ // GrRenderTarget; if not, return null.
+ GrRenderTarget* peekRenderTarget() const {
+ return fTarget ? fTarget->asRenderTarget() : nullptr;
+ }
+
+ /**
+ * Does the resource count against the resource budget?
+ */
+ SkBudgeted isBudgeted() const { return fBudgeted; }
+
+ /**
+ * The pixel values of this proxy's surface cannot be modified (e.g. doesn't support write
+ * pixels or MIP map level regen). Read-only proxies also bypass interval tracking and
+ * assignment in GrResourceAllocator.
+ */
+ bool readOnly() const { return fSurfaceFlags & GrInternalSurfaceFlags::kReadOnly; }
+
+ void setLastOpList(GrOpList* opList);
+ GrOpList* getLastOpList() { return fLastOpList; }
+
+ GrRenderTargetOpList* getLastRenderTargetOpList();
+ GrTextureOpList* getLastTextureOpList();
+
+ /**
+ * Retrieves the amount of GPU memory that will be or currently is used by this resource
+ * in bytes. It is approximate since we aren't aware of additional padding or copies made
+ * by the driver.
+ *
+ * @return the amount of GPU memory used in bytes
+ */
+ size_t gpuMemorySize() const {
+ SkASSERT(LazyState::kFully != this->lazyInstantiationState());
+ if (fTarget) {
+ return fTarget->gpuMemorySize();
+ }
+ if (kInvalidGpuMemorySize == fGpuMemorySize) {
+ fGpuMemorySize = this->onUninstantiatedGpuMemorySize();
+ SkASSERT(kInvalidGpuMemorySize != fGpuMemorySize);
+ }
+ return fGpuMemorySize;
+ }
+
+ enum class RectsMustMatch : bool {
+ kNo = false,
+ kYes = true
+ };
+
+ // Helper function that creates a temporary SurfaceContext to perform the copy
+ // The copy is is not a render target and not multisampled.
+ static sk_sp<GrTextureProxy> Copy(GrRecordingContext*, GrSurfaceProxy* src, GrMipMapped,
+ SkIRect srcRect, SkBackingFit, SkBudgeted,
+ RectsMustMatch = RectsMustMatch::kNo);
+
+ // Copy the entire 'src'
+ static sk_sp<GrTextureProxy> Copy(GrRecordingContext*, GrSurfaceProxy* src, GrMipMapped,
+ SkBackingFit, SkBudgeted);
+
+ bool isWrapped_ForTesting() const;
+
+ SkDEBUGCODE(void validate(GrContext_Base*) const;)
+
+ // Provides access to functions that aren't part of the public API.
+ inline GrSurfaceProxyPriv priv();
+ inline const GrSurfaceProxyPriv priv() const;
+
+ /**
+ * Provides privileged access to select callers to be able to add a ref to a GrSurfaceProxy
+ * with zero refs.
+ */
+ class FirstRefAccess;
+ inline FirstRefAccess firstRefAccess();
+
+ GrInternalSurfaceFlags testingOnly_getFlags() const;
+
+protected:
+ // Deferred version
+ GrSurfaceProxy(const GrBackendFormat& format, const GrSurfaceDesc& desc,
+ GrSurfaceOrigin origin, SkBackingFit fit,
+ SkBudgeted budgeted, GrInternalSurfaceFlags surfaceFlags)
+ : GrSurfaceProxy(nullptr, LazyInstantiationType::kSingleUse, format, desc, origin, fit,
+ budgeted, surfaceFlags) {
+ // Note: this ctor pulls a new uniqueID from the same pool at the GrGpuResources
+ }
+
+ // Lazy-callback version
+ GrSurfaceProxy(LazyInstantiateCallback&&, LazyInstantiationType,
+ const GrBackendFormat& format, const GrSurfaceDesc&, GrSurfaceOrigin,
+ SkBackingFit, SkBudgeted, GrInternalSurfaceFlags);
+
+ // Wrapped version.
+ GrSurfaceProxy(sk_sp<GrSurface>, GrSurfaceOrigin, SkBackingFit);
+
+ virtual ~GrSurfaceProxy();
+
+ friend class GrSurfaceProxyPriv;
+
+ // Methods made available via GrSurfaceProxyPriv
+ bool ignoredByResourceAllocator() const { return fIgnoredByResourceAllocator; }
+ void setIgnoredByResourceAllocator() { fIgnoredByResourceAllocator = true; }
+
+ int32_t getProxyRefCnt() const { return this->internalGetProxyRefCnt(); }
+ int32_t getTotalRefs() const { return this->internalGetTotalRefs(); }
+
+ void computeScratchKey(GrScratchKey*) const;
+
+ virtual sk_sp<GrSurface> createSurface(GrResourceProvider*) const = 0;
+ void assign(sk_sp<GrSurface> surface);
+
+ sk_sp<GrSurface> createSurfaceImpl(GrResourceProvider*, int sampleCnt, bool needsStencil,
+ GrSurfaceDescFlags, GrMipMapped) const;
+
+ // Once the size of a fully-lazy proxy is decided, and before it gets instantiated, the client
+ // can use this optional method to specify the proxy's size. (A proxy's size can be less than
+ // the GPU surface that backs it. e.g., SkBackingFit::kApprox.) Otherwise, the proxy's size will
+ // be set to match the underlying GPU surface upon instantiation.
+ void setLazySize(int width, int height) {
+ SkASSERT(GrSurfaceProxy::LazyState::kFully == this->lazyInstantiationState());
+ SkASSERT(width > 0 && height > 0);
+ fWidth = width;
+ fHeight = height;
+ }
+
+ bool instantiateImpl(GrResourceProvider* resourceProvider, int sampleCnt, bool needsStencil,
+ GrSurfaceDescFlags descFlags, GrMipMapped, const GrUniqueKey*);
+
+ // In many cases these flags aren't actually known until the proxy has been instantiated.
+ // However, Ganesh frequently needs to change its behavior based on these settings. For
+ // internally create proxies we will know these properties ahead of time. For wrapped
+ // proxies we will copy the properties off of the GrSurface. For lazy proxies we force the
+ // call sites to provide the required information ahead of time. At instantiation time
+ // we verify that the assumed properties match the actual properties.
+ GrInternalSurfaceFlags fSurfaceFlags;
+
+private:
+ // For wrapped resources, 'fFormat', 'fConfig', 'fWidth', 'fHeight', and 'fOrigin; will always
+ // be filled in from the wrapped resource.
+ GrBackendFormat fFormat;
+ GrPixelConfig fConfig;
+ int fWidth;
+ int fHeight;
+ GrSurfaceOrigin fOrigin;
+ SkBackingFit fFit; // always kApprox for lazy-callback resources
+ // always kExact for wrapped resources
+ mutable SkBudgeted fBudgeted; // always kYes for lazy-callback resources
+ // set from the backing resource for wrapped resources
+ // mutable bc of SkSurface/SkImage wishy-washiness
+
+ const UniqueID fUniqueID; // set from the backing resource for wrapped resources
+
+ LazyInstantiateCallback fLazyInstantiateCallback;
+ // If this is set to kSingleuse, then after one call to fLazyInstantiateCallback we will cleanup
+ // the lazy callback and then delete it. This will allow for any refs and resources being held
+ // by the standard function to be released. This is specifically useful in non-dll cases where
+ // we make lazy proxies and instantiate them immediately.
+ // Note: This is ignored if fLazyInstantiateCallback is null.
+ LazyInstantiationType fLazyInstantiationType;
+
+ SkDEBUGCODE(void validateSurface(const GrSurface*);)
+ SkDEBUGCODE(virtual void onValidateSurface(const GrSurface*) = 0;)
+
+ static const size_t kInvalidGpuMemorySize = ~static_cast<size_t>(0);
+ SkDEBUGCODE(size_t getRawGpuMemorySize_debugOnly() const { return fGpuMemorySize; })
+
+ virtual size_t onUninstantiatedGpuMemorySize() const = 0;
+
+ bool fNeedsClear;
+ bool fIgnoredByResourceAllocator = false;
+
+ // This entry is lazily evaluated so, when the proxy wraps a resource, the resource
+ // will be called but, when the proxy is deferred, it will compute the answer itself.
+ // If the proxy computes its own answer that answer is checked (in debug mode) in
+ // the instantiation method.
+ mutable size_t fGpuMemorySize;
+
+ // The last opList that wrote to or is currently going to write to this surface
+ // The opList can be closed (e.g., no surface context is currently bound
+ // to this proxy).
+ // This back-pointer is required so that we can add a dependancy between
+ // the opList used to create the current contents of this surface
+ // and the opList of a destination surface to which this one is being drawn or copied.
+ // This pointer is unreffed. OpLists own a ref on their surface proxies.
+ GrOpList* fLastOpList;
+
+ typedef GrIORefProxy INHERITED;
+};
+
+class GrSurfaceProxy::FirstRefAccess {
+private:
+ void ref(GrResourceCache* cache) { fProxy->addInitialRef(cache); }
+
+ FirstRefAccess(GrSurfaceProxy* proxy) : fProxy(proxy) {}
+
+ // No taking addresses of this type.
+ const FirstRefAccess* operator&() const = delete;
+ FirstRefAccess* operator&() = delete;
+
+ GrSurfaceProxy* fProxy;
+
+ friend class GrSurfaceProxy;
+ friend class GrProxyProvider;
+ friend class GrDeinstantiateProxyTracker;
+};
+
+inline GrSurfaceProxy::FirstRefAccess GrSurfaceProxy::firstRefAccess() {
+ return FirstRefAccess(this);
+}
+
+#endif
diff --git a/src/gpu/GrSurfaceProxyPriv.h b/src/gpu/GrSurfaceProxyPriv.h
index 2b89376..b585dae 100644
--- a/src/gpu/GrSurfaceProxyPriv.h
+++ b/src/gpu/GrSurfaceProxyPriv.h
@@ -8,7 +8,7 @@
#ifndef GrSurfaceProxyPriv_DEFINED
#define GrSurfaceProxyPriv_DEFINED
-#include "include/private/GrSurfaceProxy.h"
+#include "src/gpu/GrSurfaceProxy.h"
#include "src/gpu/GrResourceProvider.h"
diff --git a/src/gpu/GrSwizzle.cpp b/src/gpu/GrSwizzle.cpp
index 21fe834..ae07d3d 100644
--- a/src/gpu/GrSwizzle.cpp
+++ b/src/gpu/GrSwizzle.cpp
@@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
-#include "src/gpu/GrSwizzle.h"
#include "src/core/SkRasterPipeline.h"
+#include "src/gpu/GrSwizzle.h"
void GrSwizzle::apply(SkRasterPipeline* pipeline) const {
SkASSERT(pipeline);
diff --git a/src/gpu/GrSwizzle.h b/src/gpu/GrSwizzle.h
index cbee3eb..16e473c 100644
--- a/src/gpu/GrSwizzle.h
+++ b/src/gpu/GrSwizzle.h
@@ -8,8 +8,8 @@
#ifndef GrSwizzle_DEFINED
#define GrSwizzle_DEFINED
-#include "include/private/GrColor.h"
#include "include/private/SkColorData.h"
+#include "src/gpu/GrColor.h"
class SkRasterPipeline;
diff --git a/src/gpu/GrTessellator.h b/src/gpu/GrTessellator.h
index 1793e12..e892a19 100644
--- a/src/gpu/GrTessellator.h
+++ b/src/gpu/GrTessellator.h
@@ -9,8 +9,8 @@
#define GrTessellator_DEFINED
#include "include/core/SkPoint.h"
-#include "include/private/GrColor.h"
#include "include/private/SkColorData.h"
+#include "src/gpu/GrColor.h"
class SkPath;
struct SkRect;
diff --git a/src/gpu/GrTestUtils.h b/src/gpu/GrTestUtils.h
index daf6ebe..b4da37b 100644
--- a/src/gpu/GrTestUtils.h
+++ b/src/gpu/GrTestUtils.h
@@ -15,10 +15,10 @@
#include "include/core/SkPathEffect.h"
#include "include/core/SkStrokeRec.h"
#include "include/gpu/GrSamplerState.h"
-#include "include/private/GrColor.h"
#include "include/private/SkMacros.h"
#include "include/private/SkTemplates.h"
#include "include/utils/SkRandom.h"
+#include "src/gpu/GrColor.h"
#include "src/gpu/GrFPArgs.h"
#include "src/shaders/SkShaderBase.h"
diff --git a/src/gpu/GrTextureAdjuster.h b/src/gpu/GrTextureAdjuster.h
index 825e211..aa26f45 100644
--- a/src/gpu/GrTextureAdjuster.h
+++ b/src/gpu/GrTextureAdjuster.h
@@ -8,9 +8,9 @@
#ifndef GrTextureAdjuster_DEFINED
#define GrTextureAdjuster_DEFINED
-#include "include/private/GrTextureProxy.h"
#include "src/core/SkTLazy.h"
#include "src/gpu/GrTextureProducer.h"
+#include "src/gpu/GrTextureProxy.h"
class GrRecordingContext;
diff --git a/src/gpu/GrTextureContext.cpp b/src/gpu/GrTextureContext.cpp
index d0bdaa1..f5c4a3b 100644
--- a/src/gpu/GrTextureContext.cpp
+++ b/src/gpu/GrTextureContext.cpp
@@ -7,12 +7,11 @@
#include "src/gpu/GrTextureContext.h"
+#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrDrawingManager.h"
#include "src/gpu/GrTextureOpList.h"
-#include "include/private/GrAuditTrail.h"
-
#define ASSERT_SINGLE_OWNER \
SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(this->singleOwner());)
#define RETURN_FALSE_IF_ABANDONED if (this->drawingManager()->wasAbandoned()) { return false; }
diff --git a/src/gpu/GrTextureContext.h b/src/gpu/GrTextureContext.h
index f4bac34..0282fc2 100644
--- a/src/gpu/GrTextureContext.h
+++ b/src/gpu/GrTextureContext.h
@@ -8,8 +8,8 @@
#ifndef GrTextureContext_DEFINED
#define GrTextureContext_DEFINED
-#include "include/private/GrTextureProxy.h"
#include "src/gpu/GrSurfaceContext.h"
+#include "src/gpu/GrTextureProxy.h"
class GrContext;
class GrDrawingManager;
diff --git a/src/gpu/GrTextureOpList.cpp b/src/gpu/GrTextureOpList.cpp
index 843537e..732e6cb 100644
--- a/src/gpu/GrTextureOpList.cpp
+++ b/src/gpu/GrTextureOpList.cpp
@@ -8,15 +8,15 @@
#include "src/gpu/GrTextureOpList.h"
#include "include/gpu/GrContext.h"
-#include "include/private/GrAuditTrail.h"
#include "include/private/GrRecordingContext.h"
-#include "include/private/GrTextureProxy.h"
#include "src/core/SkStringUtils.h"
+#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGpu.h"
#include "src/gpu/GrMemoryPool.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrResourceAllocator.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/ops/GrCopySurfaceOp.h"
////////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/GrTextureOpList.h b/src/gpu/GrTextureOpList.h
index 987dd2a..ebb4787 100644
--- a/src/gpu/GrTextureOpList.h
+++ b/src/gpu/GrTextureOpList.h
@@ -9,8 +9,8 @@
#define GrTexureOpList_DEFINED
#include "include/gpu/GrGpuResource.h"
-#include "include/private/GrOpList.h"
-#include "include/private/GrSurfaceProxy.h"
+#include "src/gpu/GrOpList.h"
+#include "src/gpu/GrSurfaceProxy.h"
#include "include/private/SkTArray.h"
diff --git a/src/gpu/GrTextureProducer.cpp b/src/gpu/GrTextureProducer.cpp
index f644e9e..0e09fc0 100644
--- a/src/gpu/GrTextureProducer.cpp
+++ b/src/gpu/GrTextureProducer.cpp
@@ -6,7 +6,6 @@
*/
#include "include/private/GrRecordingContext.h"
-#include "include/private/GrTextureProxy.h"
#include "src/core/SkMipMap.h"
#include "src/core/SkRectPriv.h"
#include "src/gpu/GrClip.h"
@@ -15,6 +14,7 @@
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrTextureProducer.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/effects/GrBicubicEffect.h"
#include "src/gpu/effects/GrTextureDomain.h"
diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp
index e0c0b47..73578bf 100644
--- a/src/gpu/GrTextureProxy.cpp
+++ b/src/gpu/GrTextureProxy.cpp
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
-#include "include/private/GrTextureProxy.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/GrTextureProxyPriv.h"
#include "include/gpu/GrContext.h"
diff --git a/src/gpu/GrTextureProxy.h b/src/gpu/GrTextureProxy.h
new file mode 100644
index 0000000..098168f
--- /dev/null
+++ b/src/gpu/GrTextureProxy.h
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrTextureProxy_DEFINED
+#define GrTextureProxy_DEFINED
+
+#include "include/gpu/GrSamplerState.h"
+#include "src/gpu/GrSurfaceProxy.h"
+
+class GrCaps;
+class GrDeferredProxyUploader;
+class GrProxyProvider;
+class GrResourceProvider;
+class GrTextureOpList;
+class GrTextureProxyPriv;
+
+// This class delays the acquisition of textures until they are actually required
+class GrTextureProxy : virtual public GrSurfaceProxy {
+public:
+ GrTextureProxy* asTextureProxy() override { return this; }
+ const GrTextureProxy* asTextureProxy() const override { return this; }
+
+ // Actually instantiate the backing texture, if necessary
+ bool instantiate(GrResourceProvider*) override;
+
+ GrSamplerState::Filter highestFilterMode() const;
+
+ // If we are instantiated and have a target, return the mip state of that target. Otherwise
+ // returns the proxy's mip state from creation time. This is useful for lazy proxies which may
+ // claim to not need mips at creation time, but the instantiation happens to give us a mipped
+ // target. In that case we should use that for our benefit to avoid possible copies/mip
+ // generation later.
+ GrMipMapped mipMapped() const;
+
+ // Returns the GrMipMapped value of the proxy from creation time regardless of whether it has
+ // been instantiated or not.
+ GrMipMapped proxyMipMapped() const { return fMipMapped; }
+
+ GrTextureType textureType() const { return this->backendFormat().textureType(); }
+
+ /** If true then the texture does not support MIP maps and only supports clamp wrap mode. */
+ bool hasRestrictedSampling() const {
+ return GrTextureTypeHasRestrictedSampling(this->textureType());
+ }
+
+ // Returns true if the passed in proxies can be used as dynamic state together when flushing
+ // draws to the gpu.
+ static bool ProxiesAreCompatibleAsDynamicState(const GrTextureProxy* first,
+ const GrTextureProxy* second);
+
+ /**
+ * Return the texture proxy's unique key. It will be invalid if the proxy doesn't have one.
+ */
+ const GrUniqueKey& getUniqueKey() const {
+#ifdef SK_DEBUG
+ if (fTarget && fUniqueKey.isValid() && fSyncTargetKey) {
+ SkASSERT(fTarget->getUniqueKey().isValid());
+ // It is possible for a non-keyed proxy to have a uniquely keyed resource assigned to
+ // it. This just means that a future user of the resource will be filling it with unique
+ // data. However, if the proxy has a unique key its attached resource should also
+ // have that key.
+ SkASSERT(fUniqueKey == fTarget->getUniqueKey());
+ }
+#endif
+
+ return fUniqueKey;
+ }
+
+ /**
+ * Internal-only helper class used for manipulations of the resource by the cache.
+ */
+ class CacheAccess;
+ inline CacheAccess cacheAccess();
+ inline const CacheAccess cacheAccess() const;
+
+ // Provides access to special purpose functions.
+ GrTextureProxyPriv texPriv();
+ const GrTextureProxyPriv texPriv() const;
+
+protected:
+ // DDL TODO: rm the GrSurfaceProxy friending
+ friend class GrSurfaceProxy; // for ctors
+ friend class GrProxyProvider; // for ctors
+ friend class GrTextureProxyPriv;
+ friend class GrSurfaceProxyPriv; // ability to change key sync state after lazy instantiation.
+
+ // Deferred version - when constructed with data the origin is always kTopLeft.
+ GrTextureProxy(const GrBackendFormat&, const GrSurfaceDesc& srcDesc, GrMipMapped, SkBackingFit,
+ SkBudgeted, const void* srcData, size_t srcRowBytes, GrInternalSurfaceFlags);
+
+ // Deferred version - no data.
+ GrTextureProxy(const GrBackendFormat&, const GrSurfaceDesc& srcDesc, GrSurfaceOrigin,
+ GrMipMapped, SkBackingFit, SkBudgeted, GrInternalSurfaceFlags);
+
+ // Lazy-callback version
+ // There are two main use cases for lazily-instantiated proxies:
+ // basic knowledge - width, height, config, origin are known
+ // minimal knowledge - only config is known.
+ //
+ // The basic knowledge version is used for DDL where we know the type of proxy we are going to
+ // use, but we don't have access to the GPU yet to instantiate it.
+ //
+ // The minimal knowledge version is used for CCPR where we are generating an atlas but we do not
+ // know the final size until flush time.
+ GrTextureProxy(LazyInstantiateCallback&&, LazyInstantiationType, const GrBackendFormat&,
+ const GrSurfaceDesc& desc, GrSurfaceOrigin, GrMipMapped, SkBackingFit,
+ SkBudgeted, GrInternalSurfaceFlags);
+
+ // Wrapped version
+ GrTextureProxy(sk_sp<GrSurface>, GrSurfaceOrigin);
+
+ ~GrTextureProxy() override;
+
+ sk_sp<GrSurface> createSurface(GrResourceProvider*) const override;
+
+ void setTargetKeySync(bool sync) { fSyncTargetKey = sync; }
+
+private:
+ // WARNING: Be careful when adding or removing fields here. ASAN is likely to trigger warnings
+ // when instantiating GrTextureRenderTargetProxy. The std::function in GrSurfaceProxy makes
+ // each class in the diamond require 16 byte alignment. Clang appears to layout the fields for
+ // each class to achieve the necessary alignment. However, ASAN checks the alignment of 'this'
+ // in the constructors, and always looks for the full 16 byte alignment, even if the fields in
+ // that particular class don't require it. Changing the size of this object can move the start
+ // address of other types, leading to this problem.
+
+ GrMipMapped fMipMapped;
+ bool fSyncTargetKey = true; // Should target's unique key be sync'ed with ours.
+
+ GrUniqueKey fUniqueKey;
+ GrProxyProvider* fProxyProvider; // only set when fUniqueKey is valid
+
+ // Only used for proxies whose contents are being prepared on a worker thread. This object
+ // stores the texture data, allowing the proxy to remain uninstantiated until flush. At that
+ // point, the proxy is instantiated, and this data is used to perform an ASAP upload.
+ std::unique_ptr<GrDeferredProxyUploader> fDeferredUploader;
+
+ size_t onUninstantiatedGpuMemorySize() const override;
+
+ // Methods made available via GrTextureProxy::CacheAccess
+ void setUniqueKey(GrProxyProvider*, const GrUniqueKey&);
+ void clearUniqueKey();
+
+ SkDEBUGCODE(void onValidateSurface(const GrSurface*) override;)
+
+ // For wrapped proxies the GrTexture pointer is stored in GrIORefProxy.
+ // For deferred proxies that pointer will be filled in when we need to instantiate
+ // the deferred resource
+
+ typedef GrSurfaceProxy INHERITED;
+};
+
+#endif
diff --git a/src/gpu/GrTextureProxyCacheAccess.h b/src/gpu/GrTextureProxyCacheAccess.h
index 0ea372d..26478c6 100644
--- a/src/gpu/GrTextureProxyCacheAccess.h
+++ b/src/gpu/GrTextureProxyCacheAccess.h
@@ -8,7 +8,7 @@
#ifndef GrTextureProxyCacheAccess_DEFINED
#define GrTextureProxyCacheAccess_DEFINED
-#include "include/private/GrTextureProxy.h"
+#include "src/gpu/GrTextureProxy.h"
/**
* This class allows GrResourceCache increased privileged access to GrTextureProxy objects.
diff --git a/src/gpu/GrTextureProxyPriv.h b/src/gpu/GrTextureProxyPriv.h
index 4b8a880..1e64194 100644
--- a/src/gpu/GrTextureProxyPriv.h
+++ b/src/gpu/GrTextureProxyPriv.h
@@ -8,7 +8,7 @@
#ifndef GrTextureProxyPriv_DEFINED
#define GrTextureProxyPriv_DEFINED
-#include "include/private/GrTextureProxy.h"
+#include "src/gpu/GrTextureProxy.h"
class GrDeferredProxyUploader;
class GrOpFlushState;
diff --git a/src/gpu/GrTextureRenderTargetProxy.h b/src/gpu/GrTextureRenderTargetProxy.h
index 852309b..57b4150 100644
--- a/src/gpu/GrTextureRenderTargetProxy.h
+++ b/src/gpu/GrTextureRenderTargetProxy.h
@@ -8,8 +8,8 @@
#ifndef GrTextureRenderTargetProxy_DEFINED
#define GrTextureRenderTargetProxy_DEFINED
-#include "include/private/GrRenderTargetProxy.h"
-#include "include/private/GrTextureProxy.h"
+#include "src/gpu/GrRenderTargetProxy.h"
+#include "src/gpu/GrTextureProxy.h"
#ifdef SK_BUILD_FOR_WIN
// Windows gives warnings about inheriting asTextureProxy/asRenderTargetProxy via dominance.
diff --git a/src/gpu/GrTracing.h b/src/gpu/GrTracing.h
index 3ed59ae..df66eb8 100644
--- a/src/gpu/GrTracing.h
+++ b/src/gpu/GrTracing.h
@@ -10,6 +10,8 @@
#include "src/core/SkTraceEvent.h"
+#include "src/gpu/GrAuditTrail.h"
+
class GrContext;
/**
@@ -18,5 +20,4 @@
#define GR_CREATE_TRACE_MARKER_CONTEXT(classname, op, context) \
GR_AUDIT_TRAIL_AUTO_FRAME(context->priv().auditTrail(), classname "::" op); \
TRACE_EVENT0("skia.gpu", classname "::" op)
-
#endif
diff --git a/src/gpu/GrVertexWriter.h b/src/gpu/GrVertexWriter.h
index 6365446..7b1ddc1 100644
--- a/src/gpu/GrVertexWriter.h
+++ b/src/gpu/GrVertexWriter.h
@@ -8,8 +8,8 @@
#ifndef GrVertexWriter_DEFINED
#define GrVertexWriter_DEFINED
-#include "include/private/GrColor.h"
#include "include/private/SkTemplates.h"
+#include "src/gpu/GrColor.h"
#include "src/gpu/geometry/GrQuad.h"
#include <type_traits>
diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp
index 22cd6fb..2e5e29f 100644
--- a/src/gpu/GrYUVProvider.cpp
+++ b/src/gpu/GrYUVProvider.cpp
@@ -10,7 +10,6 @@
#include "include/core/SkRefCnt.h"
#include "include/core/SkYUVAIndex.h"
#include "include/private/GrRecordingContext.h"
-#include "include/private/GrTextureProxy.h"
#include "src/core/SkAutoMalloc.h"
#include "src/core/SkCachedData.h"
#include "src/core/SkResourceCache.h"
@@ -21,6 +20,7 @@
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/effects/GrYUVtoRGBEffect.h"
sk_sp<SkCachedData> GrYUVProvider::getPlanes(SkYUVASizeInfo* size,
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 911262b..27a12a7 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -12,7 +12,6 @@
#include "include/gpu/GrContext.h"
#include "include/gpu/GrTypes.h"
#include "include/private/GrRecordingContext.h"
-#include "include/private/GrTextureProxy.h"
#include "include/private/SkImageInfoPriv.h"
#include "include/private/SkTemplates.h"
#include "src/core/SkAutoMalloc.h"
@@ -32,6 +31,7 @@
#include "src/gpu/GrPaint.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRecordingContextPriv.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/GrXferProcessor.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/effects/GrBicubicEffect.h"
diff --git a/src/gpu/SkGr.h b/src/gpu/SkGr.h
index f9e32c6..fa39ff8 100644
--- a/src/gpu/SkGr.h
+++ b/src/gpu/SkGr.h
@@ -17,10 +17,10 @@
#include "include/gpu/GrBlend.h"
#include "include/gpu/GrSamplerState.h"
#include "include/gpu/GrTypes.h"
-#include "include/private/GrColor.h"
#include "include/private/SkColorData.h"
#include "src/core/SkBlendModePriv.h"
#include "src/gpu/GrCaps.h"
+#include "src/gpu/GrColor.h"
class GrCaps;
class GrColorSpaceInfo;
diff --git a/src/gpu/ccpr/GrCCAtlas.cpp b/src/gpu/ccpr/GrCCAtlas.cpp
index 3cfb5d0..d42f4ea 100644
--- a/src/gpu/ccpr/GrCCAtlas.cpp
+++ b/src/gpu/ccpr/GrCCAtlas.cpp
@@ -8,7 +8,6 @@
#include "src/gpu/ccpr/GrCCAtlas.h"
#include "include/gpu/GrTexture.h"
-#include "include/private/GrTextureProxy.h"
#include "src/core/SkIPoint16.h"
#include "src/core/SkMakeUnique.h"
#include "src/core/SkMathPriv.h"
@@ -17,6 +16,7 @@
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRectanizer_skyline.h"
#include "src/gpu/GrRenderTargetContext.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/ccpr/GrCCPathCache.h"
#include <atomic>
diff --git a/src/gpu/ccpr/GrCCClipPath.h b/src/gpu/ccpr/GrCCClipPath.h
index 754c011..17e628c 100644
--- a/src/gpu/ccpr/GrCCClipPath.h
+++ b/src/gpu/ccpr/GrCCClipPath.h
@@ -9,7 +9,7 @@
#define GrCCClipPath_DEFINED
#include "include/core/SkPath.h"
-#include "include/private/GrTextureProxy.h"
+#include "src/gpu/GrTextureProxy.h"
struct GrCCPerFlushResourceSpecs;
class GrCCAtlas;
diff --git a/src/gpu/ccpr/GrCCClipProcessor.cpp b/src/gpu/ccpr/GrCCClipProcessor.cpp
index ec3d43f..eebfd47 100644
--- a/src/gpu/ccpr/GrCCClipProcessor.cpp
+++ b/src/gpu/ccpr/GrCCClipProcessor.cpp
@@ -8,8 +8,8 @@
#include "src/gpu/ccpr/GrCCClipProcessor.h"
#include "include/gpu/GrTexture.h"
-#include "include/private/GrTextureProxy.h"
#include "src/core/SkMakeUnique.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/ccpr/GrCCClipPath.h"
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
diff --git a/src/gpu/effects/GrCoverageSetOpXP.cpp b/src/gpu/effects/GrCoverageSetOpXP.cpp
index c121201..13e1c8f 100644
--- a/src/gpu/effects/GrCoverageSetOpXP.cpp
+++ b/src/gpu/effects/GrCoverageSetOpXP.cpp
@@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
-#include "include/private/GrColor.h"
#include "src/gpu/GrCaps.h"
+#include "src/gpu/GrColor.h"
#include "src/gpu/GrPipeline.h"
#include "src/gpu/GrProcessor.h"
#include "src/gpu/GrRenderTargetContext.h"
diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
index 471c122..d79444d 100644
--- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
+++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
@@ -8,7 +8,7 @@
#include "src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h"
#include "include/gpu/GrTexture.h"
-#include "include/private/GrTextureProxy.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index 57e4a8c..f4ec11d 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -7,7 +7,7 @@
#include "src/gpu/effects/GrMatrixConvolutionEffect.h"
#include "include/gpu/GrTexture.h"
-#include "include/private/GrTextureProxy.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/glsl/GrGLSLProgramDataManager.h"
diff --git a/src/gpu/effects/GrSkSLFP.h b/src/gpu/effects/GrSkSLFP.h
index 5e0bd84..1764e9d 100644
--- a/src/gpu/effects/GrSkSLFP.h
+++ b/src/gpu/effects/GrSkSLFP.h
@@ -9,11 +9,11 @@
#define GrSkSLFP_DEFINED
#include "include/core/SkRefCnt.h"
-#include "include/private/GrSkSLFPFactoryCache.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrCoordTransform.h"
#include "src/gpu/GrFragmentProcessor.h"
#include "src/gpu/GrShaderCaps.h"
+#include "src/gpu/GrSkSLFPFactoryCache.h"
#include "src/sksl/SkSLCompiler.h"
#include "src/sksl/SkSLPipelineStageCodeGenerator.h"
#include <atomic>
diff --git a/src/gpu/gl/GrGLPathRendering.cpp b/src/gpu/gl/GrGLPathRendering.cpp
index f6aa176..58783ce 100644
--- a/src/gpu/gl/GrGLPathRendering.cpp
+++ b/src/gpu/gl/GrGLPathRendering.cpp
@@ -9,7 +9,7 @@
#include "src/gpu/gl/GrGLPathRendering.h"
#include "src/gpu/gl/GrGLUtil.h"
-#include "include/private/GrRenderTargetProxy.h"
+#include "src/gpu/GrRenderTargetProxy.h"
#include "src/gpu/gl/GrGLPath.h"
#include "src/gpu/gl/GrGLPathRendering.h"
diff --git a/src/gpu/gradients/GrGradientShader.cpp b/src/gpu/gradients/GrGradientShader.cpp
index 871c18a..9571a8f 100644
--- a/src/gpu/gradients/GrGradientShader.cpp
+++ b/src/gpu/gradients/GrGradientShader.cpp
@@ -21,9 +21,9 @@
#include "src/gpu/gradients/generated/GrTextureGradientColorizer.h"
#include "src/gpu/gradients/generated/GrUnrolledBinaryGradientColorizer.h"
-#include "include/private/GrColor.h"
#include "include/private/GrRecordingContext.h"
#include "src/gpu/GrCaps.h"
+#include "src/gpu/GrColor.h"
#include "src/gpu/GrColorSpaceInfo.h"
#include "src/gpu/GrRecordingContextPriv.h"
#include "src/gpu/SkGr.h"
diff --git a/src/gpu/mtl/GrMtlCaps.mm b/src/gpu/mtl/GrMtlCaps.mm
index da2e374..52c9494 100644
--- a/src/gpu/mtl/GrMtlCaps.mm
+++ b/src/gpu/mtl/GrMtlCaps.mm
@@ -10,9 +10,9 @@
#include "include/core/SkRect.h"
#include "include/gpu/GrBackendSurface.h"
#include "include/gpu/GrRenderTarget.h"
-#include "include/private/GrRenderTargetProxy.h"
-#include "include/private/GrSurfaceProxy.h"
+#include "src/gpu/GrRenderTargetProxy.h"
#include "src/gpu/GrShaderCaps.h"
+#include "src/gpu/GrSurfaceProxy.h"
#include "src/gpu/mtl/GrMtlUtil.h"
#if !__has_feature(objc_arc)
diff --git a/src/gpu/mtl/GrMtlGpuCommandBuffer.mm b/src/gpu/mtl/GrMtlGpuCommandBuffer.mm
index fe6c576..c6d32da 100644
--- a/src/gpu/mtl/GrMtlGpuCommandBuffer.mm
+++ b/src/gpu/mtl/GrMtlGpuCommandBuffer.mm
@@ -7,7 +7,7 @@
#include "src/gpu/mtl/GrMtlGpuCommandBuffer.h"
-#include "include/private/GrColor.h"
+#include "src/gpu/GrColor.h"
#include "src/gpu/GrFixedClip.h"
#include "src/gpu/GrRenderTargetPriv.h"
#include "src/gpu/GrTexturePriv.h"
diff --git a/src/gpu/ops/GrAAConvexPathRenderer.cpp b/src/gpu/ops/GrAAConvexPathRenderer.cpp
index edb81a0..85ea734 100644
--- a/src/gpu/ops/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAAConvexPathRenderer.cpp
@@ -10,6 +10,7 @@
#include "src/core/SkGeometry.h"
#include "src/core/SkPathPriv.h"
#include "src/core/SkPointPriv.h"
+#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrDrawOpTest.h"
#include "src/gpu/GrGeometryProcessor.h"
diff --git a/src/gpu/ops/GrAAHairLinePathRenderer.cpp b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
index 42906a4..1aa1638 100644
--- a/src/gpu/ops/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
@@ -12,6 +12,7 @@
#include "src/core/SkPointPriv.h"
#include "src/core/SkRectPriv.h"
#include "src/core/SkStroke.h"
+#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrBuffer.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrClip.h"
diff --git a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
index bac3f5f..5cbb89a 100644
--- a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
@@ -9,6 +9,7 @@
#include "src/core/SkGeometry.h"
#include "src/core/SkPathPriv.h"
#include "src/core/SkTraceEvent.h"
+#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrDefaultGeoProcFactory.h"
#include "src/gpu/GrDrawOpTest.h"
diff --git a/src/gpu/ops/GrClearStencilClipOp.h b/src/gpu/ops/GrClearStencilClipOp.h
index b43762b..4049936 100644
--- a/src/gpu/ops/GrClearStencilClipOp.h
+++ b/src/gpu/ops/GrClearStencilClipOp.h
@@ -8,8 +8,8 @@
#ifndef GrClearStencilClipOp_DEFINED
#define GrClearStencilClipOp_DEFINED
-#include "include/private/GrRenderTargetProxy.h"
#include "src/gpu/GrFixedClip.h"
+#include "src/gpu/GrRenderTargetProxy.h"
#include "src/gpu/ops/GrOp.h"
class GrOpFlushState;
diff --git a/src/gpu/ops/GrDashLinePathRenderer.cpp b/src/gpu/ops/GrDashLinePathRenderer.cpp
index 8399d3b..5c06cfd 100644
--- a/src/gpu/ops/GrDashLinePathRenderer.cpp
+++ b/src/gpu/ops/GrDashLinePathRenderer.cpp
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
-#include "include/private/GrAuditTrail.h"
+#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrGpu.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/geometry/GrShape.h"
diff --git a/src/gpu/ops/GrDebugMarkerOp.h b/src/gpu/ops/GrDebugMarkerOp.h
index bf7b9eb..fd7eb0c 100644
--- a/src/gpu/ops/GrDebugMarkerOp.h
+++ b/src/gpu/ops/GrDebugMarkerOp.h
@@ -8,7 +8,7 @@
#ifndef GrDebugMarkerOp_DEFINED
#define GrDebugMarkerOp_DEFINED
-#include "include/private/GrRenderTargetProxy.h"
+#include "src/gpu/GrRenderTargetProxy.h"
#include "src/gpu/ops/GrOp.h"
class GrOpFlushState;
diff --git a/src/gpu/ops/GrDefaultPathRenderer.cpp b/src/gpu/ops/GrDefaultPathRenderer.cpp
index 0ee7cb5..2e3af82 100644
--- a/src/gpu/ops/GrDefaultPathRenderer.cpp
+++ b/src/gpu/ops/GrDefaultPathRenderer.cpp
@@ -12,6 +12,7 @@
#include "src/core/SkGeometry.h"
#include "src/core/SkTLazy.h"
#include "src/core/SkTraceEvent.h"
+#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrDefaultGeoProcFactory.h"
#include "src/gpu/GrDrawOpTest.h"
diff --git a/src/gpu/ops/GrOvalOpFactory.h b/src/gpu/ops/GrOvalOpFactory.h
index a684641..de25fa1 100644
--- a/src/gpu/ops/GrOvalOpFactory.h
+++ b/src/gpu/ops/GrOvalOpFactory.h
@@ -9,7 +9,7 @@
#define GrOvalOpFactory_DEFINED
#include "include/core/SkRefCnt.h"
-#include "include/private/GrColor.h"
+#include "src/gpu/GrColor.h"
class GrDrawOp;
class GrPaint;
diff --git a/src/gpu/ops/GrQuadPerEdgeAA.h b/src/gpu/ops/GrQuadPerEdgeAA.h
index 7133a1b..d643c2f 100644
--- a/src/gpu/ops/GrQuadPerEdgeAA.h
+++ b/src/gpu/ops/GrQuadPerEdgeAA.h
@@ -11,8 +11,8 @@
#include "include/core/SkPoint.h"
#include "include/core/SkPoint3.h"
#include "include/gpu/GrSamplerState.h"
-#include "include/private/GrColor.h"
#include "include/private/GrTypesPriv.h"
+#include "src/gpu/GrColor.h"
#include "src/gpu/GrGeometryProcessor.h"
#include "src/gpu/geometry/GrQuad.h"
#include "src/gpu/ops/GrMeshDrawOp.h"
diff --git a/src/gpu/ops/GrSemaphoreOp.h b/src/gpu/ops/GrSemaphoreOp.h
index 4307da4..215fb22 100644
--- a/src/gpu/ops/GrSemaphoreOp.h
+++ b/src/gpu/ops/GrSemaphoreOp.h
@@ -11,7 +11,7 @@
#include "src/gpu/ops/GrOp.h"
#include "include/core/SkRefCnt.h"
-#include "include/private/GrRenderTargetProxy.h"
+#include "src/gpu/GrRenderTargetProxy.h"
#include "src/gpu/GrSemaphore.h"
class GrRecordingContext;
diff --git a/src/gpu/ops/GrShadowRRectOp.h b/src/gpu/ops/GrShadowRRectOp.h
index 45fbc6c..c4d313d 100644
--- a/src/gpu/ops/GrShadowRRectOp.h
+++ b/src/gpu/ops/GrShadowRRectOp.h
@@ -9,7 +9,7 @@
#define GrShadowRRectOp_DEFINED
#include <memory>
-#include "include/private/GrColor.h"
+#include "src/gpu/GrColor.h"
class GrDrawOp;
class GrRecordingContext;
diff --git a/src/gpu/ops/GrSmallPathRenderer.cpp b/src/gpu/ops/GrSmallPathRenderer.cpp
index e05984b..95d6f7c 100644
--- a/src/gpu/ops/GrSmallPathRenderer.cpp
+++ b/src/gpu/ops/GrSmallPathRenderer.cpp
@@ -15,6 +15,7 @@
#include "src/core/SkDraw.h"
#include "src/core/SkPointPriv.h"
#include "src/core/SkRasterClip.h"
+#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrBuffer.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrDistanceFieldGenFromVector.h"
diff --git a/src/gpu/ops/GrStrokeRectOp.cpp b/src/gpu/ops/GrStrokeRectOp.cpp
index 9c27e47..a016c77 100644
--- a/src/gpu/ops/GrStrokeRectOp.cpp
+++ b/src/gpu/ops/GrStrokeRectOp.cpp
@@ -8,10 +8,10 @@
#include "src/gpu/ops/GrStrokeRectOp.h"
#include "include/core/SkStrokeRec.h"
-#include "include/private/GrColor.h"
#include "include/private/GrResourceKey.h"
#include "include/utils/SkRandom.h"
#include "src/gpu/GrCaps.h"
+#include "src/gpu/GrColor.h"
#include "src/gpu/GrDefaultGeoProcFactory.h"
#include "src/gpu/GrDrawOpTest.h"
#include "src/gpu/GrOpFlushState.h"
diff --git a/src/gpu/ops/GrTessellatingPathRenderer.cpp b/src/gpu/ops/GrTessellatingPathRenderer.cpp
index be15c5d..b8f4cfb 100644
--- a/src/gpu/ops/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/ops/GrTessellatingPathRenderer.cpp
@@ -7,8 +7,8 @@
#include "src/gpu/ops/GrTessellatingPathRenderer.h"
#include <stdio.h>
-#include "include/private/GrAuditTrail.h"
#include "src/core/SkGeometry.h"
+#include "src/gpu/GrAuditTrail.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrDefaultGeoProcFactory.h"
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index 790d7e9..692500f 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -11,7 +11,6 @@
#include "include/core/SkPoint3.h"
#include "include/gpu/GrTexture.h"
#include "include/private/GrRecordingContext.h"
-#include "include/private/GrTextureProxy.h"
#include "include/private/SkTo.h"
#include "src/core/SkMathPriv.h"
#include "src/core/SkMatrixPriv.h"
@@ -28,6 +27,7 @@
#include "src/gpu/GrResourceProviderPriv.h"
#include "src/gpu/GrShaderCaps.h"
#include "src/gpu/GrTexturePriv.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/geometry/GrQuad.h"
#include "src/gpu/geometry/GrQuadList.h"
diff --git a/src/gpu/ops/GrTextureOp.h b/src/gpu/ops/GrTextureOp.h
index 5d07d34..8061a35 100644
--- a/src/gpu/ops/GrTextureOp.h
+++ b/src/gpu/ops/GrTextureOp.h
@@ -8,8 +8,8 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkRefCnt.h"
#include "include/gpu/GrSamplerState.h"
-#include "include/private/GrColor.h"
#include "include/private/GrTypesPriv.h"
+#include "src/gpu/GrColor.h"
#include "src/gpu/GrRenderTargetContext.h"
class GrColorSpaceXform;
diff --git a/src/gpu/text/GrAtlasManager.cpp b/src/gpu/text/GrAtlasManager.cpp
index d736478..be5d05c 100644
--- a/src/gpu/text/GrAtlasManager.cpp
+++ b/src/gpu/text/GrAtlasManager.cpp
@@ -68,10 +68,10 @@
}
#ifdef SK_DEBUG
-#include "include/private/GrSurfaceProxy.h"
-#include "include/private/GrTextureProxy.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrSurfaceContext.h"
+#include "src/gpu/GrSurfaceProxy.h"
+#include "src/gpu/GrTextureProxy.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkImageEncoder.h"
diff --git a/src/gpu/text/GrStrikeCache.cpp b/src/gpu/text/GrStrikeCache.cpp
index 1569146..211e73a 100644
--- a/src/gpu/text/GrStrikeCache.cpp
+++ b/src/gpu/text/GrStrikeCache.cpp
@@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
-#include "include/private/GrColor.h"
#include "src/gpu/GrCaps.h"
+#include "src/gpu/GrColor.h"
#include "src/gpu/GrDistanceFieldGenFromVector.h"
#include "src/gpu/text/GrAtlasManager.h"
#include "src/gpu/text/GrStrikeCache.h"
diff --git a/src/gpu/text/GrTextBlob.h b/src/gpu/text/GrTextBlob.h
index 5bd633c..81d6d65 100644
--- a/src/gpu/text/GrTextBlob.h
+++ b/src/gpu/text/GrTextBlob.h
@@ -11,7 +11,6 @@
#include "include/core/SkPathEffect.h"
#include "include/core/SkPoint3.h"
#include "include/core/SkSurfaceProps.h"
-#include "include/private/GrColor.h"
#include "src/core/SkDescriptor.h"
#include "src/core/SkMaskFilterBase.h"
#include "src/core/SkOpts.h"
@@ -19,6 +18,7 @@
#include "src/core/SkStrikeCache.h"
#include "src/core/SkStrikeSpec.h"
#include "src/core/SkTInternalLList.h"
+#include "src/gpu/GrColor.h"
#include "src/gpu/GrDrawOpAtlas.h"
#include "src/gpu/text/GrStrikeCache.h"
#include "src/gpu/text/GrTextContext.h"
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index 5db4d45..50f7d7c 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -9,7 +9,7 @@
#include "include/gpu/GrRenderTarget.h"
#include "include/gpu/vk/GrVkBackendContext.h"
#include "include/gpu/vk/GrVkExtensions.h"
-#include "include/private/GrRenderTargetProxy.h"
+#include "src/gpu/GrRenderTargetProxy.h"
#include "src/gpu/GrShaderCaps.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/vk/GrVkCaps.h"
diff --git a/src/gpu/vk/GrVkGpuCommandBuffer.h b/src/gpu/vk/GrVkGpuCommandBuffer.h
index d3eb668..a821356 100644
--- a/src/gpu/vk/GrVkGpuCommandBuffer.h
+++ b/src/gpu/vk/GrVkGpuCommandBuffer.h
@@ -12,7 +12,7 @@
#include "include/gpu/GrTypes.h"
#include "include/gpu/vk/GrVkTypes.h"
-#include "include/private/GrColor.h"
+#include "src/gpu/GrColor.h"
#include "src/gpu/GrMesh.h"
#include "src/gpu/GrTRecorder.h"
#include "src/gpu/vk/GrVkPipelineState.h"
diff --git a/src/gpu/vk/GrVkUtil.h b/src/gpu/vk/GrVkUtil.h
index 06e052e..7d2b241 100644
--- a/src/gpu/vk/GrVkUtil.h
+++ b/src/gpu/vk/GrVkUtil.h
@@ -10,8 +10,8 @@
#include "include/gpu/GrTypes.h"
#include "include/gpu/vk/GrVkTypes.h"
-#include "include/private/GrColor.h"
#include "include/private/SkMacros.h"
+#include "src/gpu/GrColor.h"
#include "src/gpu/GrDataUtils.h"
#include "src/gpu/vk/GrVkInterface.h"
#include "src/sksl/ir/SkSLProgram.h"
diff --git a/src/image/SkImage_Base.h b/src/image/SkImage_Base.h
index a3b86c5..856c41e 100644
--- a/src/image/SkImage_Base.h
+++ b/src/image/SkImage_Base.h
@@ -13,8 +13,8 @@
#include <atomic>
#if SK_SUPPORT_GPU
-#include "include/private/GrTextureProxy.h"
#include "include/private/SkTDArray.h"
+#include "src/gpu/GrTextureProxy.h"
class GrRecordingContext;
class GrTexture;
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 7d3c772..443fd35 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -14,7 +14,6 @@
#include "include/gpu/GrContext.h"
#include "include/gpu/GrTexture.h"
#include "include/private/GrRecordingContext.h"
-#include "include/private/GrTextureProxy.h"
#include "include/private/SkImageInfoPriv.h"
#include "src/core/SkAutoPixmapStorage.h"
#include "src/core/SkBitmapCache.h"
@@ -42,6 +41,7 @@
#include "src/gpu/GrTextureAdjuster.h"
#include "src/gpu/GrTextureContext.h"
#include "src/gpu/GrTexturePriv.h"
+#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/GrTextureProxyPriv.h"
#include "src/gpu/SkGr.h"
#include "src/gpu/effects/GrYUVtoRGBEffect.h"