Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: include/gpu/GrContext.h

Issue 1776693002: Add deferred texture upload API. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase on sk_skp Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkPixmap.h ('k') | src/core/SkPixmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrContext.h
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 4245b7fa943cc894cb216f609f1e767116264777..6d67d3ebb3acc2b57094fb3fc858c246d5816fab 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -24,6 +24,7 @@
struct GrBatchAtlasConfig;
class GrBatchFontCache;
struct GrContextOptions;
+class GrContextThreadSafeProxy;
class GrDrawingManager;
class GrDrawContext;
class GrDrawTarget;
@@ -61,6 +62,8 @@ public:
virtual ~GrContext();
+ GrContextThreadSafeProxy* threadSafeProxy();
+
/**
* The GrContext normally assumes that no outsider is setting state
* within the underlying 3D API's context/device/whatever. This call informs
@@ -359,25 +362,27 @@ public:
SkDEBUGCODE(GrSingleOwner* debugSingleOwner() const { return &fSingleOwner; } )
private:
- GrGpu* fGpu;
- const GrCaps* fCaps;
- GrResourceCache* fResourceCache;
+ GrGpu* fGpu;
+ const GrCaps* fCaps;
+ GrResourceCache* fResourceCache;
// this union exists because the inheritance of GrTextureProvider->GrResourceProvider
// is in a private header.
union {
- GrResourceProvider* fResourceProvider;
- GrTextureProvider* fTextureProvider;
+ GrResourceProvider* fResourceProvider;
+ GrTextureProvider* fTextureProvider;
};
- GrBatchFontCache* fBatchFontCache;
- SkAutoTDelete<GrLayerCache> fLayerCache;
- SkAutoTDelete<GrTextBlobCache> fTextBlobCache;
+ SkAutoTUnref<GrContextThreadSafeProxy> fThreadSafeProxy;
+
+ GrBatchFontCache* fBatchFontCache;
+ SkAutoTDelete<GrLayerCache> fLayerCache;
+ SkAutoTDelete<GrTextBlobCache> fTextBlobCache;
// Set by OverbudgetCB() to request that GrContext flush before exiting a draw.
- bool fFlushToReduceCacheSize;
- bool fDidTestPMConversions;
- int fPMToUPMConversion;
- int fUPMToPMConversion;
+ bool fFlushToReduceCacheSize;
+ bool fDidTestPMConversions;
+ int fPMToUPMConversion;
+ int fUPMToPMConversion;
// The sw backend may call GrContext::readSurfacePixels on multiple threads
// We may transfer the responsibilty for using a mutex to the sw backend
// when there are fewer code paths that lead to a readSurfacePixels call
@@ -388,26 +393,26 @@ private:
// readSurfacePixels proceeds to grab it.
// TODO: Stop pretending to make GrContext thread-safe for sw rasterization and provide
// a mechanism to make a SkPicture safe for multithreaded sw rasterization.
- SkMutex fReadPixelsMutex;
- SkMutex fTestPMConversionsMutex;
+ SkMutex fReadPixelsMutex;
+ SkMutex fTestPMConversionsMutex;
// In debug builds we guard against improper thread handling
// This guard is passed to the GrDrawingManager and, from there to all the
// GrDrawContexts. It is also passed to the GrTextureProvider and SkGpuDevice.
- mutable GrSingleOwner fSingleOwner;
+ mutable GrSingleOwner fSingleOwner;
struct CleanUpData {
PFCleanUpFunc fFunc;
void* fInfo;
};
- SkTDArray<CleanUpData> fCleanUpData;
+ SkTDArray<CleanUpData> fCleanUpData;
- const uint32_t fUniqueID;
+ const uint32_t fUniqueID;
- SkAutoTDelete<GrDrawingManager> fDrawingManager;
+ SkAutoTDelete<GrDrawingManager> fDrawingManager;
- GrAuditTrail fAuditTrail;
+ GrAuditTrail fAuditTrail;
// TODO: have the CMM use drawContexts and rm this friending
friend class GrClipMaskManager; // the CMM is friended just so it can call 'drawingManager'
@@ -452,4 +457,23 @@ private:
typedef SkRefCnt INHERITED;
};
+/**
+ * Can be used to perform actions related to the generating GrContext in a thread safe manner. The
+ * proxy does not access the 3D API (e.g. OpenGL) that backs the generating GrContext.
+ */
+class GrContextThreadSafeProxy : public SkRefCnt {
+private:
+ GrContextThreadSafeProxy(const GrCaps* caps, uint32_t uniqueID)
+ : fCaps(SkRef(caps))
+ , fContextUniqueID(uniqueID) {}
+
+ SkAutoTUnref<const GrCaps> fCaps;
+ uint32_t fContextUniqueID;
+
+ friend class GrContext;
+ friend class SkImage;
+
+ typedef SkRefCnt INHERITED;
+};
+
#endif
« no previous file with comments | « include/core/SkPixmap.h ('k') | src/core/SkPixmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698